Author: dchapyshev Date: Wed Aug 31 21:29:40 2016 New Revision: 72528
URL: http://svn.reactos.org/svn/reactos?rev=72528&view=rev Log: [NTOS:EX] - Try to fix CORE-11906 See issue 11906 for more details.
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=7... ============================================================================== --- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Wed Aug 31 21:29:40 2016 @@ -1241,41 +1241,64 @@ /* Enter a critical region */ KeEnterCriticalRegion();
- /* Set the initial value and loop the entries */ - Handle.Value = 0; - while ((HandleTableEntry = ExpLookupHandleTableEntry(Process->ObjectTable, Handle))) - { - /* Validate the entry */ - if ((HandleTableEntry->Object) && - (HandleTableEntry->NextFreeTableEntry != -2)) + _SEH2_TRY + { + /* Set the initial value and loop the entries */ + Handle.Value = 0; + while ((HandleTableEntry = ExpLookupHandleTableEntry(Process->ObjectTable, Handle))) { - /* Lock the entry */ - if (ExpLockHandleTableEntry(Process->ObjectTable, HandleTableEntry)) + /* Validate the entry */ + if ((HandleTableEntry->Object) && + (HandleTableEntry->NextFreeTableEntry != -2)) { - POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry); - - /* Filling handle information */ - HandleInformation->Handles[Index].UniqueProcessId = (USHORT)(ULONG_PTR) Process->UniqueProcessId; - HandleInformation->Handles[Index].CreatorBackTraceIndex = 0; - HandleInformation->Handles[Index].ObjectTypeIndex = (UCHAR) ObjectHeader->Type->Index; - HandleInformation->Handles[Index].HandleAttributes = HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES; - HandleInformation->Handles[Index].HandleValue = (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay; - HandleInformation->Handles[Index].Object = &ObjectHeader->Body; - HandleInformation->Handles[Index].GrantedAccess = HandleTableEntry->GrantedAccess; - - /* Unlock it */ - ExUnlockHandleTableEntry(Process->ObjectTable, HandleTableEntry); - - ++Index; + /* Lock the entry */ + if (ExpLockHandleTableEntry(Process->ObjectTable, HandleTableEntry)) + { + _SEH2_TRY + { + POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry); + + /* Filling handle information */ + HandleInformation->Handles[Index].UniqueProcessId = + (USHORT)(ULONG_PTR) Process->UniqueProcessId; + + HandleInformation->Handles[Index].CreatorBackTraceIndex = 0; + + HandleInformation->Handles[Index].ObjectTypeIndex = + (UCHAR) ObjectHeader->Type->Index; + + HandleInformation->Handles[Index].HandleAttributes = + HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES; + + HandleInformation->Handles[Index].HandleValue = + (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay; + + HandleInformation->Handles[Index].Object = &ObjectHeader->Body; + + HandleInformation->Handles[Index].GrantedAccess = + HandleTableEntry->GrantedAccess; + + ++Index; + } + _SEH2_FINALLY + { + /* Unlock it */ + ExUnlockHandleTableEntry(Process->ObjectTable, HandleTableEntry); + } + _SEH2_END; + } } + + /* Go to the next entry */ + Handle.Value += sizeof(HANDLE); } - - /* Go to the next entry */ - Handle.Value += sizeof(HANDLE); - } - - /* Leave the critical region */ - KeLeaveCriticalRegion(); + } + _SEH2_FINALLY + { + /* Leave the critical region */ + KeLeaveCriticalRegion(); + } + _SEH2_END;
Process = PsGetNextProcess(Process); }