Newbie: KeWaitForSingleObject vs IoCompletionRoutine

Sorry for the silly question but i cant really get a real clue on the subject.

What is the difference between having a dispatch procedure that call an underlying driver and use the KeWaitForSingleObject (and the SetEvent in the completion) and then do modification to the outcome of the underlying driver in the dispatch versus a dispatch procedure that call the driver, doesnt set any event, and do the modification to the result from the underlying driver in the IoCompletion?

Waiting on the event blocks the calling thread (which is not yours), wasting the thread until the irp complets. Using the completion routine is an async operation, allows the calling thread (of the dispatch routine) to return to the caller and do more work, being more efficient with system resources.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, February 25, 2011 7:25 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Newbie: KeWaitForSingleObject vs IoCompletionRoutine

Sorry for the silly question but i cant really get a real clue on the subject.

What is the difference between having a dispatch procedure that call an underlying driver and use the KeWaitForSingleObject (and the SetEvent in the completion) and then do modification to the outcome of the underlying driver in the dispatch versus a dispatch procedure that call the driver, doesnt set any event, and do the modification to the result from the underlying driver in the IoCompletion?


NTDEV is sponsored by OSR

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