USBD_AssignUrbToIoStackLocation function (usbdlib.h)

The USBD_AssignUrbToIoStackLocation routine is called by a client driver to associate an URB with the IRP's next stack location.

Syntax

void USBD_AssignUrbToIoStackLocation(
  [in] USBD_HANDLE        USBDHandle,
  [in] PIO_STACK_LOCATION IoStackLocation,
  [in] PURB               Urb
);

Parameters

[in] USBDHandle

A USBD handle that is retrieved in a previous call to the USBD_CreateHandle routine.

[in] IoStackLocation

Pointer to the IRP's next stack location (IO_STACK_LOCATION). The client driver received a pointer to the stack location in a previous call to IoGetNextIrpStackLocation.

[in] Urb

Pointer to the URB structure that is allocated by USBD_UrbAllocate, USBD_IsochUrbAllocate, USBD_SelectConfigUrbAllocateAndBuild, or USBD_SelectInterfaceUrbAllocateAndBuild.

Return value

None

Remarks

If the client driver allocated an URB by calling USBD_UrbAllocate, USBD_IsochUrbAllocate, USBD_SelectConfigUrbAllocateAndBuild, or USBD_SelectInterfaceUrbAllocateAndBuild, then the driver must call USBD_AssignUrbToIoStackLocation to associate the URB with IO_STACK_LOCATION associated with the IRP. For URBs that are allocated by those routines, USBD_AssignUrbToIoStackLocation replaces setting Parameters.Others.Argument1 of IO_STACK_LOCATION to the URB. (see IOCTL_INTERNAL_USB_SUBMIT_URB).

The client driver must not call USBD_AssignUrbToIoStackLocation for an URB that is allocated by using other mechanisms, such as allocating the URB on the stack. Otherwise, the USB driver stack generates a bugcheck.

The client driver must call USBD_AssignUrbToIoStackLocation before calling IoCallDriver to send the request. USBD_AssignUrbToIoStackLocation populates the IRP's next stack location with the URB. The routine also updates the FileObject member of IO_STACK_LOCATION.

For a code example, see How to Submit an URB.

Requirements

Requirement Value
Minimum supported client Requires WDK for Windows 8. Targets Windows Vista and later versions of the Windows operating system.
Target Platform Desktop
Header usbdlib.h
Library Usbdex.lib
IRQL <=DISPATCH_LEVEL

See also

How to Submit an URB

USBD_IsochUrbAllocate

USBD_SelectConfigUrbAllocateAndBuild

USBD_SelectInterfaceUrbAllocateAndBuild

USBD_UrbAllocate