- OVERLAPPED IO
- Posted by May on November 1st, 2007
Hello,
I call DeviceIoControl with overlapped flag set FILE_FLAG_OVERLAPPED in
createFile,
1. Do I need to do other open device (device ready opened for
DeviceIoControl for other functions) for this overlapped IO?
2. I did tried to call open device again, then call overlapped
DeviceIoControl, I got return 0, but GetLastError() return is 0 --
ERROR_SUCCESS? What dose it means? success or not?
3. When should I close the device for this overlapped DeviceIoControl call,
close immidiately after return or wait until IO complete?
4. In my driver, I forward this IO to a waitqueue and return pending (not
complete), is it correct?
Thanks,
May
- Posted by Tim Roberts on November 2nd, 2007
May <May@discussions.microsoft.com> wrote:
I don't understand what you are asking. As long as you called CreateFile
with FILE_FLAG_OVERLAPPEED, you can do as many DeviceIoControl calls as you
want. You can certainly have another handle open for non-overlapped calls,
it's not that hard to "simulate" a non-overlapped call on an overlapped
handle
That is unexpected. Why don't you show us the code? We'll see what looks
funny.
The close won't happen until the I/O is completed, but I would certainly
want to wait.
Probably, but it is mostly irrelevant to the discussion of overlapped I/O
in user mode.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
- Posted by Peter Wieland [MSFT] on November 2nd, 2007
May,
1. If you have a handle to the device and you opened that handle for
overlapped I/O then all I/O operations on that file will be overlapped.
2. That sounds like a failure, but it's not clear when you got the error or
what you did. Posting a code snippet would probably be more explanatory.
3. You can close the handle whenever you like. My question would be, why
are you opening a new handle to the device rather than using the one you
already opened.
4. That's hard to know without knowing more about your driver. Is it a WDM
driver? Did you call IoMarkIrpPending() on the IRP before you put it into
the queue? What is a "waitqueue"?
-p
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"May" <May@discussions.microsoft.com> wrote in message
news:51CF5CB6-7310-4D92-821E-4DF76FC1489F@microsoft.com...