Windows Driver Kit: Kernel-Mode Driver Framework
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES
The WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES function initializes a WDF_USB_DEVICE_SELECT_CONFIG_PARAMS structure so that a driver can configure a device to use multiple interfaces.
VOID
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(
IN OUT PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params,
IN OPTIONAL UCHAR NumberInterfaces,
IN OPTIONAL PWDF_USB_INTERFACE_SETTING_PAIR SettingPairs
);
Parameters
- Params
- A pointer to a driver-allocated WDF_USB_DEVICE_SELECT_CONFIG_PARAMS structure.
- NumberInterfaces
- The number of elements in the SettingPairs array. If SettingPairs is not NULL, this parameter must be greater than zero.
- SettingPairs
- An array of WDF_USB_INTERFACE_SETTING_PAIR structures. This parameter is optional and can be NULL.
Return Value
None
Comments
Your driver can use the WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES function to select a configuration if the device interfaces are specified by handles to USB interface objects.
Your driver can use this function if your device has one or more USB interfaces.
The WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES function zeros the WDF_USB_DEVICE_SELECT_CONFIG_PARAMS structure and sets the Size member to the size of the structure.
If the SettingPairs parameter is not NULL, this function sets the Type member to WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs. Otherwise, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES sets the Type member to WdfUsbTargetDeviceSelectConfigTypeMultiInterface.
To initialize a WDF_USB_DEVICE_SELECT_CONFIG_PARAMS structure, the driver must call one of the following functions:
Example
The following code example calls either WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE or WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES, based on the number of interfaces that the device configuration supports. Then, the example calls WdfUsbTargetDeviceSelectConfig to select a configuration.
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS params;
PWDF_USB_INTERFACE_SETTING_PAIR settingPairs;
UCHAR numInterfaces;
numInterfaces = WdfUsbTargetDeviceGetNumInterfaces(UsbDevice);
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(¶ms);
}
else {
settingPairs = ExAllocatePoolWithTag(
PagedPool,
sizeof(WDF_USB_INTERFACE_SETTING_PAIR) * numInterfaces,
MEM_TAG
);
if (settingPairs == NULL){
return STATUS_INSUFFICIENT_RESOURCES;
}
//
// Call driver-defined routine to populate the
// WDF_USB_INTERFACE_SETTING_PAIR structures
// that ExAllocatePoolWithTag allocated.
//
InitSettingPairs(
UsbDevice,
settingPairs,
numInterfaces
);
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(
¶ms,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
¶ms
);
if (!NT_SUCCESS(status)) {
return status;
}
Requirements
Versions: The WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES function is available in version 1.0 and later versions of KMDF.
Headers: Declared in Wdfusb.h. Include Wdfusb.h.
See Also
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_DECONFIG, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE, WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_URB, WDF_USB_INTERFACE_SETTING_PAIR