IRegistryKey::DeleteKey method (portcls.h)

The DeleteKey method deletes the registry key.

Syntax

NTSTATUS DeleteKey();

Return value

DeleteKey returns STATUS_SUCCESS if the call was successful. Otherwise, the method returns an appropriate error code.

Remarks

A caller deletes an IRegistryKey object's registry key by calling the DeleteKey method on that object. The key can be deleted only if the caller created the key with an ACCESS_MASK that permits deletion. The caller enables deletion by specifying a DesiredAccess parameter value of KEY_ALL_ACCESS (described in ZwCreateKey) to the PcNewRegistryKey, IPort::NewRegistryKey, or IRegistryKey::NewSubKey call that creates the key. When deleting a key, the IRegistryKey object discards its registry-key handle, and all other handles to the deleted key become invalid.

Requirements

Requirement Value
Target Platform Universal
Header portcls.h (include Portcls.h)
IRQL PASSIVE_LEVEL

See also

ACCESS_MASK

IPort::NewRegistryKey

IRegistryKey

IRegistryKey::NewSubKey

PcNewRegistryKey

ZwCreateKey

ZwDeleteKey