Re: Registering ActiveX control on Vista
- From: wawang@xxxxxxxxxxxxxxxxxxxx (Walter Wang [MSFT])
- Date: Thu, 23 Nov 2006 01:49:09 GMT
Hi all,
Sorry for delayed reply. I was doing researching and consulting about this
issue yesterday.
Vista is just out, and it also contains many new features such as security
changes which have impacts on how we develop software on it. I'm afraid
this is one of the many changes that we must be aware of.
RegOverridePredefKey is actually working just fine on Vista. The problem
lies in the DllRegisterServer from the COM component you're invoking after
redirected the registry key.
If you use WinDbg to trace the DllRegisterServer call, it will internally
call CoCreateInstance several times (I'm using VB6 COM DLL for testing
using a normal user account on Vista).
On XP it works because the CoCreateInstance will do a bunch of
RegOpenKey(HKLM\Software\Class) that will fail, but it will eventually do
RegOpenKey(HKCR\Clsid\...) and will return success.
On Vista, all calls are with HKLM\Software\Class, so they all fail and the
app gets back with 80040154. The behavior change is due to security
reasons. For a non-admin or not elevated process, the fallback on HKCR
doesn't happen.
If you run the process as administrator or elevate its privilege when UAC
is turned on, you will notice it doesn't have this issue. I understand this
defeats the original purpose of this approach that registering COM
components as a normal user, I'm very sorry for the inconvenience that it
caused.
Many setup programs currently will not directly invoke DllRegisterServer on
end-user system. They normally extract the registry keys when creating the
setup programs (possibly also using RegOverridePredefKey), and import the
registry keys when installing.
As a workaround, I would suggest you to extract registry keys on a XP or
Vista system that you have administrative privilege and import the registry
keys instead of invoking DllRegisterServer on a Vista system that you're
running as normal user.
#The Windows Vista Developer Story: Application Compatibility Cookbook
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html
/AppComp.asp
By the way, this is not related to Registry Virtualization.
==================
#Registry Virtualization
http://msdn2.microsoft.com/en-gb/library/aa965884.aspx
Registry virtualization is an application compatibility technology that
enables registry write operations that have global impact to be redirected
to per-user locations. This redirection is transparent to applications
reading from or writing to the registry. It is supported starting with
Windows Vista.
For example, registry operations to the global store
(HKEY_LOCAL_MACHINE\Software) are redirected to a per-user location within
the user's profile known as the virtual store (HKEY_USERS\<User
SID>_Classes\VirtualStore\Machine\Software).
If the caller does not have write access to a key and attempts to write a
value to it or create a subkey, the value is written to the virtual store.
If the caller reads from a key that is virtualized, the registry presents a
merged view of both the virtualized values (from the virtual store) and the
non-virtual values (from the global store) to the caller.
Registry virtualization is enabled only for the following:
* 32-bit interactive processes
* Keys in HKEY_LOCAL_MACHINE\Software
* Keys that an administrator can write to. (If an administrator cannot
write to a key, then the application would have failed on previous versions
of Windows even if it was run by an administrator.)
In addition to controlling virtualization at an application level by using
requestedExecutionLevel in the manifest, you can also enable or disable it
on a per-key basis for keys in HKEY_LOCAL_MACHINE\Software. The command
line utility Reg.exe has a new FLAGS option that administrators can use for
this purpose.
C:\>reg flags HKLM\Software\AppKey1 QUERY
HKEY_LOCAL_MACHINE\Software\AppKey1
REG_KEY_DONT_VIRTUALIZE: CLEAR
REG_KEY_DONT_SILENT_FAIL: CLEAR
REG_KEY_RECURSE_FLAG: CLEAR
The operation completed successfully.
==================
Sincerely,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- Re: Registering ActiveX control on Vista
- From: Paul Baker [MVP, Windows - Networking]
- Re: Registering ActiveX control on Vista
- References:
- Re: Registering ActiveX control on Vista
- From: Alexander Nickolov
- Re: Registering ActiveX control on Vista
- From: Paul Baker [MVP, Windows - Networking]
- Re: Registering ActiveX control on Vista
- From: Markus Raabe
- Re: Registering ActiveX control on Vista
- From: Paul Baker [MVP, Windows - Networking]
- Re: Registering ActiveX control on Vista
- Prev by Date: Re: Registering ActiveX control on Vista
- Next by Date: how to get rid of bad netpath error?
- Previous by thread: Re: Registering ActiveX control on Vista
- Next by thread: Re: Registering ActiveX control on Vista
- Index(es):
Relevant Pages
|