// usbdlib.h
VOID USBD_AssignUrbToIoStackLocation(
[in] USBD_HANDLE USBDHandle,
[in] PIO_STACK_LOCATION IoStackLocation,
[in] PURB Urb
);
View the official Windows Driver Kit DDI referenceNo description available.
The USBD_AssignUrbToIoStackLocation routine is called by a client driver to associate an URB with the IRP's next stack location.
USBDHandle [in]A USBD handle that is retrieved in a previous call to the USBD_CreateHandle routine.
IoStackLocation [in]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.
Urb [in]Pointer to the URB structure that is allocated by USBD_UrbAllocate, USBD_IsochUrbAllocate, USBD_SelectConfigUrbAllocateAndBuild, or USBD_SelectInterfaceUrbAllocateAndBuild.
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.
USBD_SelectConfigUrbAllocateAndBuild
USBD_SelectInterfaceUrbAllocateAndBuild