简体   繁体   中英

Registering both 32bit and 64bit DLLs

I'm refering to this thread

How do I install both 32-bit and 64-bit versions of a COM DLL and "auto-select"?

we have exactly the same situation. A namespace extension Dll 32bit and 64bit with same CLSID App ID out of the same project. Now registering those two Dlls works flawlessly. Unregistering brings up some errors. The first unregister works but the second fails. Because I think windows (?) thinks the Dll has already been deregistered...

Do the two Dlls need different CLSIDs and/or App IDs???

Kind regards, Michael

EDIT: here's what the DllUnregisterServer does:

STDAPI DllUnregisterServer(void){

    _AtlModule.UpdateRegistryAppId(FALSE);
    HRESULT hRes2 = _AtlModule.UnregisterServer(TRUE);
    if (hRes2 != S_OK)
        return hRes2;
    AFX_MANAGE_STATE(_afxModuleAddrThis);

    if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
        return ResultFromScode(SELFREG_E_CLASS);

     return NOERROR;
}

Windows doesn't care - it's regsvr32 that performs the registration. You use the 32-bit version of regsvr32 for 32-bit DLLs and the 64-bit version for 64-bit DLLs.

Both version just load the DLL, find DllRegisterServer() / DllUnregisterServer() entry point, invoke it and observe the returned value. Whatever goes inside is not regsvr32 business.

Your problem is one of those functions works wrong. You have to debug this. A good start is to use Process Monitor utility to observe what registry accesses are performed and whether they are what you expect.

Adding more info to the answer from sharptooth , if you are unregistering your dll programmatically by excecuting regsvr32, then you might be calling the wrong regsvr32 file. You need to make sure you call regsvr32 from System32 for unregistering your 64 bit dll and regsvr32 from SysWow64 for unregistering the 32 bits version. You can p/Invoke the funcion GetSystemWow64Directory for retrieving the SysWow64 folder location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM