Bewerken

Delen via


WdfPdoInitAssignContainerID function (wdfpdo.h)

[Applies to KMDF only]

The WdfPdoInitAssignContainerID method updates the container ID for a child device.

Syntax

NTSTATUS WdfPdoInitAssignContainerID(
  [in] PWDFDEVICE_INIT  DeviceInit,
  [in] PCUNICODE_STRING ContainerID
);

Parameters

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

[in] ContainerID

A pointer to a UNICODE_STRING structure that contains a container 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 code Description
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 container ID string.
 

The method might also return other NTSTATUS values.

Remarks

For more information about container IDs, see Device Identification Strings.

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

Examples

The following code example initializes a UNICODE_STRING structure, stores a Unicode string in the structure, and then registers the Unicode string as the device's container ID.

UNICODE_STRING containerId = {0}; 

RtlInitUnicodeString(
                     &containerId,
                     strContainerId //Unicode string for container ID
                     );
status = WdfPdoInitAssignContainerID(
                                     pDeviceInit,
                                     &containerId
                                     );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.9
Header wdfpdo.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL PASSIVE_LEVEL
DDI compliance rules DriverCreate(kmdf)

See also

RtlInitUnicodeString

WdfPdoInitAddCompatibleID

WdfPdoInitAddHardwareID

WdfPdoInitAssignDeviceID

WdfPdoInitAssignInstanceID