[Applies to KMDF only]
The WdfUsbTargetPipeSendUrbSynchronously method builds an USB request for a specified USB pipe, using request parameters that a specified URB describes.
NTSTATUS WdfUsbTargetPipeSendUrbSynchronously( WDFUSBPIPE Pipe, WDFREQUEST Request, PWDF_REQUEST_SEND_OPTIONS RequestOptions, PURB Urb );
A handle to a framework pipe object that was obtained by calling WdfUsbInterfaceGetConfiguredPipe.
A handle to a framework request object. This parameter is optional and can be NULL. For more information, see the following Remarks section.
A pointer to a caller-allocated WDF_REQUEST_SEND_OPTIONS structure that specifies options for the request. This pointer is optional and can be NULL. For more information, see the following Remarks section.
A pointer to a driver-initialized URB structure.
WdfUsbTargetPipeSendUrbSynchronously returns the I/O target's completion status value if the operation succeeds. Otherwise, this method might return one of the following values:
||The size of the WDF_REQUEST_SEND_OPTIONS structure that the RequestOptions parameter specified was incorrect.|
||An invalid parameter was detected.|
||Insufficient memory was available.|
||The caller's IRQL was not PASSIVE_LEVEL, or the specified I/O request was already queued to an I/O target.|
||The driver supplied a time-out value and the request did not complete within the allotted time.|
||The I/O request packet (IRP) that the Request parameter represents does not provide enough IO_STACK_LOCATION structures to allow the driver to forward the request.|
This method also might return other NTSTATUS values.
A bug check occurs if the driver supplies an invalid object handle.
The WdfUsbTargetPipeSendUrbSynchronously method does not return until the request has completed, unless the driver supplies a time-out value in the WDF_REQUEST_SEND_OPTIONS structure that the RequestOptions parameter points to, or unless an error is detected.
The framework does not examine the USB request. If the request changes the state of the USB pipe, the framework will not be aware of the change.
You can forward an I/O request that your driver received in an I/O queue, or you can create and send a new request.
To forward an I/O request that your driver received in an I/O queue, specify the received request's handle for the WdfUsbTargetPipeSendUrbSynchronously method's Request parameter.
To create and send a new request, either supply a NULL request handle for the Request parameter, or create a new request object and supply its handle:
If you supply a NULL request handle, the framework uses an internal request object. This technique is simple to use, but the driver cannot cancel the request.
If you call WdfRequestCreate to create one or more request objects, you can reuse these request objects by calling WdfRequestReuse. This technique enables your driver's EvtDriverDeviceAdd callback function to preallocate request objects for a device. Additionally, another driver thread can call WdfRequestCancelSentRequest to cancel the request, if necessary.
For information about obtaining status information after an I/O request completes, see Obtaining Completion Information.
For more information about the WdfUsbTargetPipeSendUrbSynchronously method and USB I/O targets, see USB I/O Targets.
The following code example initializes a URB and sends the URB to a USB pipe.
URB urb; PURB pUrb = NULL; NTSTATUS status; pUrb = &urb; pUrb->UrbHeader.Length = (USHORT) sizeof(struct _URB_GET_CURRENT_FRAME_NUMBER); pUrb->UrbHeader.Function = URB_FUNCTION_GET_CURRENT_FRAME_NUMBER; pUrb->UrbGetCurrentFrameNumber.FrameNumber = 0; status = WdfUsbTargetPipeSendUrbSynchronously( Pipe, Request, NULL, pUrb );
|Minimum KMDF version||1.0|
|Header||wdfusb.h (include Wdfusb.h)|
|Library||Wdf01000.sys (see Framework Library Versioning.)|
|DDI compliance rules||DriverCreate, IoctlReqs, KmdfIrql, KmdfIrql2, SyncReqSend, UsbKmdfIrql, UsbKmdfIrql2|