> In the case of undesired completion notification, does it get posted when
the I/O completes synchronously or with ERROR_IO_PENDING? Does it happen
for every type of request, or for a specific IOCTL code only?
Completion is completion. After several attempts to generate pathological
cases, I found that it seems that it is the IoCompleteRequest that
generates the event in the completion port. An I/O call that returns
ERROR_IO_PENDING means that IoCompleteRequest has not yet been called, but
will be called in the indefinite future (fine point: it means that at the
time you returned STATUS_PENDING and had done the IoMarkIrpPending, the
IRP had not yet been completed. However, race conditions can result in
the notification being placed in the completion port before the I/O call
has returned to its calling thread.
This kind of event is not even unusual.
I just ignore the return of the I/O call if it is TRUE, or FALSE &&
GetLastError() == ERROR_IO_PENDING). In either case, there will be a
completion port notification (assuming the driver is well-behaved and does
not actually fail to complete IRPs). If it is any other error, then the
IRP was rejected and there will be no IOCP notification. I don’t know if
I managed to get all the timings right, but I think this is what I have
observed.
If it isn’t right, I’d like to know the Whole Truth (and the Truth will
*not* make me free; I still charge the same amount!)
joe
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer