- Activate the Grim Reaper and remove a hard-coded bugcheck. This fixes random bugche...
authorAlex Ionescu <aionescu@gmail.com>
Thu, 29 Jun 2006 19:24:10 +0000 (19:24 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Thu, 29 Jun 2006 19:24:10 +0000 (19:24 +0000)
svn path=/trunk/; revision=22697

reactos/ntoskrnl/ob/obhandle.c
reactos/ntoskrnl/ob/oblife.c
reactos/ntoskrnl/ob/obref.c
reactos/ntoskrnl/ob/obwait.c

index 5bc998c..11497b3 100644 (file)
@@ -728,12 +728,7 @@ ObpCreateHandle(IN OB_OPEN_REASON OpenReason,
             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))
index 019cb3b..fac35da 100644 (file)
@@ -163,7 +163,7 @@ ObpReapObject(IN PVOID Parameter)
     PVOID NextObject;
 
     /* Start reaping */
-    while((ReapObject = InterlockedExchangePointer(&ObpReaperList, NULL)))
+    while ((ReapObject = InterlockedExchangePointer(&ObpReaperList, NULL)))
     {
         /* Start deletion loop */
         do
@@ -176,7 +176,7 @@ ObpReapObject(IN PVOID Parameter)
 
             /* Move to the next one */
             ReapObject = NextObject;
-        } while(NextObject != NULL);
+        } while (NextObject);
     }
 }
 
@@ -266,7 +266,6 @@ ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName,
                 (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 @@ ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName,
                 else
                 {
                     /* Fail */
-                    DPRINT1("Out of Memory!\n");
                     Status = STATUS_INSUFFICIENT_RESOURCES;
                 }
             }
@@ -523,7 +521,7 @@ ObpAllocateObject(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
     }
 
     /* Initialize the Object Name Info */
-    if (HasNameInfo) 
+    if (HasNameInfo)
     {
         NameInfo = (POBJECT_HEADER_NAME_INFO)Header;
         NameInfo->Name = *ObjectName;
@@ -757,8 +755,17 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
                                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,14 +785,10 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
         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)
     {
index d955c10..7d61b22 100644 (file)
@@ -122,7 +122,6 @@ ObfDereferenceObject(IN PVOID Object)
                      Header->NextToFree);
 
             /* Queue the work item */
-            KeBugCheck(0);
             ExQueueWorkItem(&ObpReaperWorkItem, DelayedWorkQueue);
         }
     }
index e5e1a13..df03927 100644 (file)
@@ -151,9 +151,10 @@ NtWaitForMultipleObjects(IN ULONG ObjectCount,
         }
 
         /* 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;
             goto Quickie;
         }