UfxDeviceIoControl 函数 (ufxclient.h)
将非内部 IOCTL 从用户模式传递到 UFX。
语法
BOOLEAN UfxDeviceIoControl(
[in] UFXDEVICE UfxDevice,
[in] WDFREQUEST Request,
[in] size_t OutputBufferLength,
[in] size_t InputBufferLength,
[in] ULONG IoControlCode
);
参数
[in] UfxDevice
驱动程序通过调用 UfxDeviceCreate 创建的 UFX 设备对象的句柄。
[in] Request
框架请求对象的句柄。
[in] OutputBufferLength
如果输出缓冲区可用,则请求的输出缓冲区的长度(以字节为单位)。
[in] InputBufferLength
如果输入缓冲区可用,则请求的输入缓冲区的长度(以字节为单位)。
[in] IoControlCode
与请求关联的驱动程序定义或系统定义的 IOCTL。
返回值
一个布尔值,指示调用是否成功。
注解
客户端驱动程序调用 UfxDeviceIoControl ,以将其在其 EvtIoDeviceControl 回调函数中收到的非内部 IOCTL 转发到 UFX。 以下示例介绍如何执行以下操作:
VOID
DefaultQueue_EvtIoDeviceControl(
_In_ WDFQUEUE Queue,
_In_ WDFREQUEST Request,
_In_ size_t OutputBufferLength,
_In_ size_t InputBufferLength,
_In_ ULONG IoControlCode
)
/*++
Routine Description:
EvtIoDeviceControl handler for the default Queue
Arguments:
Queue - Handle to the framework queue object that is associated with the
I/O request.
Request - Handle to a framework request object.
OutputBufferLength - Size of the output buffer in bytes
InputBufferLength - Size of the input buffer in bytes
IoControlCode - I/O control code.
--*/
{
WDFDEVICE WdfDevice;
PCONTROLLER_CONTEXT ControllerContext;
BOOLEAN HandledbyUfx;
TraceEntry();
TraceVerbose("Queue 0x%p, Request 0x%p, OutputBufferLength %d, "
"InputBufferLength %d, IoControlCode %d",
Queue, Request, (int) OutputBufferLength,
(int) InputBufferLength, IoControlCode);
WdfDevice = WdfIoQueueGetDevice(Queue);
ControllerContext = DeviceGetControllerContext(WdfDevice);
HandledbyUfx = UfxDeviceIoControl(
ControllerContext->UfxDevice,
Request,
OutputBufferLength,
InputBufferLength,
IoControlCode);
if (!HandledbyUfx) {
TraceError("Received an unsupported IOCTL");
WdfRequestComplete(Request, STATUS_INVALID_DEVICE_REQUEST);
}
TraceExit();
}
要求
要求 | 值 |
---|---|
最低受支持的客户端 | Windows 10 |
目标平台 | Windows |
标头 | ufxclient.h |
Library | ufxstub.lib |
IRQL | DISPATCH_LEVEL |