信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfPdoInitAddCompatibleID 方法

The WdfPdoInitAddCompatibleID method adds a compatible ID to the list of compatible IDs for a child device.

语法

NTSTATUS WdfPdoInitAddCompatibleID(
  [in]  PWDFDEVICE_INIT DeviceInit,
  [in]  PCUNICODE_STRING CompatibleID
);

参数

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure.

CompatibleID [in]

A pointer to a UNICODE_STRING structure that contains a compatible ID string. The driver can allocate the string's buffer from paged pool.

返回值

If the operation succeeds, the method returns STATUS_SUCCESS. Additional return values include:

返回代码说明
STATUS_INVALID_DEVICE_REQUEST

The driver is initializing an FDO instead of a PDO.

STATUS_INSUFFICIENT_RESOURCES

The driver could not allocate space to store the compatible ID string.

 

The method might also return other NTSTATUS values.

评论

The driver can add one or more compatible IDs for a device. They should be added in order, from best match to worst match. The framework will deliver the IDs to the PnP manager in the order that they were added. For more information about compatible IDs, see Device Identification Strings and How Setup Selects Drivers.

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

示例

The following code example reports a compatible ID value that the Toaster sample driver uses.

DECLARE_CONST_UNICODE_STRING(compatId, L"{B85B7C50-6A01-11d2-B841-00C04FAD5171}\\MsCompatibleToaster\0");

status = WdfPdoInitAddCompatibleID(
                                   DeviceInit,
                                   &compatId
                                   );

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfpdo.h (包括Wdf.h)

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

IRQL

PASSIVE_LEVEL

另请参见

WdfPdoInitAssignDeviceID
WdfPdoInitAddHardwareID
WdfPdoInitAssignInstanceID

 

 

社区附加资源

显示:
© 2014 Microsoft