On the chase of regsvr32 errors on windows 7

I have seen few people hitting an error when trying to register a COM server dll on windows 7. The error reads: "The module ""%1"" may not compatible with the 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." So what is going wrong.

There could be multiple causes to this problem.

  • The first possible cause, as the error obviously states, is if you are running the wrong version of regsvr32 (wow vs native 64).
  • Another common cause is if you have Image Randomization disabled on windows 7 by setting: /DYNAMICBASE:NO, then you could hit this problem.
  • Another possible cause is that if your COM server links to a dll with the same name as a system dll, Regsvr32 might load the system dll instead of your custom dll, and fails consequently.

If all these do not address your problem, then you may turn to your old friend, the debugger. Just launch regsvr32 in the debugger and check why did it fail when calling the LoadLibrary.

Hope this helps.