NTSTATUS
ZwOpenKey(
OUT PHANDLE KeyHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes
);
ZwOpenKey opens an existing key in the registry.
Parameters
KeyHandle
Points to a returned handle for the key specified in ObjectAttributes if this call is successful.
DesiredAccess
Specifies the access rights desired to the key. See ZwCreateKey for a description of possible values for this parameter.
ObjectAttributes
Points to the initialized object attributes of the key being opened. See the description of ZwCreateKey for more information.
Return Value
ZwOpenKey returns STATUS_SUCCESS if the given key was opened. Otherwise, it can return an error status, including the following values:
STATUS_INVALID_HANDLE
STATUS_ACCESS_DENIED
Comments
ZwOpenKey or ZwCreateKey must be called before any of the Zw...Key routines that require an input KeyHandle.
If the specified key does not exist or the DesiredAccess requested is not allowed, ZwOpenKey returns an error status, and the KeyHandle remains invalid.
ZwOpenKey ignores the security information in the input ObjectAttributes. Access rights for a key object can be set only when the key is created.
Callers of ZwOpenKey must be running at IRQL PASSIVE_LEVEL.
See Also
InitializeObjectAttributes, ZwCreateKey, ZwDeleteKey, ZwEnumerateKey, ZwEnumerateValueKey, ZwFlushKey, ZwQueryKey, ZwQueryValueKey, ZwSetValueKey