[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.
NTSTATUS WdfDriverOpenParametersRegistryKey( [in] WDFDRIVER Driver, [in] ACCESS_MASK DesiredAccess, [in, optional] PWDF_OBJECT_ATTRIBUTES KeyAttributes, [out] WDFKEY *Key );
- Driver [in]
- DesiredAccess [in]
An ACCESS_MASK-typed value that specifies an access mask for the Parameters registry key. A KMDF driver typically requests STANDARD_RIGHTS_ALL, but a UMDF driver needs to be more specific. A UMDF driver should specify KEY_READ if opening the Parameters key for read-only access, or KEY_READ | KEY_SET_VALUE for read-write access. See additional info for UMDF drivers in the Return values section.
Your driver must ask for only the types of access that it needs. For example, the driver must not ask for KEY_ALL_ACCESS if it will only read the registry key. For a list of access rights that drivers typically use for registry keys, see Opening a Handle to a Registry-Key Object.
- 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.
WdfDriverOpenParametersRegistryKey returns STATUS_SUCCESS if the operation succeeds. Additional return values include:
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.
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.
For more information about the registry, see Using the Registry in Framework-Based Drivers.
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 );
Minimum KMDF version
Minimum UMDF version
DDI compliance rules
|DriverCreate, KmdfIrql, KmdfIrql2|