阅读:1432回复:9
不好意思,在次还发一次。关于driver studio中overlapped异步参数问题
bRet = DeviceIoControl( DeviceHandle,
(DWORD) IOCTL_GET_VERSION, NULL, 0, &drvVersion, sizeof(DRV_VERSION), &cbRet, &overlapped); 以上应用程序调用后,在驱动程序中overlapped参数我该怎样取得? 谢谢 |
|
最新喜欢:![]() |
沙发#
发布于:2002-04-12 10:51
怎么没人理我?
|
|
板凳#
发布于:2002-04-12 17:37
不明白你的意思,overlapped是个输出参数呀
|
|
|
地板#
发布于:2002-04-12 18:40
我想获取他的事件句柄
|
|
地下室#
发布于:2002-04-12 20:42
hDevice was opened with the FILE_FLAG_OVERLAPPED flag, lpOverlapped must point to a valid OVERLAPPED structure. In this case, the operation is performed as an overlapped (asynchronous) operation. If the device was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function fails in unpredictable ways.
If hDevice was opened without specifying the FILE_FLAG_OVERLAPPED flag, lpOverlapped is ignored and DeviceIoControl does not return until the operation has been completed, or an error occurs |
|
|
5楼#
发布于:2002-04-12 21:00
我想获取他的事件句柄 just Create by youself. like: ov.Event = CreateEvent(......); |
|
|
6楼#
发布于:2002-04-13 12:45
在驱动程序中怎么得到它的句柄我不知到,但是如果在驱动程序中得到IOCTL的IRP后,可以使用IoMarkIrpPending标记此Event为wait状态,应用程序应该如此处理:
bRet = DeviceIoControl( DeviceHandle, (DWORD) IOCTL_GET_VERSION, NULL, 0, &drvVersion, sizeof(DRV_VERSION), &cbRet, &overlapped); if(!bRet)//IRP Return FALSE { if(GetLastError()==ERROR_IO_PENDING) { while(WaitForSingleObject(overlapped.hEvent, 100)==WAIT_TIMEOUT)//等待超时 {//等待IRP完成 } //IRP完成。驱动程序中在调用IoCompleteRequest //(Irp,IO_NO_INCREMENT);后 GetOverlappedResult(DeviceHandle, &overlapped, &cbRet, FALSE);// } } |
|
|
7楼#
发布于:2002-04-14 21:35
谢谢各位,但是还有一问
向分派例程通知这个事件 KeSetEvent(event, 0, FALSE); 我的event 从哪里来? |
|
8楼#
发布于:2002-04-14 21:40
不好意思,我明白了。版主说得很清楚了,找打:)
|
|
9楼#
发布于:2002-07-17 16:22
同步处理 deviceiocontrol 也可以用overlapped
那么驱动程序如果不返回,还是不能得到事件 |
|