IoOpenDriverRegistryKey function (wdm.h)

The IoOpenDriverRegistryKey routine returns a handle to a driver-specific registry key for a particular driver.

Syntax

NTSTATUS IoOpenDriverRegistryKey(
  PDRIVER_OBJECT     DriverObject,
  DRIVER_REGKEY_TYPE RegKeyType,
  ACCESS_MASK        DesiredAccess,
  ULONG              Flags,
  PHANDLE            DriverRegKey
);

Parameters

DriverObject

[in]A pointer to a DRIVER_OBJECT structure. This structure must be the driver object for the calling driver.

RegKeyType

[in]An enumeration of type DRIVER_REGKEY_TYPE that indicates the type of the requested registry key.

DesiredAccess

[in]Specifies the ACCESS_MASK value that represents the access rights needed for the key. See ZwCreateKey for a description of each KEY_XXX access right.

Flags

[in]Set to zero.

DriverRegKey

[out]A pointer to the HANDLE variable that, on successful return, contains a handle to the requested registry key.

Return value

IoOpenDriverRegistryKey returns STATUS_SUCCESS if the call successfully opened a handle to the requested registry key.

Remarks

The driver must call ZwClose to close the handle returned from this routine when access is no longer needed.

The registry keys opened by this routine are nonvolatile.

To provision keys and values under the immutable DriverRegKeyParameters registry key, use an AddReg directive from a service-install-section to reference an add-registry-section section that contains entries with a reg-root of HKR and a subkey of Parameters.

Callers of IoOpenDriverRegistryKey must be running at IRQL = PASSIVE_LEVEL in the context of a system thread.

Requirements

   
Minimum supported client Windows 10, version 1803
Header wdm.h (include wdm.h, ntddk.h, or ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL

See also

ZwClose

ACCESS_MASK

DRIVER_REGKEY_TYPE