开发者

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

开发者 https://www.devze.com 2023-02-14 17:00 出处:网络
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.

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?


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.


32bit applications and components are getting redirected to a different part of the registry. If you are browsing the registry with the 64bit version of regedit you will not find it at the location you expect.

Therefore your component should register itself in HKEY_CLASSES_ROOT\Wow6432Node\CLSID.

In this registry path it should be visible to all 32bit applications.

See also:

  • Windows 64-bit registry v.s. 32-bit registry
  • David Broman's CLR Profiling API Blog: WOW64 and Your Profiler


We just had a similar issue here, Regsvr32 was not reporting an error, but nothing appeared to be written to the registry.

Running 'As Administrator' seemed to do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号