|Fixing "RegSvr32 The module failed to load. The specified module could not be found." on Windows 64-bit|
|Written by Darwin Sanoy|
|Friday, September 28, 2012 5:16am|
So you are preparing your first Windows 64-bit image or just dutifully customizing your own machine. You copy your traditional set of DLLs to the System32 folder and execute regsrv32.exe against them. To your horror you receive the error “RegSvr32 The module some.dll failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files. The specified module could not be found.” Has your machine gone insane? The file is plainly there in the System32 folder. Let’s put it under the microscope.
Here is the seemingly insane output you may be seeing:
It is quite obvious the file is exactly where you told regsvr32.exe it is, so why is Windows suddenly blind?
This type of situation generally leads to slamming your forehead on your keyboard several times and wondering why you didn't take up your childhood urge to be a Doctor - you could be golfing right now!
Let's save some wear and tear on your keyboard and, most importantly, your forehead...
Unravelling the Mystery
This error happens on 64-bit Windows when you place a 32-bit DLL in the System32 folder and attempt to register it with 32 or 64-bit regsrv32.exe.
64-bit Regsvr32.exe employs a little trick – when it notices you are trying to register a 32-bit DLL, it silently calls 32-bit Regsvr32.exe for you!
That’s an awesome little fixup by Microsoft and it works great when your files are in any other folder.
We can see this magic happening in Process Monitor:
In the 64-bit command prompt we called 64-bit regsvr32.exe (unpathed references in a 64-bit process will search the path).
64-bit regsrv32.exe noticed that the DLL is 32-bit an automatically called 32-bit regsvr32.exe for us.
But when 32-bit regsvr32.exe accesses the current working folder %windir%\system32, it is automatically redirected to %windir%\SysWOW64, where there is no DLL.
You might decide to get smart and leave the DLL in the real System32 folder and fully path regsvr32 at %windir%\sysWOW64\regsvr32.exe – but you will receive the same error for the exact same reason.
The solution is simple, any 32-bit DLLs that are placed in the System32 folder on a 32-bit system must be placed in the SysWOW64 folder and registered there.
Windows Explorer Extensions / Plug-ins
A word of caution, if your DLL is supposed to extend Windows Explorer with a context menu or property pane on some file type extentions (FTEs), Windows 64-bit will allow you to successfully register it, but 64-bit Windows Explorer ignores the registry key where these registrations go because it simply can not load 32-bit DLLs into its 64-bit process.
Stop Scraping Your Knees on the 64-bit Pavement ;)
This is just one of the few reasons we’ve pulled together an eBook called Deploying and Supporting Applications on Windows 64-bit.
It’s exceptionally affordable and I’d be willing to bet it saves you many hours and many knee scrapes!