Platform SDK: Registry |
The RegOpenUserClassesRoot function retrieves a handle to the HKEY_CLASSES_ROOT key for a specified user. The user is identified by an access token. The returned key has a view of the registry that merges the contents of the HKEY_LOCAL_MACHINE\Software\Classes key with the contents of the Software\Classes keys in the user's registry hive. For more information, see The HKEY_CLASSES_ROOT Key.
LONG RegOpenUserClassesRoot( HANDLE hToken, // token DWORD dwOptions, // reserved; must be zero REGSAM samDesired, // security access mask PHKEY phkResult // receives key handle );
Value | Meaning |
---|---|
KEY_CREATE_LINK | Permission to create a symbolic link. |
KEY_CREATE_SUB_KEY | Permission to create subkeys. |
KEY_ENUMERATE_SUB_KEYS | Permission to enumerate subkeys. |
KEY_EXECUTE | Permission for read access. |
KEY_NOTIFY | Permission for change notification. |
KEY_QUERY_VALUE | Permission to query subkey data. |
KEY_SET_VALUE | Permission to set subkey data. |
KEY_ALL_ACCESS | Combines the KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, KEY_CREATE_SUB_KEY, KEY_CREATE_LINK, and KEY_SET_VALUE access rights, plus all the standard access rights except SYNCHRONIZE. |
KEY_READ | Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY access rights. |
KEY_WRITE | Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, and KEY_CREATE_SUB_KEY access rights. |
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
The RegOpenUserClassesRoot function enables you to retrieve the merged HKEY_CLASSES_ROOT information for users other than the interactive user. For example, the server component of a client/server application could use RegOpenUserClassesRoot to retrieve the merged information for a client.
RegOpenUserClassesRoot fails if the user profile for the specified user is not loaded. When a user logs on interactively, the system automatically loads the user's profile. For other users, you can call the LoadUserProfile function to load the user's profile. However, LoadUserProfile can be very time-consuming, so do not call it for this purpose unless it is absolutely necessary to have the user's merged HKEY_CLASSES_ROOT information.
Applications running in the security context of the interactively logged-on user do not need to use RegOpenUserClassesRoot. These applications can call the RegOpenKeyEx function to retrieve a merged view of the HKEY_CLASSES_ROOT key for the interactive user.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winreg.h; include Windows.h.
Library: Use Advapi32.lib.
Registry Overview, Registry Functions, LoadUserProfile, RegCloseKey, RegOpenKeyEx