From 0871ebf88b5bd4ffca00cabfd0abb4c381f5c6b0 Mon Sep 17 00:00:00 2001 From: Gunnar Dalsnes Date: Sat, 12 Apr 2003 20:34:27 +0000 Subject: [PATCH] implemeted waiting on file handles/file objects svn path=/trunk/; revision=4527 --- reactos/ntoskrnl/ke/wait.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/ke/wait.c b/reactos/ntoskrnl/ke/wait.c index 4005644c11c..fb6b191cade 100644 --- a/reactos/ntoskrnl/ke/wait.c +++ b/reactos/ntoskrnl/ke/wait.c @@ -409,6 +409,20 @@ KeWaitForSingleObject(PVOID Object, } +inline +PVOID +KiGetWaitableObjectFromObject(PVOID Object) +{ + //special case when waiting on file objects + if ( ((PDISPATCHER_HEADER)Object)->Type == InternalFileType) + { + return &((PFILE_OBJECT)Object)->Event; + } + + return Object; +} + + NTSTATUS STDCALL KeWaitForMultipleObjects(ULONG Count, PVOID Object[], @@ -485,7 +499,7 @@ KeWaitForMultipleObjects(ULONG Count, Abandoned = FALSE; for (i = 0; i < Count; i++) { - hdr = (DISPATCHER_HEADER *) Object[i]; + hdr = (DISPATCHER_HEADER *) KiGetWaitableObjectFromObject(Object[i]); if (KiIsObjectSignalled(hdr, CurrentThread)) { @@ -518,7 +532,7 @@ KeWaitForMultipleObjects(ULONG Count, { for (i = 0; i < Count; i++) { - hdr = (DISPATCHER_HEADER *) Object[i]; + hdr = (DISPATCHER_HEADER *) KiGetWaitableObjectFromObject(Object[i]); Abandoned = KiSideEffectsBeforeWake(hdr, CurrentThread) ? TRUE : Abandoned; } @@ -566,9 +580,9 @@ KeWaitForMultipleObjects(ULONG Count, for (i = 0; i < Count; i++) { - hdr = (DISPATCHER_HEADER *) Object[i]; + hdr = (DISPATCHER_HEADER *) KiGetWaitableObjectFromObject(Object[i]); - blk->Object = Object[i]; + blk->Object = KiGetWaitableObjectFromObject(Object[i]); blk->Thread = CurrentThread; blk->WaitKey = STATUS_WAIT_0 + i; blk->WaitType = WaitType;