diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 5bc998c3d3c..11497b3b7ea 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -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)) diff --git a/reactos/ntoskrnl/ob/oblife.c b/reactos/ntoskrnl/ob/oblife.c index 019cb3b1569..fac35da0b7e 100644 --- a/reactos/ntoskrnl/ob/oblife.c +++ b/reactos/ntoskrnl/ob/oblife.c @@ -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) { diff --git a/reactos/ntoskrnl/ob/obref.c b/reactos/ntoskrnl/ob/obref.c index d955c10b061..7d61b226dfe 100644 --- a/reactos/ntoskrnl/ob/obref.c +++ b/reactos/ntoskrnl/ob/obref.c @@ -122,7 +122,6 @@ ObfDereferenceObject(IN PVOID Object) Header->NextToFree); /* Queue the work item */ - KeBugCheck(0); ExQueueWorkItem(&ObpReaperWorkItem, DelayedWorkQueue); } } diff --git a/reactos/ntoskrnl/ob/obwait.c b/reactos/ntoskrnl/ob/obwait.c index e5e1a1300f0..df03927f32a 100644 --- a/reactos/ntoskrnl/ob/obwait.c +++ b/reactos/ntoskrnl/ob/obwait.c @@ -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; }