WdfDriverOpenParametersRegistryKey function (wdfdriver.h)
[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.
Syntax
NTSTATUS WdfDriverOpenParametersRegistryKey(
[in] WDFDRIVER Driver,
[in] ACCESS_MASK DesiredAccess,
[in, optional] PWDF_OBJECT_ATTRIBUTES KeyAttributes,
[out] WDFKEY *Key
);
Parameters
[in] Driver
A handle to the driver's framework driver object that the driver obtained from a previous call to WdfDriverCreate or WdfGetDriver.
[in] DesiredAccess
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.
[in, optional] KeyAttributes
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.
[out] Key
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 |
---|---|
|
A UMDF driver specified one of the following flags in the DesiredAccess parameter:
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
);
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfdriver.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) |