Author Topic: [3.8.4] XMPlay crashes with AccessViolation when starting with xmp-apx plug-in  (Read 171 times)

emilles

  • Posts: 4
Hello,
Not sure if 3.8.3 or 3.8.4 is where this started.  I have tested with 3.8.2.3 and no problems.  When starting the player, shortly after requesting output interface from plug-in (xmp-apx), there is an access violation reading 0x00000001.  If I remove xmp-apx.dll there is no issue starting.  I do not have symbols for xmplay.exe so I can't say much more.

I tried updating the xmpout.h and xmpfunc.h from the SDK.  I saw only minor changes for 3.8.2 in xmpfunc.h, but applied them nonetheless.  No difference before or after.

I set breakpoints in each of my interface callbacks and did not see any additional calls.  I don't know if my callback interface is supposed to have a new function pointer at the end or what exactly.


All this code runs normally and shortly after returning the XMPOUT pointer from this function, XMPlay tries to access a nullptr:


extern "C" __declspec(dllexport) XMPOUT* XMPOUT_GetInterface(DWORD face,
   InterfaceProc faceproc)
{
   if (face == 0)
   {
      Debugger::print("Player requesting plug-in interface...");

      // initialize output interface singleton
      static XMPOUT out = {
         0,         // flags
         "Devices", // label
         Output::optionsDialogProc,
         Output::getName,
         Output::getFlags,
         Output::open,
         Output::close,
         Output::reset,
         Output::setPaused,
         Output::setVolumeAndBalance,
         Output::canWrite,
         Output::write,
         Output::getBuffered,
         nullptr, // getGeneralInfo
         Output::onNewTrack
      };

      if (player == nullptr)
      {
         // initialize player interface singleton
         player.reset(new XMPlayPlayer(
            (XMPFUNC_MISC*) faceproc(XMPFUNC_MISC_FACE),
            (XMPFUNC_STATUS*) faceproc(XMPFUNC_STATUS_FACE)));

         // initialize plug-in options file path
         CHAR pathBuffer[MAX_PATH];
         if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, pathBuffer)))
         {
            iniFilePath.assign(pathBuffer);
            iniFilePath.append("\\");
            iniFilePath.append(Plugin::name());
            SHCreateDirectoryExA(NULL, iniFilePath.c_str(), NULL);
            iniFilePath.append("\\plugin.ini");
         }
         else
         {
            DWORD pathLength = GetModuleFileNameA(dllInstance, pathBuffer, MAX_PATH);
            if (pathLength > 0 && pathLength <= MAX_PATH)
            {
               const std::string pathString(pathBuffer, pathLength);
               const auto pos = pathString.find_last_of('\\');
               if (pos != std::string::npos)
                  iniFilePath.assign(pathString.substr(0, pos + 1));
            }
            iniFilePath.append("xmplay.ini");
         }

         // load plug-in options from file
         OptionsUtils::loadOptions(iniFilePath);
      }

      return &out;
   }

   return nullptr;
}

Ian @ un4seen

  • Administrator
  • Posts: 22396
That looks like you may not be using the WINAPI (stdcall) calling convention? All of the plugin's exported functions, including the XMPOUT_GetInterface function, should be using WINAPI. If the problem persists even then, please upload a dump file from the crash to have a look at here:

   ftp.un4seen.com/incoming/

emilles

  • Posts: 4
All interface functions are using WINAPI (aka __stdcall).  Nothing has changed there.

One note, I update the xmp-coverart.svp to v8 and was able to start with no issue.  I'm not sure how/why xmp-apx.dll and xmp-coverart.svp are interacting.

Ian @ un4seen

  • Administrator
  • Posts: 22396
Make sure the XMPOUT_GetInterface function is using WINAPI/stdcall too (it doesn't appear to be in the code above).