Opens the specified registry key and associates it with a transaction. Note that key names are not case sensitive.
LSTATUS RegOpenKeyTransactedA( HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult, HANDLE hTransaction, PVOID pExtendedParemeter );
A handle to an open registry key. This handle is returned by the RegCreateKeyEx, RegCreateKeyTransacted, RegOpenKeyEx, or RegOpenKeyTransacted function. It can also be one of the following predefined keys:
HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS
The name of the registry subkey to be opened.
Key names are not case sensitive.
If this parameter is NULL or a pointer to an empty string, the function will open a new handle to the key identified by the hKey parameter.
For more information, see Registry Element Size Limits.
This parameter is reserved and must be zero.
A mask that specifies the desired access rights to the key. The function fails if the security descriptor of the key does not permit the requested access for the calling process. For more information, see Registry Key Security and Access Rights.
A pointer to a variable that receives a handle to the opened key. If the key is not one of the predefined registry keys, call the RegCloseKey function after you have finished using the handle.
A handle to an active transaction. This handle is returned by the CreateTransaction function.
This parameter is reserved and must be NULL.
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.
When a key is opened using this function, subsequent operations on the key are transacted. If a non-transacted operation is performed on the key before the transaction is committed, the transaction is rolled back. After a transaction is committed or rolled back, you must re-open the key using the RegCreateKeyTransacted or RegOpenKeyTransacted function with an active transaction handle to make additional operations transacted. For more information about transactions, see Kernel Transaction Manager.
Note that subsequent operations on subkeys of this key are not automatically transacted. Therefore, the RegDeleteKeyEx function does not perform a transacted delete operation. Instead, use the RegDeleteKeyTransacted function to perform a transacted delete operation.
Unlike the RegCreateKeyTransacted function, the RegOpenKeyTransacted function does not create the specified key if the key does not exist in the registry.
If your service or application impersonates different users, do not use this function with HKEY_CURRENT_USER. Instead, call the RegOpenCurrentUser function.
A single registry key can be opened only 65,534 times. When attempting the 65,535th open operation, this function fails with ERROR_NO_SYSTEM_RESOURCES.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|
|Header||winreg.h (include Windows.h)|