AIT_RegCreateKey
- Organization of this page
Description
Creates a specified registry key. Opens a specified registry key if it already exists.
Format
bool AIT_RegCreateKey( integer nHKeyHandle, // Key handle string strRegKeyName, // Name of a key to be created integer nOutputHkeyHandle // Output key handle );
Parameters
nHKeyHandle (input)
Specify a handle to an already opened registry key, or one of the following values.
-
HKEY_CLASSES_ROOT
-
HKEY_CURRENT_CONFIG
-
HKEY_CURRENT_USER
-
HKEY_LOCAL_MACHINE
-
HKEY_USERS
strRegKeyName (input)
Specify the name of a registry key to be created or opened.
nOutputHkeyHandle (output)
Specify a variable to receive a handle to a registry key. When the function returns, the variable stores the handle.
Return values
The return value is true if the function was executed normally, and false if not. If the function has returned false, you can use AIT_GetLastError to acquire an extended error code. The following gives the error codes that AIT_GetLastError might return:
Extended error number |
Error code |
---|---|
6 |
ERROR_INVALID_HANDLE |
87 |
ERROR_INVALID_PARAMETER |
1009 |
ERROR_BADDB |
1010 |
ERROR_BADKEY |
1015 |
ERROR_REGISTRY_CORRUPT |
1016 |
ERROR_REGISTRY_IO_FAILED |
1019 |
ERROR_NO_LOG_SPACE |
Note
-
Before termination, call AIT_RegCloseKey to close nOutputHkeyHandle.
-
To create a registry key, you must have permission to write at the location where you want to create the registry key.
-
If you attempt to open an existing registry key on which you do not have write permission, the registry key opens in the read-only mode.