Author: sginsberg Date: Mon Sep 28 12:48:14 2015 New Revision: 69399
URL: http://svn.reactos.org/svn/reactos?rev=69399&view=rev Log: [NTOS] Fix kmtest
Modified: trunk/reactos/ntoskrnl/ob/obwait.c
Modified: trunk/reactos/ntoskrnl/ob/obwait.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obwait.c?rev=69... ============================================================================== --- trunk/reactos/ntoskrnl/ob/obwait.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ob/obwait.c [iso-8859-1] Mon Sep 28 12:48:14 2015 @@ -79,12 +79,12 @@ return STATUS_INVALID_PARAMETER_3; }
- /* Enter SEH for user mode */ + /* Enter SEH */ PreviousMode = ExGetPreviousMode(); - if (PreviousMode != KernelMode) - { - /* Enter SEH */ - _SEH2_TRY + _SEH2_TRY + { + /* Probe for user mode */ + if (PreviousMode != KernelMode) { /* Check if we have a timeout */ if (TimeOut) @@ -94,34 +94,34 @@ TimeOut = &SafeTimeOut; }
- /* Probe all the handles */ + /* Probe all the handles */ ProbeForRead(HandleArray, ObjectCount * sizeof(HANDLE), sizeof(HANDLE)); - - /* - * Make a copy so we don't have to guard with SEH later and keep - * track of what objects we referenced if dereferencing pointers - * suddenly fails - */ - RtlCopyMemory(Handles, - HandleArray, - ObjectCount * sizeof(HANDLE)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* Return the exception code */ - _SEH2_YIELD(return _SEH2_GetExceptionCode()); - } - _SEH2_END; - } - else - { - /* This is kernel mode, no need to wrap in SEH */ + } + + /* + * Make a copy so we don't have to guard with SEH later and keep + * track of what objects we referenced if dereferencing pointers + * suddenly fails + */ RtlCopyMemory(Handles, HandleArray, ObjectCount * sizeof(HANDLE)); } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) //ExSystemExceptionFilter() + { + /* Cover up for kernel mode */ + if (PreviousMode == KernelMode) + { + /* But don't fail silently */ + DbgPrint("Mon dieu! Covering up for BAD driver passing invalid pointer (0x%p)! Hon hon hon!\n", HandleArray); + } + + /* Return the exception code */ + _SEH2_YIELD(return _SEH2_GetExceptionCode()); + } + _SEH2_END;
/* Check if we can use the internal Wait Array */ if (ObjectCount > THREAD_WAIT_OBJECTS)