RegOpenKeyEx

RegOpenKeyEx opens the specified registry key.

Syntax

Copy
LONG RegOpenKeyEx(
    HKEY       hKey,
    LPCTSTR    lpSubKey,
    DWORD      ulOptions, 
    REGSAM     samDesired, 
    PHKEY      phkResult 
  );

Parameters

hKey

A handle that can only be one of the following predefined keys:

lpSubKey

The name of a key that this function opens or creates. This key must be a subkey of the key identified by the hKey parameter. Key names are not case sensitive. If this parameter is NULL or a pointer to an empty string, the function returns the handle to the predefined hKey parameter.

ulOptions

This parameter is reserved and must be zero.

samDesired

Ignored.

phkResult

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.

Return Value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails the return value is a nonzero error code.

Remarks

Unlike the RegCreateKeyEx function, the RegOpenKeyEx function does not create the specified key if the key does not exist in the registry. An application should call RegCloseKey when the handle is no longer in use, or upon application exit.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

windows.h rtkrnl.lib

See Also