ion@svn.reactos.com wrote:
Add hack for ROS's weird behavior. Will investigate but this lets you boot for now
Updated files: trunk/reactos/ntoskrnl/io/irp.c
The problem is that a bunch of places in the code set the FileObject Event as the UserEvent. This is incredibly wrong, because both are used to signal completely different things and shouldn't be used like that. I've changed them to local stack KEVENTS, but this still fails, because you cannot dereference them. The check for !IRP_SYNCHRONOUS_API is meant to ensure against this (Syncronous IRPs have KEVENTS, Async ones have Executive Events, in short terms.) I've researched some more and this is because of a bigger problem. The routines doing the hack all assumed that the File Object is Synchronous and build a Sync FSD (with IRP_SYNCH_API set), and then set a KEVENT UserEvent. They should actually check if the File Object is Sync or Async, and in case of Async they should use the Local Stack KEVENT (which won't be dereferenced because of the check in IoCompleteRequest APC (2nd stage)), while in case of async they shouldn't use any event at all and wait on the file object instead of waiting on the local event. Also, in case of a sync operation, we must eventually include some sort of locking/unlocking of the file object for serialized access which is required. I will spend some time tomorrow working with these issues so the hack can be removed and proper kernel functionality to be restored, but I wanted to share the background information.
Best regards, Alex Ionescu