RegCreateKeyEx

RegCreateKeyEx creates the specified registry key. If the key already exists in the registry, the function opens it. See RegCreateKey for a basic version of this function.

Syntax

Copy
LONG RTAPI RegCreateKey(
    HKEY           hKey,
    LPCTSTR        lpSubKey,
    DWORD          Reserved,
    LPTSTR         lpClass,
    DWORD          dwOptions,
    REGSAM         samDesired,
    LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
    PHKEY          phkResult,
    LPDWORD        lpdwDisposition 
  );

Parameters

hKey

A handle that can 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.

Reserved

Reserved parameter that must be set to zero.

lpClass  

This parameter is optional and can be NULL. This parameter may be ignored.

dwOptions

Ignored.

samDesired

Ignored.

lpSecurityAttributes

Ignored.

phkResult

A pointer to a variable that receives a handle to the opened or created key.

lpdwDisposition

Ignored.

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

The function cannot create a key that is a direct child of HKEY_USERS or HKEY_LOCAL_MACHINE. An application can create subkeys in lower levels of HKEY_USERS or HKEY_LOCAL_MACHINE trees.

An application should call RegCloseKey when the handle is no longer in or upon application exit.

An application can use the RegCreateKeyEx function to create one level deep at once.

RegCreateKeyEx will fail to create or open a registry key if the parameter hkey is not one of the following two standard pre-defined registry hive keys: HKEY_LOCAL_MACHINE or HKEY_USERS

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

windows.h rtkrnl.lib

See Also: