Skip to content

Latest commit

 

History

History
222 lines (166 loc) · 9.13 KB

nf-wdfusb-wdfusbtargetpipesendurbsynchronously.md

File metadata and controls

222 lines (166 loc) · 9.13 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:wdfusb.WdfUsbTargetPipeSendUrbSynchronously
WdfUsbTargetPipeSendUrbSynchronously function (wdfusb.h)
The WdfUsbTargetPipeSendUrbSynchronously method builds an USB request for a specified USB pipe, using request parameters that a specified URB describes.
wdf\wdfusbtargetpipesendurbsynchronously.htm
wdf
02/26/2018
WdfUsbTargetPipeSendUrbSynchronously function
DFUsbRef_3e797ee4-f454-4520-b4a0-84565515622f.xml, WdfUsbTargetPipeSendUrbSynchronously, WdfUsbTargetPipeSendUrbSynchronously method, kmdf.wdfusbtargetpipesendurbsynchronously, wdf.wdfusbtargetpipesendurbsynchronously, wdfusb/WdfUsbTargetPipeSendUrbSynchronously
wdfusb.h
Wdfusb.h
Universal
1.0
DriverCreate, IoctlReqs, KmdfIrql, KmdfIrql2, SyncReqSend, UsbKmdfIrql, UsbKmdfIrql2
Wdf01000.sys (see Framework Library Versioning.)
PASSIVE_LEVEL
Windows
WdfUsbTargetPipeSendUrbSynchronously
wdfusb/WdfUsbTargetPipeSendUrbSynchronously
APIRef
kbSyntax
LibDef
Wdf01000.sys
Wdf01000.sys.dll
WdfUsbTargetPipeSendUrbSynchronously

WdfUsbTargetPipeSendUrbSynchronously function

-description

[Applies to KMDF only]

The WdfUsbTargetPipeSendUrbSynchronously method builds an USB request for a specified USB pipe, using request parameters that a specified URB describes.

-parameters

-param Pipe [in]

A handle to a framework pipe object that was obtained by calling WdfUsbInterfaceGetConfiguredPipe.

-param Request [in, optional]

A handle to a framework request object. This parameter is optional and can be NULL. For more information, see the following Remarks section.

-param RequestOptions [in, optional]

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.

-param Urb [in]

A pointer to a driver-initialized URB structure.

If the driver previously called WdfUsbTargetDeviceCreateWithParameters to create UsbDevice, the driver must use WdfUsbTargetDeviceCreateUrb or WdfUsbTargetDeviceCreateIsochUrb to create this URB.

-returns

WdfUsbTargetPipeSendUrbSynchronously returns the I/O target's completion status value if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INFO_LENGTH_MISMATCH
The size of the WDF_REQUEST_SEND_OPTIONS structure that the RequestOptions parameter specified was incorrect.
STATUS_INVALID_PARAMETER
An invalid parameter was detected.
STATUS_INSUFFICIENT_RESOURCES
Insufficient memory was available.
STATUS_INVALID_DEVICE_REQUEST
The caller's IRQL was not PASSIVE_LEVEL, or the specified I/O request was already queued to an I/O target.
STATUS_IO_TIMEOUT
The driver supplied a time-out value and the request did not complete within the allotted time.
STATUS_REQUEST_NOT_ACCEPTED
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.

-remarks

Use the WdfUsbTargetPipeSendUrbSynchronously method to send a USB request synchronously. To send such requests asynchronously, use WdfUsbTargetPipeFormatRequestForUrb, followed by WdfRequestSend.

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.
Your driver can specify a non-NULL RequestOptions parameter, whether the driver provides a non-NULL or a NULL Request parameter. You can, for example, use the RequestOptions parameter to specify a time-out value.

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.

Examples

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
                                              );

-see-also

WDF_REQUEST_SEND_OPTIONS

WdfRequestCancelSentRequest

WdfUsbInterfaceGetConfiguredPipe