The USBD_UrbAllocate routine allocates a USB Request Block (URB).
NTSTATUS USBD_UrbAllocate( _In_ USBD_HANDLE USBDHandle, _Out_ PURB *Urb );
USBD handle that is retrieved by the client driver in a previous call to the USBD_CreateHandle routine.
The USBD_UrbAllocate routine returns STATUS_SUCCESS if the request is successful. Otherwise, USBD_UrbAllocate sets Urb to NULL and returns a failure code.
Possible values include, but are not limited to, STATUS_INVALID_PARAMETER, which indicates the caller passed in NULL to USBDHandle or Urb.
The USBD_UrbAllocate routine enables the underlying USB driver stack to allocate an opaque URB context for the URB. By using the URB context, the USB driver stack can process requests more efficiently and reliably. Those optimizations are provided by the USB 3.0 driver stack that is included in Windows 8. The client driver cannot access the URB context; the context is used internally by the bus driver.
Regardless of the USB protocol version of the host controller, the underlying USB driver stack, the target operating system, the client driver must always call USBD_UrbAllocate to allocate an URB structure. USBD_UrbAllocate replaces earlier allocation mechanisms, such as ExAllocatePoolWithTag, or allocating them on the stack.
The client driver must not use USBD_UrbAllocate,
For more information about replacement routines, see Allocating and Building URBs.
You must call USBD_UrbFree to release the URB allocated by USBD_UrbAllocate.
The following code example shows how to allocate, submit, and release a URB. The example submits the URB synchronously.
|Windows Driver kit version|
|Minimum KMDF version|
|Minimum UMDF version|
|DDI compliance rules|