WdfRegistryRemoveKey function (wdfregistry.h)
[Applies to KMDF and UMDF]
The WdfRegistryRemoveKey method removes the registry key that is associated with a specified framework registry-key object and then deletes the registry-key object.
Syntax
NTSTATUS WdfRegistryRemoveKey(
[in] WDFKEY Key
);
Parameters
[in] Key
A handle to a registry-key object that represents an opened registry key.
Return value
WdfRegistryRemoveKey returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the following values:
Return code | Description |
---|---|
|
WdfRegistryRemoveKey was not called at IRQL = PASSIVE_LEVEL. |
|
The driver did not open the registry key with deletion access. |
|
See the Remarks section. |
This method also might return other NTSTATUS values.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
Note
Before calling WdfRegistryRemoveKey, ensure that all the keys and values under the given key have been deleted. Delete each subkey first, starting with the leaf keys and work your way up.
From a KMDF driver, do not call WdfRegistryRemoveKey and then WdfRegistryClose on the same key. The WDFKEY is no longer valid after WdfRegistryRemoveKey returns.
For more information about registry-key objects, see Using the Registry in Framework-Based Drivers.
Examples
The following code example removes a registry key and deletes the registry-key object.
NTSTATUS status;
status = WdfRegistryRemoveKey(Key);
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfregistry.h (include Wdf.h) |
Library | Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF) |
IRQL | PASSIVE_LEVEL |
DDI compliance rules | DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf) |