On Windows7, regsvr32 doesn't write to HKCR\CLSID

leiflundgren picture leiflundgren · Mar 4, 2011 · Viewed 8k times · Source

I have created a new simple COM object in Visual Studio 2008 using the ATL-wizard. The object has a single class and simple methods. The ATL-wizard did generate .rgs-files for my class.

When I run regsvr32 Simple.dll on my XP machine the class is registered, information shows up in HKCR\Simple.SimpleObject and in HKCR\CLSID\{guid} as I expect.

However, on my 64bit Windows 7 machine it's not the same. I run regsvr32 as administrator the parts in HKCR\Simple.SimpleObject show up. But the part in HKCR\CLSID never gets there. And hence I cannot create new instances. (Being desperate I have tried both regsvr32 in System32 and in SysWOW64, same effect.)

Why dont regsrv32 put data into HKCR\CLSID?

Answer

Hans Passant picture Hans Passant · Mar 4, 2011

HKCR is an alias for HKLM\Software\Classes but it doesn't show everything. Look in HKLM\Software\Wow6432Node\Classes\CLSID for the registered {guid}. Which is where c:\system32\syswow64\regsvr32.exe writes them.

You did mention that you already tried that. There's something really wrong with that, you cannot arbitrarily run either version of Regsvr32.exe and get the same DLL registered. A 32-bit DLL cannot be loaded in a 64-bit process. In other words, there's no way for the 64-bit version of Regsvr32.exe to register a 32-bit COM server. And the other way around. Why you didn't get an error message is unguessable from here, the only sane explanation is that you somehow didn't actually run the right version of Regsvr32.

To really debug this, use SysInternals' ProcMon utility. Its trace shows you how the ATL registrar is writing the keys in the registry.