Okay, so I took a few leaps of faith from the example (Delphi) general-purpose plug-in and I think I have the new callback implemented correctly:
Code: Select all
static DWORD mmCookie = 0;
extern "C" __declspec(dllexport)
void MMSetInterfaceCookie(DWORD cookie)
{
mmCookie = cookie;
}
...
if (mmCookie > 0)
{
CComPtr<IGlobalInterfaceTable> pGIT;
pGIT.CoCreateInstance(CLSID_StdGlobalInterfaceTable, NULL, CLSCTX_INPROC_SERVER);
pGIT->GetInterfaceFromGlobal(mmCookie, IID_ISDBApplication, (LPVOID*) &sdbApplication);
When MM has registered its COM objects with the local server, this works 100% of the time. However, when MM has not registered (or I forcibly unregister) its objects, the GetInterfaceFromGlobal fails when called as part of the Open() sequence of the output plug-in. But does succeed in other circumstances.
Any ideas as to why this call is spotty when MM is fully portable? That is the case this callback business is supposed to be helping.