Archive: How to tell if a Dll is Registered?


How to tell if a Dll is Registered?
I searched the forum but everything I found related to knowing about an installable Dll, and of course the "!insertmacro InstallLib REGDLL" handles that for you. In my case, the Dll in question is not part of my installer but I want to alert the user running my installer if the MS Windows Image Acquisition Library (wiaaut.dll) isn't registered on their system (seems like it's there ootb for Windows 7 but not for XP. For Windows Server 2008, the dll can be found in a subfolder but it's not registered).

Is there an easy way to tell if a Dll is registered on a box? I know the GUID for the Dll's TypeLib entry in the registry (HKEY_CLASSES_ROOT\TypeLib\{94A0E92D-43C0-494E-AC29-FD45948A5221}) but is checking for that sufficient? I'd also like to know the install path which really depends on the OS (for XP, it's c:\windows\system32\wiaaut.dll) which might be under different subkeys depending on the OS (again, on XP it's there under 1.0 > 0 > win32).


Well, if we talk about "registering" a DLL, we actually talk about COM DLL's. Registering a COM "in process" server (COM DLL) does nothing but calling the DllRegisterServer entry point of the DLL. It's up to the developer of the COM DLL to create and export that function. It may do pretty much anything! It usually creates the registry entries needed to make the COM class provided by the DLL available to other applications, but it may do arbitrary other things.

I guess the best way to check whether a "COM DLL" is "registered" would be checking whether the COM class provided by that DLL - and after all that's what you want to use, right? - is available or not. Just try to create an instance of that class via CoCreateInstance(), using the right CLSID. If that function fails with REGDB_E_CLASSNOTREG it means the class is not registered. And thus the COM DLL that is supposed to provide that class obviously has not been registered yet...


That sounds ideal, LoRd_MuldeR. I have the TypeLib GUID for the dll - how do I find the CLSID?


OleView?

http://www.microsoft.com/en-us/downl....aspx?id=17657