Re: [ntdev]why must driver call IoMarkIrpPending?

From http://www.osr.com/ntinsider/2001/pending/pending.htm,

Code Segment 4 (broken code):
status = IoCallDriver(devExt->LowerDriver, Irp);
if (status == STATUS_PENDING) {
IoMarkIrpPending(Irp);
}
return(status);

“The IRP could already be completed, and even freed back to pool by the I/O
Manager, by the time you return from IoCallDriver().”

But from http://www.osr.com/ntinsider/1997/iocomp/iocomp.htm,

  1. The third driver returns a status value (e.g., SUCCESS) to the second
    driver.
  2. The second driver returns a status value to the first driver.
  3. The first driver returns a status value to the I/O Manager
  4. The I/O Manager notes that second stage processing must be performed and
    initiates second stage I/O completion.
  5. The second stage I/O completion routine returns the status of the I/O
    operation and copies any data out to the application??s address space. Once
    that is done, the IRP is dismantled and discarded.

pending.htm ==> Irp may be freed before return(status).
iocomp.htm ==> Irp must be freed after return(status).

Which one is correct? If the second one is correct, I can still touch Irp
fields after IoCallDriver() since it’s not freed yet, right?

Min

-----Original Message-----
From: Peter Viscarola [mailto:xxxxx@osr.com]
Sent: Thursday, December 06, 2001 4:25 PM
To: NT Developers Interest List
Subject: [ntdev] Re: [ntdev]why must driver call IoMarkIrpPending?

“Assaf Wodeslavsky” wrote in message
news:xxxxx@ntdev…

Tony’s landmark article: http://www.osr.com/ntinsider/1997/iocomp/iocomp.htm
More recent article on pending IRPs, focusing precisely on STATUS_PENDING
and completion routines
http://www.osr.com/ntinsider/2001/pending/pending.htm

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@ati.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com