In our application, we need to use COM-dll (namely msdia100.dll), which was not previously registered in the system.
Earler, we just named the DLL by calling it DllRegisterServer through this code:
// Register DIA DLL required by Breakpad std::string diaLibPath = "msdia100"; HMODULE diaLib = LoadLibrary(diaLibPath.c_str()); if( diaLib == NULL ) { errors << "Cannot load DLL " << diaLibPath << endl; return; } typedef HRESULT ( __stdcall * regServer_t )(void); regServer_t regServer = (regServer_t)GetProcAddress(diaLib, "DllRegisterServer"); if( regServer == NULL ) { errors << "Cannot get method DllRegisterServer from " << diaLibPath << endl; FreeLibrary(diaLib); return; } if( regServer() != S_OK ) { errors << "Cannot call DllRegisterServer from " << diaLibPath << endl; } FreeLibrary(diaLib);
This no longer works on Windows 7 (Vista may not have tried it either) because it needs administrator privileges to call this function.
I found all solutions to this problem, where about obtaining these administrator rights. This is not a possible solution for us, because our application should also work if the user cannot obtain these administrator rights.
For us, we also donโt need to suddenly need an installer for our application that registers this DLL.
So what are the possibilities? How can I use this DLL without administrator privileges? Should I recode a COM that works without having to register the DLL first?
The code in which I use this library is as follows:
CComPtr<IDiaDataSource> data_source; if (FAILED(data_source.CoCreateInstance(CLSID_DiaSource))) { fprintf(stderr, "CoCreateInstance CLSID_DiaSource failed " "(msdia80.dll unregistered?)\n"); return false; }
(Btw., For those interested: it's part of the Google Breakpad.)
source share