1

I have a C++ DLL that I wrote that is failing to register on a 64-bit machine. Note the 32-bit version of the DLL registers on a 32-bit machine.

We build the DLL on a 64-bit Windows 7 computer using Visual Studio 2010 in Release mode and target the x64 platform. I want to install the DLL on a 64-bit Windows 10 computer (destination). The destination computer has the VS 2010 redist installed for 64-bit. When I try to register the program using:

C:\windows\system32\regsvr32.exe

It fails and says that the program "may not be compatible with this version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe".

I use the program called Dependencies that tries to figure out what dependencies the DLL requires. Dependencies says that my DLL requires ATL100.dll. However, this is installed by the VS 2010 redist and is indeed located in C:\windows\system32. The DLL itself does not depend on any third-party programs.

Does anyone have any ideas to what to look for next to get this file registered?

TylerE
  • 78
  • 8
  • Perhaps C:\windows\system32\regsvr32.exe is for 32-bit DLL's only. On my Win7 PC, there is also a regsvr32.exe in C:\Windows\SysWOW64. – Jim Rhodes Oct 03 '18 at 20:00
  • It is confusing, but I am confident that the regsvr32 in system32 is for 64-bit applications and the one in syswow64 is for 32-bit applications based on other stackoverflow questions I've looked at. – TylerE Oct 03 '18 at 20:04
  • To register a control, regsvr32.exe uses LoadLibrary to load your DLL, calls GetProcAddress to get the address of the DLL's DllRegisterServer function and then calls it. It is up to the DLL's implementation of DllRegisterServer to properly register itself. If Dependencies shows that your DLL has the function DllRegisterServer with no other characters, then perhaps your DLL's implementation of that function is incorrect. – Jim Rhodes Oct 03 '18 at 20:30
  • I'll will look into that, but the exact same code compiled against the Win32 platform in VS 2010 and registered on a 32-bit machine works correctly. Because of that, it makes me think that something is missing on the 64-bit destination machine. – TylerE Oct 03 '18 at 20:36
  • I use depends.exe to check dependencies. If anything is missing it highlights it. Does Dependencies do the same thing? Are you using a .def file when you build the DLL? – Jim Rhodes Oct 03 '18 at 20:40
  • Thanks for your help, I got it working, see below. Dependencies is a rewrite of depends.exe that works for 64-bit file. See https://github.com/lucasg/Dependencies for the program. – TylerE Oct 03 '18 at 20:49

1 Answers1

2

I figured it out. I had to uninstall the 64-bit and 32-bit VS 2010 redist . Delete the ATL100.dll out of the C:\windows\system32 and syswow64 directories and reboot the computer. After the reboot I reinstalled both redist installers. Then I was able to register the file from an administrative command prompt.

Maybe something we installed installed the ATL100.dll file and when I installed the 64-bit redist it did not overwrite the ATL100.dll. Leaving a outdated version installed.

TylerE
  • 78
  • 8