情報
要求されたトピックは次のとおりです。しかし、このトピックはこのライブラリには含まれていません。

WdfFdoInitOpenRegistryKey メソッド

The WdfFdoInitOpenRegistryKey method opens a device's hardware key or a driver's software key in the registry and creates a framework registry-key object that represents the registry key.

構文

NTSTATUS WdfFdoInitOpenRegistryKey(
  [in]            PWDFDEVICE_INIT DeviceInit,
  [in]            ULONG DeviceInstanceKeyType,
  [in]            ACCESS_MASK DesiredAccess,
  [in, optional]  PWDF_OBJECT_ATTRIBUTES KeyAttributes,
  [out]           WDFKEY *Key
);

パラメーター

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure that the driver obtained from its EvtDriverDeviceAdd callback function.

DeviceInstanceKeyType [in]

The driver sets the PLUGPLAY_REGKEY_DEVICE flag to open the Device Parameters subkey under the device's hardware key, or it sets the PLUGPLAY_REGKEY_DRIVER flag to open the driver's software key. If the PLUGPLAY_REGKEY_CURRENT_HWPROFILE flag is also set, WdfFdoInitOpenRegistryKey opens the copy of the hardware or software key that is in the current hardware profile.

DesiredAccess [in]

An ACCESS_MASK-typed value that specifies access rights that the driver is requesting for the specified 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 WDF_OBJECT_ATTRIBUTES structure that contains driver-supplied attributes for the new 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 the new registry-key object.

戻り値

WdfFdoInitOpenRegistryKey returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the following values:

リターン コード説明
STATUS_INVALID_DEVICE_REQUEST

WdfFdoInitOpenRegistryKey was not called at IRQL = PASSIVE_LEVEL.

STATUS_INVALID_PARAMETER

An invalid parameter was specified, or the driver did not obtain the WDFDEVICE_INIT structure from its EvtDriverDeviceAdd callback function.

STATUS_INSUFFICIENT_RESOURCES

A registry-key object could not be allocated.

STATUS_ACCESS_DENIED

The system denied the specified access rights.

STATUS_OBJECT_NAME_NOT_FOUND

The specified registry key does not exist.

 

For a list of other return values that the WdfFdoInitOpenRegistryKey method might return, see Framework Object Creation Errors.

The method might also return other NTSTATUS values.

解説

The driver must call WdfFdoInitOpenRegistryKey before calling WdfDeviceCreate. For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

For more information about the WdfFdoInitOpenRegistryKey method, see Creating Device Objects in a Function Driver.

or more information about the registry, hardware and software keys, and registry objects, see Using the Registry in Framework-Based Drivers.

The following code example opens a device's hardware key, with read access.

WDFKEY key;
NTSTATUS status;

status = WdfFdoInitOpenRegistryKey(
                                   DeviceInit,
                                   PLUGPLAY_REGKEY_DEVICE,
                                   GENERIC_READ,
                                   WDF_NO_OBJECT_ATTRIBUTES,
                                   &key
                                   );
if (!NT_SUCCESS(status)) {
    return status;
}

要件

バージョン

Available in version 1.0 and later versions of KMDF.

ヘッダー

Wdffdo.h (includeWdf.h)

ライブラリ

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

PASSIVE_LEVEL

参照

WdfDeviceOpenRegistryKey
WdfDriverOpenParametersRegistryKey

 

 

コミュニティの追加

表示:
© 2014 Microsoft