ZwDeleteKey

NTSTATUS
ZwDeleteKey(

IN HANDLE KeyHandle
);

ZwDeleteKey deletes an open key from the registry.

Parameters

KeyHandle

Is a handle returned by a successful call to ZwCreateKey or ZwOpenKey.

Return Value

ZwDeleteKey can return one of the following values:

STATUS_SUCCESS
STATUS_ACCESS_DENIED
STATUS_INVALID_HANDLE

Comments

The key must have been opened for DELETE access for a deletion to succeed; the DesiredAccess value KEY_ALL_ACCESS includes DELETE access. The actual storage for the key is deleted when the last handle to the key is closed.

A call to ZwDeleteKey causes the KeyHandle to become invalid.

Callers of ZwDeleteKey must be running at IRQL PASSIVE_LEVEL.

See Also

ZwClose, ZwCreateKey, ZwOpenKey