WdfIoTargetSendInternalIoctlOthersSynchronously function (wdfiotarget.h)

[Applies to KMDF only]

The WdfIoTargetSendInternalIoctlOthersSynchronously method builds a non-standard internal device control request and sends it synchronously to an I/O target.

Syntax

NTSTATUS WdfIoTargetSendInternalIoctlOthersSynchronously(
  [in]            WDFIOTARGET               IoTarget,
  [in, optional]  WDFREQUEST                Request,
  [in]            ULONG                     IoctlCode,
  [in, optional]  PWDF_MEMORY_DESCRIPTOR    OtherArg1,
  [in, optional]  PWDF_MEMORY_DESCRIPTOR    OtherArg2,
  [in, optional]  PWDF_MEMORY_DESCRIPTOR    OtherArg4,
  [in, optional]  PWDF_REQUEST_SEND_OPTIONS RequestOptions,
  [out, optional] PULONG_PTR                BytesReturned
);

Parameters

[in] IoTarget

A handle to a local or remote I/O target object that was obtained from a previous call to WdfDeviceGetIoTarget or WdfIoTargetCreate, or from a method that a specialized I/O target supplies.

[in, optional] Request

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

[in] IoctlCode

An I/O control code (IOCTL) that the I/O target supports.

[in, optional] OtherArg1

A pointer to a WDF_MEMORY_DESCRIPTOR structure that describes a memory buffer that contains context information. This parameter is optional and can be NULL.

[in, optional] OtherArg2

A pointer to a WDF_MEMORY_DESCRIPTOR structure that describes a memory buffer that contains context information. This parameter is optional and can be NULL.

[in, optional] OtherArg4

A pointer to a WDF_MEMORY_DESCRIPTOR structure that describes a memory buffer that contains context information. This parameter is optional and can be NULL.

[in, optional] RequestOptions

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.

[out, optional] BytesReturned

A pointer to a location that receives information (such as the number of bytes that were transferred) that another driver supplies when it completes the request by calling WdfRequestCompleteWithInformation. This pointer is optional and can be NULL.

Return value

If the operation succeeds, WdfIoTargetSendInternalIoctlOthersSynchronously returns after the internal device control request completes, and the return value is the request's completion status value. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INVALID_PARAMETER
An invalid parameter was detected.
STATUS_INFO_LENGTH_MISMATCH
The size of the WDF_REQUEST_SEND_OPTIONS structure that the RequestOptions parameter pointed to was incorrect.
STATUS_INVALID_DEVICE_REQUEST
The request was already queued to an I/O target.
STATUS_INSUFFICIENT_RESOURCES
The framework could not allocate system resources (typically memory).
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

A non-standard internal device control request uses an IOCTL code to identify the operation to be performed, but the request does not use the standard input and output buffers that other internal device control requests use. If you are creating a set of interacting drivers, you can define how this set of drivers use the request's arguments: OtherArg1, OtherArg2, and OtherArg4.

There is no parameter called OtherArg3 because the framework associates these parameters with the Argument1, Argument2, and Argument4 members of the Other.Parameters union in the driver's IO_STACK_LOCATION structure. The Argument3 member in that union receives the value from the IoctlCode parameter, so it is not available for other driver-supplied values.

Use the WdfIoTargetSendInternalIoctlOthersSynchronously method to send non-standard internal device control requests synchronously. To send internal device control requests asynchronously, use WdfIoTargetFormatRequestForInternalIoctlOthers, followed by WdfRequestSend.

For more information about internal device control requests, see Using I/O Control Codes.

The WdfIoTargetSendInternalIoctlOthersSynchronously method does not return until the request has completed, unless the driver supplies a time-out value in the RequestOptions parameter's WDF_REQUEST_SEND_OPTIONS structure, or unless an error is detected.

You can forward a non-standard internal device control request that your driver received in an I/O queue, or you can create and send a new request. In either case, the framework requires a request object and possibly some context space.

To forward a non-standard internal device control request that your driver received in an I/O queue:

  1. Specify the received request's handle for the WdfIoTargetSendInternalIoctlOthersSynchronously method's Request parameter.
  2. Use the received request's context information for the WdfIoTargetSendInternalIoctlOthersSynchronously method's OtherArg1,OtherArg2, andOtherArg4 parameters.

    To obtain these parameter values, the driver must call WdfRequestGetParameters and use the DeviceIoControl member of the WDF_REQUEST_PARAMETERS structure that is returned.

For more information about forwarding an I/O request, see Forwarding I/O Requests.

Drivers often divide received I/O requests into smaller requests that they send to an I/O target, so your driver might create new requests.

To create a new I/O request:

  1. Supply a NULL request handle for the WdfIoTargetSendInternalIoctlOthersSynchronously method's 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.

  2. Provide context space for the WdfIoTargetSendInternalIoctlOthersSynchronously method's OtherArg1,OtherArg2, and OtherArg4 parameters, if the request requires them.

    Your driver can specify this context space as locally allocated buffers, as WDFMEMORY handles, or as memory descriptor lists (MDLs). You can use whichever method is most convenient.

    The following techniques to specify buffer space are available:

    • Supply local buffers.

      Because WdfIoTargetSendInternalIoctlOthersSynchronously handles I/O requests synchronously, the driver can create request buffers that are local to the calling routine, as the following code example shows.

      WDF_MEMORY_DESCRIPTOR  MemoryDescriptor;
      MY_BUFFER_TYPE  MyBuffer;
      WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&MemoryDescriptor,
                                        (PVOID) &MyBuffer,
                                        sizeof(MyBuffer));
      
    • Supply WDFMEMORY handles.

      Call WdfMemoryCreate or WdfMemoryCreatePreallocated to obtain a handle to framework-managed memory, as the following code example shows.

      WDF_MEMORY_DESCRIPTOR  MemoryDescriptor;
      WDFMEMORY  MemoryHandle = NULL;
      status = WdfMemoryCreate(NULL,
                               NonPagedPool,
                               POOL_TAG,
                               MY_BUFFER_SIZE,
                               &MemoryHandle,
                               NULL);
      WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(&MemoryDescriptor,
                                        MemoryHandle,
                                        NULL);
      
    • Supply MDLs.

      Drivers can obtain MDLs that are associated with a received I/O request by calling WdfRequestRetrieveInputWdmMdl and WdfRequestRetrieveOutputWdmMdl.

For information about obtaining status information after an I/O request completes, see Obtaining Completion Information.

For more information about WdfIoTargetSendInternalIoctlOthersSynchronously, see Sending I/O Requests to General I/O Targets.

For more information about I/O targets, see Using I/O Targets.

Examples

The following code example initializes an IEEE 1394 IRB structure, uses the structure's address to initialize a WDF_MEMORY_DESCRIPTOR structure, and then calls WdfIoTargetSendInternalIoctlOthersSynchronously.

WDF_MEMORY_DESCRIPTOR descriptor;
IRB Irb;

Irb.FunctionNumber = REQUEST_ALLOCATE_ADDRESS_RANGE;
Irb.Flags = 0;
Irb.u.AllocateAddressRange.Mdl = pAsyncAddressData->pMdl;
Irb.u.AllocateAddressRange.fulFlags = fulFlags;
Irb.u.AllocateAddressRange.nLength = nLength;
Irb.u.AllocateAddressRange.MaxSegmentSize = MaxSegmentSize;
Irb.u.AllocateAddressRange.fulAccessType = fulAccessType;
Irb.u.AllocateAddressRange.fulNotificationOptions = fulNotificationOptions;
Irb.u.AllocateAddressRange.Callback = NULL;
Irb.u.AllocateAddressRange.Context = NULL;
Irb.u.AllocateAddressRange.Required1394Offset = *Required1394Offset;
Irb.u.AllocateAddressRange.FifoSListHead = NULL;
Irb.u.AllocateAddressRange.FifoSpinLock = NULL;
Irb.u.AllocateAddressRange.AddressesReturned = 0;
Irb.u.AllocateAddressRange.p1394AddressRange = pAsyncAddressData->AddressRange;
Irb.u.AllocateAddressRange.DeviceExtension = deviceExtension;

WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(
                                  &descriptor,
                                  &Irb,
                                  sizeof (IRB)
                                  );

ntStatus = WdfIoTargetSendInternalIoctlOthersSynchronously(
                                                           IoTarget, 
                                                           NULL,
                                                           IOCTL_1394_CLASS,
                                                           &descriptor,
                                                           NULL,
                                                           NULL,
                                                           NULL,
                                                           NULL
                                                           );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfiotarget.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL PASSIVE_LEVEL
DDI compliance rules DeferredRequestCompleted(kmdf), DriverCreate(kmdf), IoctlReqs(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), ReadReqs(kmdf), RequestCompleted(kmdf), RequestCompletedLocal(kmdf), WriteReqs(kmdf)

See also

EvtDriverDeviceAdd

IO_STACK_LOCATION

WDF_MEMORY_DESCRIPTOR

WDF_MEMORY_DESCRIPTOR_INIT_BUFFER

WDF_REQUEST_PARAMETERS

WDF_REQUEST_SEND_OPTIONS

WdfDeviceGetIoTarget

WdfIoTargetCreate

WdfIoTargetFormatRequestForInternalIoctlOthers

WdfMemoryCreate

WdfMemoryCreatePreallocated

WdfRequestCancelSentRequest

WdfRequestCompleteWithInformation

WdfRequestCreate

WdfRequestGetParameters

WdfRequestRetrieveInputWdmMdl

WdfRequestRetrieveOutputWdmMdl

WdfRequestReuse

WdfRequestSend