WdfRegistryWdmGetHandle function (wdfregistry.h)

[Applies to KMDF and UMDF]

The WdfRegistryWdmGetHandle method returns a Windows Driver Model (WDM) handle to the registry key that a specified framework registry-key object represents.

Syntax

HANDLE WdfRegistryWdmGetHandle(
  [in] WDFKEY Key
);

Parameters

[in] Key

A handle to a registry-key object that represents an opened registry key.

Return value

WdfRegistryWdmGetHandle returns a WDM handle to a registry key.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

A KMDF driver can pass the returned WDM handle to the ZwXxx routines that accept a WDM handle as input.

A UMDF driver can pass the returned handle to APIs that require an HKEY, such as RegEnumKeyEx.

The handle that the WdfRegistryWdmGetHandle method returns is valid until the registry-key object is deleted. If the driver provides an EvtCleanupCallback function for the registry-key object, the pointer is valid until the callback function returns.

For more information about registry-key objects, see Using the Registry in Framework-Based Drivers.

Examples

The following code example obtains a WDM handle to the registry key that a specified framework registry-key object represents.

HANDLE hKey;

hKey = WdfRegistryWdmGetHandle(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)