2
votes

I'm trying to create a 32-bit COM object from a 64-bit application.

I use CLSCTX_LOCAL_SERVER in the CoCreateInstance call, and I've added an empty DllSurrogate key to the AppId registry key to tell COM to host the server in the DllHost. I've called regsvr32 myproxy.dll from an elevated prompt to register the proxy, no error. And I see in the registry that there are ProxyStubClsid32 keys for my interface in the 64-bit portion of the registry.

I call CoCreateInstance like this:

CComPtr<IMyObj> myobj;
HRESULT hr = myobj.CoCreateInstance(CLSID_MyObj, NULL, CLSCTX_LOCAL_SERVER);

This actually works on my dev machine, I can see in VS that the proxy DLL is being loaded. But not on the machine I'm testing on. So it is a configuration issue.

Note that CoCreateInstance returns S_OK if I request an IUnknown, which tells me that the component is registered properly.

How do I get COM to load the proxy DLL?

1
Just a guess, try registering myproxy.dll with C:\Windows\SysWOW64\regsvr32.exe - noseratio

1 Answers

1
votes

I'll have to go by the info that's missing from the question, the only real lead. You need two builds of the proxy/stub DLL. A 64-bit build that can be loaded into the 64-bit client and must be registered by c:\windows\system32\regsvr32.exe. And a 32-bit build that can be loaded into the surrogate process and must be registered by c:\windwos\syswow64\regsvr32.exe. No evidence in the question that this latter step was taken care of.

If that doesn't help then get diagnostics from SysInternals' ProcMon. You ought to see it searching for the registry keys as well as the DLL and failing at it.