Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ZwDeleteKey routine

The ZwDeleteKey routine deletes an open key from the registry.

Syntax


NTSTATUS ZwDeleteKey(
  _In_ HANDLE KeyHandle
);

Parameters

KeyHandle [in]

Handle to the registry key to be deleted. The handle is created by a successful call to ZwCreateKey or ZwOpenKey.

Return value

ZwDeleteKey returns an NTSTATUS value. Possible return values include:

STATUS_SUCCESS
STATUS_ACCESS_DENIED
STATUS_INVALID_HANDLE

Remarks

The handle must have been opened for DELETE access for this routine to succeed. For more information, see the DesiredAccess parameter for ZwCreateKey.

A call to ZwDeleteKey causes the handle that is specified in the KeyHandle parameter—and all other handles to the deleted key—to become invalid. After a call to ZwDeleteKey invalidates the key handles, you must call ZwClose to close the key handles.

For more information about working with registry keys, see Using the Registry in a Driver.

Note  If the call to this function occurs in user mode, you should use the name "NtDeleteKey" instead of "ZwDeleteKey".

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

IrqlZwPassive, PowerIrpDDis, ZwRegistryCreate, ZwRegistryOpen, HwStorPortProhibitedDDIs, ZwRegistryCreate(storport), ZwRegistryOpen(storport)

See also

ZwCreateKey
ZwOpenKey

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft