- Activate the Grim Reaper and remove a hard-coded bugcheck. This fixes random bugchecks and especially bugchecks on shutdown.

svn path=/trunk/; revision=22697
This commit is contained in:
Alex Ionescu 2006-06-29 19:24:10 +00:00
parent 4c630fdc31
commit 9478fc9049
4 changed files with 18 additions and 20 deletions

View file

@ -728,12 +728,7 @@ ObpCreateHandle(IN OB_OPEN_REASON OpenReason,
ObjectHeader->PointerCount); ObjectHeader->PointerCount);
/* Check if the types match */ /* Check if the types match */
if ((Type) && (ObjectType != Type)) if ((Type) && (ObjectType != Type)) return STATUS_OBJECT_TYPE_MISMATCH;
{
/* They don't; fail */
DPRINT1("Type mismatch: %wZ, %wZ\n", &ObjectType->Name, &Type->Name);
return STATUS_OBJECT_TYPE_MISMATCH;
}
/* Check if this is a kernel handle */ /* Check if this is a kernel handle */
if ((HandleAttributes & OBJ_KERNEL_HANDLE) && (AccessMode == KernelMode)) if ((HandleAttributes & OBJ_KERNEL_HANDLE) && (AccessMode == KernelMode))

View file

@ -176,7 +176,7 @@ ObpReapObject(IN PVOID Parameter)
/* Move to the next one */ /* Move to the next one */
ReapObject = NextObject; ReapObject = NextObject;
} while(NextObject != NULL); } while (NextObject);
} }
} }
@ -266,7 +266,6 @@ ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName,
(StringLength == (MAXUSHORT - sizeof(UNICODE_NULL) + 1))) (StringLength == (MAXUSHORT - sizeof(UNICODE_NULL) + 1)))
{ {
/* PS: Please keep the checks above expanded for clarity */ /* PS: Please keep the checks above expanded for clarity */
DPRINT1("Invalid String Length\n");
Status = STATUS_OBJECT_NAME_INVALID; Status = STATUS_OBJECT_NAME_INVALID;
} }
else else
@ -305,7 +304,6 @@ ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName,
else else
{ {
/* Fail */ /* Fail */
DPRINT1("Out of Memory!\n");
Status = STATUS_INSUFFICIENT_RESOURCES; Status = STATUS_INSUFFICIENT_RESOURCES;
} }
} }
@ -757,8 +755,17 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
sizeof(OBJECT_TYPE) + sizeof(OBJECT_HEADER), sizeof(OBJECT_TYPE) + sizeof(OBJECT_HEADER),
KernelMode, KernelMode,
(POBJECT_HEADER*)&Header); (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 = (POBJECT_TYPE)&Header->Body;
LocalObjectType->Name = ObjectName;
Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
/* Check if this is the first Object Type */ /* Check if this is the first Object Type */
if (!ObTypeObjectType) if (!ObTypeObjectType)
@ -778,14 +785,10 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
LocalObjectType->Key = *(PULONG)Tag; LocalObjectType->Key = *(PULONG)Tag;
} }
/* Set it up */ /* Set up the type information */
LocalObjectType->TypeInfo = *ObjectTypeInitializer; LocalObjectType->TypeInfo = *ObjectTypeInitializer;
LocalObjectType->Name = *TypeName;
LocalObjectType->TypeInfo.PoolType = ObjectTypeInitializer->PoolType; 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 */ /* Check if we have to maintain a type list */
if (NtGlobalFlag & FLG_MAINTAIN_OBJECT_TYPELIST) if (NtGlobalFlag & FLG_MAINTAIN_OBJECT_TYPELIST)
{ {

View file

@ -122,7 +122,6 @@ ObfDereferenceObject(IN PVOID Object)
Header->NextToFree); Header->NextToFree);
/* Queue the work item */ /* Queue the work item */
KeBugCheck(0);
ExQueueWorkItem(&ObpReaperWorkItem, DelayedWorkQueue); ExQueueWorkItem(&ObpReaperWorkItem, DelayedWorkQueue);
} }
} }

View file

@ -151,9 +151,10 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount,
} }
/* Get a pointer to it */ /* Get a pointer to it */
if (!(HandleEntry = ExMapHandleToPointer(HandleTable, Handles[i]))) HandleEntry = ExMapHandleToPointer(HandleTable, Handles[i]);
if (!HandleEntry)
{ {
DPRINT1("Invalid handle\n"); /* Fail, handle is invalid */
Status = STATUS_INVALID_HANDLE; Status = STATUS_INVALID_HANDLE;
goto Quickie; goto Quickie;
} }