关于https://github.com/microsoft/Windows-driver-samples/tree/master/serial/VirtualSerial2中的样本。
在queue.c e.c中有一个EvIoRead,当应用程序从我的虚拟驱动程序请求数据时会调用它。当没有数据时,执行以下代码:
OID
EvtIoRead(
_In_ WDFQUEUE Queue,
_In_ WDFREQUEST Request,
_In_ size_t Length
)
{
....
if (bytesCopied > 0) {
//
// Data was read from buffer succesfully
//
WdfRequestCompleteWithInformation(Request, status, bytesCopied);
return;
}
else {
//
// No data to read. Queue the request for later processing.
//
status = WdfRequestForwardToIoQueue(Request,
queueContext->ReadQueue);
}
}调用WdfRequestForwardToIoQueue。然而,当有新数据时,我不确定该怎么做。如何触发EvtIoRead再次调用?
发布于 2020-03-27 16:43:59
只是希望它能对某些人有所帮助。在读取时,您已经执行了WdfRequestForwardToIoQueue来对请求进行排队。此时应用程序ReadFile应处于等待状态。当驱动程序中的数据就绪时,将上一个请求排队,并将数据复制到该请求中。
https://stackoverflow.com/questions/59446702
复制相似问题