Bagikan melalui


Using the VirtualizeHKCRLite Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the VirtualizeHKCRLite compatibility fix, including the usage and API-related information.

VirtualizeHKCRLite

The VirtualizeHKCRLite compatibility fix is a higher-performance alternative to running VirtualRegistry with the VIRTUALIZEHKCR command line. Applications which are trying to register COM components at runtime will generally take write handles to HKEY_CLASSES_ROOT, which is a virtual merge of HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes. When creating a key that does not exist, the key will be created in HKEY_LOCAL_MACHINE, which a non-elevated user will not have the permissions to complete. This compatibility fix redirects calls to write to HKEY_CLASSES_ROOT to HKEY_CURRENT_USER\Software\Classes, which a non-elevated user will be able to complete successfully.

Investigating the Issue

You have two options to determining whether the HKCRLite compatibility fix will resolve your issue.

  • You can run the Standard User Analyzer tool, which is provided in the Developer and Tester Tools directory of the Application Compatibility Toolkit.

  • You can use a registry-monitoring program, such as Sysinternals' Process Monitor to record your issue. After recording your issue, you can then search for any of the ACCESS DENIED errors that occurred for registry keys that are pointing at HKEY_CLASSES_ROOT.

Intercepted APIs

The following list includes all of the APIs that are intercepted by the VirtualizeHKCRLite compatibility fix.

  • RegCreateKeyA

  • RegCreateKeyW

  • RegCreateKeyExA

  • RegCreateKeyExW

  • RegOpenKeyA

  • RegOpenKeyW

  • RegOpenKeyExA

  • RegOpenKeyExW

  • RegCloseKey

  • RegDeleteKeyA

  • RegDeleteKeyW

  • RegQueryInfoKeyA

  • RegQueryInfoKeyW

  • RegEnumKeyA

  • RegEnumKeyW

  • RegEnumKeyExA

  • RegEnumKeyExW

  • RegSetValueA

  • RegSetValueW

VirtualizeHKCRLite Command-Line Options

You can use the DisableVirtualDelete command-line option to disable the automatic handling for the virtual deletion of registry keys. By disabling this handling, the application will be able to act as if it deleted the HKCR registry keys that already exist in the HKLM registry hive.

Fixing Your Code

We recommend that you register your per-computer COM components during installation, when the installer has elevated privileges. If your COM component is a per-user component, then you must implement the self-registration process (DllRegisterServer) to write to the HKEY_CURRENT_USER\Software\Classes registry keys. You can also redirect registry keys, by using the RegOverridePredefKey API.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems