I have a .NET COM dll with a custom registration procedure so it gets registered under HKEY_CURRENT_USER\Software\Classes as opposite to HKEY_LOCAL_MACHINE. So there are the following keys (current user is the admin on the Windows 7 PC):
HKEY_CURRENT_USER\Software\Classes\My.ProgId\CLSID
HKEY_CURRENT_USER\Sof开发者_如何学Gotware\Classes\CLSID\{XYZZYZYZYZ-YZYZY-ZYZYZY} etc
If I build a simple C++ client:
hr = CLSIDFromProgID(OLESTR("My.ProgId"), &clsid);
and run it without UAC elevation (Windows 7), it creates the component successfully.
On the other hand, if I run with elevation on, it fails with Invalid class string
.
I've inspected with process monitor, when it works it looks for the HKCU\Software\Classes\My.ProgID key and that opens ok. When it fails (elevation on) it looks for HKCR\My.ProgId and errors with NAME NOT FOUND
. Opening the registry key manually from classes_root
is successful though:
HKEY key;
RegOpenKey( HKEY_CLASSES_ROOT, _T( "My.ProgId"), &key);
Please help! Thanks
精彩评论