Copied from the archive because I will receive the mail in some hours:
hbirr at svn.reactos.com wrote:
- Guard the copying to the IOSB.
- Do the main processing on success or if previous STATUS_PENDING was
returned.
Do not use some of the IRP and FO flags at this point.
Ok, I was going to complain about this, but I realize that it must be used since defintely some parts of ROS don't work properly with those flags set.
It isn't possible to use the flags, because some functions are always synchronous independently which flags are set. Ntoskrnl may set the flags correctly, but a driver may possible not.
- Set all results before signaling the events.
- Signal the FO event previous the user event.
- Made the code a little bit shorter.
I like your changes and have no complaints, except that the signaling semantics of the File/User events should be different in the failure case (my "else" path). You've completely removed that path and thus changed the logic.
If the driver has returned STATUS_PENDING and completes the irp later with an error, both events must be signaled, because two different threads may waiting on this events. The IOSB must be also set. The apc must be also deliver (I've tested this with the apc sample and some modifications on windows). There is no difference between completing the irp with and without an error if the driver has returned STATUS_PENDING.
- Hartmut