- Minor code changes, plus a temporary (DPRINT1) change for the HandleCount != 0 problem.

svn path=/trunk/; revision=28280
This commit is contained in:
Aleksey Bragin 2007-08-11 09:04:17 +00:00
parent 58272e652f
commit 056b071be7

View file

@ -1259,6 +1259,12 @@ ObpCreateUnnamedHandle(IN PVOID Object,
ObjectHeader->HandleCount, ObjectHeader->HandleCount,
ObjectHeader->PointerCount); 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 */ /* Check if this is a kernel handle */
if (HandleAttributes & OBJ_KERNEL_HANDLE) if (HandleAttributes & OBJ_KERNEL_HANDLE)
{ {
@ -1296,12 +1302,6 @@ ObpCreateUnnamedHandle(IN PVOID Object,
return Status; 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 */ /* Remove what's not in the valid access mask */
GrantedAccess = DesiredAccess & (ObjectType->TypeInfo.ValidAccessMask | GrantedAccess = DesiredAccess & (ObjectType->TypeInfo.ValidAccessMask |
ACCESS_SYSTEM_SECURITY); ACCESS_SYSTEM_SECURITY);
@ -1503,11 +1503,11 @@ ObpCreateHandle(IN OB_OPEN_REASON OpenReason,
if (AccessState->GenerateOnClose) if (AccessState->GenerateOnClose)
{ {
/* Force the attribute on */ /* Force the attribute on */
HandleAttributes|= OBJ_AUDIT_OBJECT_CLOSE; HandleAttributes |= OBJ_AUDIT_OBJECT_CLOSE;
} }
/* Mask out the internal attributes */ /* Mask out the internal attributes */
NewEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; NewEntry.ObAttributes |= (HandleAttributes & OBJ_HANDLE_ATTRIBUTES);
/* Get the original desired access */ /* Get the original desired access */
DesiredAccess = AccessState->RemainingDesiredAccess | DesiredAccess = AccessState->RemainingDesiredAccess |
@ -2031,7 +2031,12 @@ ObKillProcess(IN PEPROCESS Process)
ExSweepHandleTable(HandleTable, ExSweepHandleTable(HandleTable,
ObpCloseHandleCallback, ObpCloseHandleCallback,
&Context); &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 */ /* Leave the critical region */
KeLeaveCriticalRegion(); KeLeaveCriticalRegion();
@ -2197,7 +2202,7 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
/* Fill out the entry */ /* Fill out the entry */
RtlZeroMemory(&NewHandleEntry, sizeof(HANDLE_TABLE_ENTRY)); RtlZeroMemory(&NewHandleEntry, sizeof(HANDLE_TABLE_ENTRY));
NewHandleEntry.Object = ObjectHeader; NewHandleEntry.Object = ObjectHeader;
NewHandleEntry.ObAttributes |= HandleAttributes & OBJ_HANDLE_ATTRIBUTES; NewHandleEntry.ObAttributes |= (HandleAttributes & OBJ_HANDLE_ATTRIBUTES);
/* Check if we're using a generic mask */ /* Check if we're using a generic mask */
if (DesiredAccess & GENERIC_ACCESS) if (DesiredAccess & GENERIC_ACCESS)