From 056b071be77d1da882cadfd61349905d73dc33c7 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 11 Aug 2007 09:04:17 +0000 Subject: [PATCH] - Minor code changes, plus a temporary (DPRINT1) change for the HandleCount != 0 problem. svn path=/trunk/; revision=28280 --- reactos/ntoskrnl/ob/obhandle.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 2d0af033d74..748e3d09fab 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -1259,6 +1259,12 @@ ObpCreateUnnamedHandle(IN PVOID Object, ObjectHeader->HandleCount, ObjectHeader->PointerCount); + /* Save the object header */ + NewEntry.Object = ObjectHeader; + + /* Mask out the internal attributes */ + NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; + /* Check if this is a kernel handle */ if (HandleAttributes & OBJ_KERNEL_HANDLE) { @@ -1296,12 +1302,6 @@ ObpCreateUnnamedHandle(IN PVOID Object, return Status; } - /* Save the object header */ - NewEntry.Object = ObjectHeader; - - /* Mask out the internal attributes */ - NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; - /* Remove what's not in the valid access mask */ GrantedAccess = DesiredAccess & (ObjectType->TypeInfo.ValidAccessMask | ACCESS_SYSTEM_SECURITY); @@ -1503,11 +1503,11 @@ ObpCreateHandle(IN OB_OPEN_REASON OpenReason, if (AccessState->GenerateOnClose) { /* Force the attribute on */ - HandleAttributes|= OBJ_AUDIT_OBJECT_CLOSE; + HandleAttributes |= OBJ_AUDIT_OBJECT_CLOSE; } /* Mask out the internal attributes */ - NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; + NewEntry.ObAttributes |= (HandleAttributes & OBJ_HANDLE_ATTRIBUTES); /* Get the original desired access */ DesiredAccess = AccessState->RemainingDesiredAccess | @@ -2031,7 +2031,12 @@ ObKillProcess(IN PEPROCESS Process) ExSweepHandleTable(HandleTable, ObpCloseHandleCallback, &Context); - ASSERT(HandleTable->HandleCount == 0); + //ASSERT(HandleTable->HandleCount == 0); + /* HACK: Until the problem is investigated... */ + if (HandleTable->HandleCount != 0) + { + DPRINT1("Leaking %d handles!\n", HandleTable->HandleCount); + } /* Leave the critical region */ KeLeaveCriticalRegion(); @@ -2197,7 +2202,7 @@ ObDuplicateObject(IN PEPROCESS SourceProcess, /* Fill out the entry */ RtlZeroMemory(&NewHandleEntry, sizeof(HANDLE_TABLE_ENTRY)); NewHandleEntry.Object = ObjectHeader; - NewHandleEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; + NewHandleEntry.ObAttributes |= (HandleAttributes & OBJ_HANDLE_ATTRIBUTES); /* Check if we're using a generic mask */ if (DesiredAccess & GENERIC_ACCESS)