Question

I'm trying to register a COM DLL file on Windows Server 2008 R2. Here are the steps I took:

  1. Run cmd as administrator
  2. c:\windows\system32\regsvr32.exe c:\tempdl\temp12.dll

When I execute that command I get this error:

The module temp12.dll failed to load. Make sure the binary is stored at the specified path or debut it to check for problems with the binary or dependent .DLL files. The specified module could not be found.

I was able to register the same DLL file on Windows 2000.

I also tried

c:\windows\syswow64\regsvr32 "c:\tempdl\temp12.dll"

And I got this error:

the module c:\tempdl\temp12.dll was loaded but the call to DllRegisterServer failed with error code 0x80040154. For more information about this problem, search online using the error code as the search term

Was it helpful?

Solution

That's the error you get when the DLL itself requires another COM server to be registered first or has a dependency on another DLL that's not available. The Regsvr32.exe tool does very little, it calls LoadLibrary() to load the DLL that's passed in the command line argument. Then GetProcAddress() to find the DllRegisterServer() entry point in the DLL. And calls it to leave it up to the COM server to register itself.

What that code does is fairly unguessable. The diagnostic you got is however pretty self-evident from the error code, for some reason this COM server needs another one to be registered first. The error message is crappy, it doesn't tell you what other server it needs. A sad side-effect of the way COM error handling works.

To troubleshoot this, use SysInternals' ProcMon tool. It shows you what registry keys Regsvr32.exe (actually: the COM server) is opening to find the server. Look for accesses to the CLSID key. That gives you a hint what {guid} it is looking for. That still doesn't quite tell you the server DLL, you should compare the trace with one you get from a machine that works. The InprocServer32 key has the DLL path.

OTHER TIPS

You might need to register this DLL using the 32 bit version of regsvr32.exe:

c:\windows\syswow64\regsvr32 c:\tempdl\temp12.dll

Error 0x80040154 is COM's REGDB_E_CLASSNOTREG, which means "Class not registered". Basically, a COM class is not declared in the installation registry.

If you get this error when trying to register a DLL, it may be possible that the registration code for this DLL is trying to instantiate another COM server (DLL or EXE) which is missing or not registered on this installation.

If you don't have access to the original DLL source, I would suggest to use SysInternal's Process Monitor tool to track COM registry lookups (there use to be a more simple RegMon tool but it may not work any more).

You should put a filter on the working process (here: Regsvr32.exe) to only capture what's interesting. Then you should look for queries on HKEY_CLASSES_ROOT\[a progid, a string] that fail (with the NAME_NOT_FOUND error for example), or queries on HKEY_CLASSES_ROOT\CLSID\[a guid] that fail.

PS: Unfortunately, there may be many thing that seem to fail on a perfectly working Windows system, so you'll have to study all errors carefully. Good luck :-)

I have found similar issue while registering my activeX (OCX) into windows server 2008 R2.To solve this i used http://www.chestysoft.com/dllregsvr/default.asp tool.There is some dependance problem with my ocx so I am getting "The module temp12.dll failed to load. Make sure the binary is stored at the specified path or debut it to check for problems with the binary or dependent .DLL files. The specified module could not be found" error message. When you try to registered your OCX with this tool it will prompt message if the ocx is having dependency or you will get success message.I got message for mfc70.dll and msvcr70.dll dependency.so i paste these dll into system32 folder of C:\windows and its done.After that I register my ocx sucessfully.I used 32 bit version of chestysoft tool (dllregsvr.exe) on windows server 2008 R2 64bit machine.

You may need to install ATL if your COM objects use ATL, as described by this KB article:

http://support.microsoft.com/kb/201191

These libraries will probably have to be supplied by developers to ensure the correct version.

This is what has to occur.

You have to copy your DLL that you want to Register to: c:\windows\SysWOW64\

Then in the Run dialog, type this in: C:\Windows\SysWOW64\regsvr32.exe c:\windows\system32\YourDLL.dll

and you will get the message:

DllRegisterServer in c:\windows\system32\YourDLL.dll succeeded.

You need the full path to the regsvr32 so %windir$\system32\regsvr32 <*.dll>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top