Regcreatekeyex
This function is used to create a registry key. If the key already exists, open it (the registry key is case-insensitive)
Long regcreatekeyex (
Hkey,
Lptstr lpsubkey,
DWORD reserved,
Lptstr lpclass,
DWORD dwoptions,
Regsam samdesired,
Lpsecurity_attributes lpsecurityattributes,
Phkey phkresult,
Lpdword lpdwdisposition
);
Parameters:
Hkey
Input parameter, a handle to open the key. The process that calls this function must have the power of key_create_sub_key. This handle can be the return value of regcreatekeyex or regopenkeyex, or the following predefined values
Hkey_classes_root
Hkey_current_config
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Lpsubkey
The input parameter that identifies the subkey name. This parameter cannot be blank. Parameter cannot exist (/)
Reserved
Reserved value, which must be 0
Lpclass
An input parameter pointing to a string that defines the type of the key. It can be null. This parameter can be used for local and remote registry operations.
Dwoptions
Input parameter, which can be the following values
Reg_option_backup_restore, 0x00000004l
Reg_option_non_volatile, 0x00000000l. This value is generally used.
Reg_option_volatile, 0x00000001l
Samdesired
Input parameter, access permission defined
Lpsecurityattributes
The input parameter defines whether the returned handle can be inherited by the quilt process. If it is null, it cannot be inherited.
Phkresult
Output parameter, save the returned handle
Lpdwdisposition
Output parameter, which can be the following values. If it is null, no result is returned.
Reg_created_new_key, 0x00000001l this key is newly created
Reg_opened_existing_key, 0x00000002l this key is an existing key
Return values
If the call succeeds, error_success is returned.
Remarks
The key created by this function has no key value. Applications cannot create direct subkeys for HKEY_USERS or HKEY_LOCAL_MACHINE.