Expand Minimize

WdfPdoInitAddHardwareID method

[Applies to KMDF only]

The WdfPdoInitAddHardwareID method adds a hardware ID to the list of hardware IDs for a child device.

Syntax


NTSTATUS WdfPdoInitAddHardwareID(
  [in]  PWDFDEVICE_INIT DeviceInit,
  [in]  PCUNICODE_STRING HardwareID
);

Parameters

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure.

HardwareID [in]

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

Return value

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

Return codeDescription
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 hardware ID string.

 

The method might also return other NTSTATUS values.

Remarks

The driver can add one or more hardware 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 hardware IDs, see Device Identification Strings and How Setup Selects Drivers.

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

Examples

The following code example reports a hardware ID that the KbFiltr sample driver uses.


#define  KBFILTR_DEVICE_ID L"{A65C87F9-BE02-4ed9-92EC-012D416169FA}\\KeyboardFilter\0"
DECLARE_CONST_UNICODE_STRING(hardwareId, KBFILTR_DEVICE_ID);

status = WdfPdoInitAddHardwareID(
                                 pDeviceInit,
                                 &hardwareId
                                 );

Requirements

Minimum KMDF version

1.0

Header

Wdfpdo.h (include Wdf.h)

Library

Wdf01000.sys (see Framework Library Versioning.)

IRQL

PASSIVE_LEVEL

DDI compliance rules

ChildDeviceInitAPI, DriverCreate, InitFreeDeviceCallback, InitFreeDeviceCreate, InitFreeNull, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI, PdoInitFreeDeviceCallback, PdoInitFreeDeviceCreate

See also

WdfPdoInitAssignDeviceID
WdfPdoInitAddCompatibleID
WdfPdoInitAssignInstanceID

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.