OROpenKey function

Opens the specified registry key in an offline registry hive.

Syntax

DWORD OROpenKey(
  _In_     ORHKEY  Handle,
  _In_opt_ PCWSTR  lpSubKeyName,
  _Out_    PORHKEY phkResult
);

Parameters

Handle [in]

A handle to an open registry key in an offline registry hive.

lpSubKeyName [in, optional]

A pointer to a UNICODE string that contains the name of the registry key to be opened. This key must be a subkey of the key identified by the Handle parameter.

Key names are not case sensitive.

If this parameter is NULL or a pointer to an empty string, the function returns the same handle that was passed in. If the key specified by the Handle parameter is the root key of the hive, the function returns ERROR_INVALID_PARAMETER.

For more information, see Registry Element Size Limits.

phkResult [out]

A pointer to a variable that receives a handle to the opened key. Use the ORCloseKey function to close the key after you have finished using the handle.

Return value

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.

If the handle to be returned would be a handle to the root key of the hive, the function returns ERROR_INVALID_PARAMETER.

If the specified key has been marked as deleted, this function returns ERROR_KEY_DELETED.

Remarks

The OROpenKey function cannot be used to open the root key in an offline registry hive. To obtain a handle to the root key of a hive, use the OROpenHive function to load the hive into memory.

Requirements

Requirement Value
Redistributable
Windows Offline Registry library version 1.0 or later
Header
Offreg.h
DLL
Offreg.dll

See also

ORCloseKey

ORCreateKey

ORDeleteKey

OROpenHive