WdfDriverOpenParametersRegistryKey - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdriver.h

NTSTATUS WdfDriverOpenParametersRegistryKey(
  [in]           WDFDRIVER              Driver,
  [in]           ACCESS_MASK            DesiredAccess,
  [in, optional] PWDF_OBJECT_ATTRIBUTES KeyAttributes,
  [out]          WDFKEY                 *Key
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdriver-wdfdriveropenparametersregistrykey)

WdfDriverOpenParametersRegistryKey function

Description

[Applies to KMDF and UMDF]

The WdfDriverOpenParametersRegistryKey method opens the driver's Parameters registry key and retrieves a handle to a framework registry-key object that represents the key.

Parameters

Driver [in]

A handle to the driver's framework driver object that the driver obtained from a previous call to WdfDriverCreate or WdfGetDriver.

DesiredAccess [in]

An ACCESS_MASK-typed value that specifies an access mask for the Parameters registry key.

A KMDF driver typically requests KEY_READ, KEY_WRITE, or KEY_READ | KEY_WRITE.

If you are writing a UMDF driver, use KEY_READ or KEY_READ | KEY_SET_VALUE.

As a best practice, ask for only the types of access that your driver needs.

KeyAttributes [in, optional]

A pointer to a caller-allocated WDF_OBJECT_ATTRIBUTES structure that specifies object attributes for the framework registry-key object. This parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.

Key [out]

A pointer to a location that receives a handle to a framework registry-key object.

Return value

WdfDriverOpenParametersRegistryKey returns STATUS_SUCCESS if the operation succeeds. Additional return values include:

Return code Description
STATUS_ACCESS_DENIED A UMDF driver specified one of the following flags in the DesiredAccess parameter:

* GENERIC_WRITE
* KEY_CREATE_SUBKEY
* WRITE_DAC

Because the above values are invalid for UMDF drivers, universal flags such as GENERIC_ALL and STANDARD_RIGHTS_ALL also cause WdfDriverOpenParametersRegistryKey to fail with this return value.

For more information about return values, see Framework Object Creation Errors.

This method might also return other NTSTATUS values.

A system bug check occurs if a KMDF driver specifies an invalid handle in Driver.

Remarks

The driver's Parameters key is located in the registry's Services tree. If the driver's Parameters key does not exist, the WdfDriverOpenParametersRegistryKey method creates it.

When the driver has finished using the Parameters registry key, the driver must call WdfRegistryClose.

[!NOTE] UMDF does not support creating subkeys.

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

Examples

The following code example opens a driver's Parameters registry key and obtains a handle to a framework registry-key object that represents the key.

WDFKEY hKey;

status = WdfDriverOpenParametersRegistryKey(
                                            Driver,
                                            STANDARD_RIGHTS_ALL,
                                            WDF_NO_OBJECT_ATTRIBUTES,
                                            &hKey
                                            );

See also

ACCESS_MASK

WDF_OBJECT_ATTRIBUTES

WdfDriverCreate

WdfDriverGetRegistryPath

WdfGetDriver

WdfRegistryClose