Author: ion Date: Thu Jun 29 23:24:10 2006 New Revision: 22697
URL: http://svn.reactos.org/svn/reactos?rev=22697&view=rev Log: - Activate the Grim Reaper and remove a hard-coded bugcheck. This fixes random bugchecks and especially bugchecks on shutdown.
Modified: trunk/reactos/ntoskrnl/ob/obhandle.c trunk/reactos/ntoskrnl/ob/oblife.c trunk/reactos/ntoskrnl/ob/obref.c trunk/reactos/ntoskrnl/ob/obwait.c
Modified: trunk/reactos/ntoskrnl/ob/obhandle.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/ob/obhandle.c (original) +++ trunk/reactos/ntoskrnl/ob/obhandle.c Thu Jun 29 23:24:10 2006 @@ -728,12 +728,7 @@ ObjectHeader->PointerCount);
/* Check if the types match */ - if ((Type) && (ObjectType != Type)) - { - /* They don't; fail */ - DPRINT1("Type mismatch: %wZ, %wZ\n", &ObjectType->Name, &Type->Name); - return STATUS_OBJECT_TYPE_MISMATCH; - } + if ((Type) && (ObjectType != Type)) return STATUS_OBJECT_TYPE_MISMATCH;
/* Check if this is a kernel handle */ if ((HandleAttributes & OBJ_KERNEL_HANDLE) && (AccessMode == KernelMode))
Modified: trunk/reactos/ntoskrnl/ob/oblife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/oblife.c?rev=22... ============================================================================== --- trunk/reactos/ntoskrnl/ob/oblife.c (original) +++ trunk/reactos/ntoskrnl/ob/oblife.c Thu Jun 29 23:24:10 2006 @@ -163,7 +163,7 @@ PVOID NextObject;
/* Start reaping */ - while((ReapObject = InterlockedExchangePointer(&ObpReaperList, NULL))) + while ((ReapObject = InterlockedExchangePointer(&ObpReaperList, NULL))) { /* Start deletion loop */ do @@ -176,7 +176,7 @@
/* Move to the next one */ ReapObject = NextObject; - } while(NextObject != NULL); + } while (NextObject); } }
@@ -266,7 +266,6 @@ (StringLength == (MAXUSHORT - sizeof(UNICODE_NULL) + 1))) { /* PS: Please keep the checks above expanded for clarity */ - DPRINT1("Invalid String Length\n"); Status = STATUS_OBJECT_NAME_INVALID; } else @@ -305,7 +304,6 @@ else { /* Fail */ - DPRINT1("Out of Memory!\n"); Status = STATUS_INSUFFICIENT_RESOURCES; } } @@ -523,7 +521,7 @@ }
/* Initialize the Object Name Info */ - if (HasNameInfo) + if (HasNameInfo) { NameInfo = (POBJECT_HEADER_NAME_INFO)Header; NameInfo->Name = *ObjectName; @@ -757,8 +755,17 @@ sizeof(OBJECT_TYPE) + sizeof(OBJECT_HEADER), KernelMode, (POBJECT_HEADER*)&Header); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + { + /* Free the name and fail */ + ExFreePool(ObjectName.Buffer); + return Status; + } + + /* Setup the flags and name */ LocalObjectType = (POBJECT_TYPE)&Header->Body; + LocalObjectType->Name = ObjectName; + Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
/* Check if this is the first Object Type */ if (!ObTypeObjectType) @@ -778,13 +785,9 @@ LocalObjectType->Key = *(PULONG)Tag; }
- /* Set it up */ + /* Set up the type information */ LocalObjectType->TypeInfo = *ObjectTypeInitializer; - LocalObjectType->Name = *TypeName; LocalObjectType->TypeInfo.PoolType = ObjectTypeInitializer->PoolType; - - /* These two flags need to be manually set up */ - Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
/* Check if we have to maintain a type list */ if (NtGlobalFlag & FLG_MAINTAIN_OBJECT_TYPELIST)
Modified: trunk/reactos/ntoskrnl/ob/obref.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=226... ============================================================================== --- trunk/reactos/ntoskrnl/ob/obref.c (original) +++ trunk/reactos/ntoskrnl/ob/obref.c Thu Jun 29 23:24:10 2006 @@ -122,7 +122,6 @@ Header->NextToFree);
/* Queue the work item */ - KeBugCheck(0); ExQueueWorkItem(&ObpReaperWorkItem, DelayedWorkQueue); } }
Modified: trunk/reactos/ntoskrnl/ob/obwait.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obwait.c?rev=22... ============================================================================== --- trunk/reactos/ntoskrnl/ob/obwait.c (original) +++ trunk/reactos/ntoskrnl/ob/obwait.c Thu Jun 29 23:24:10 2006 @@ -151,9 +151,10 @@ }
/* Get a pointer to it */ - if (!(HandleEntry = ExMapHandleToPointer(HandleTable, Handles[i]))) - { - DPRINT1("Invalid handle\n"); + HandleEntry = ExMapHandleToPointer(HandleTable, Handles[i]); + if (!HandleEntry) + { + /* Fail, handle is invalid */ Status = STATUS_INVALID_HANDLE; goto Quickie; }