From 8b6398a0e31313fc24ae2ffc3bff17fbae5a4db8 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sun, 22 May 2005 16:48:30 +0000 Subject: [PATCH] ObInsertObject must always return STATUS_OBJECT_NAME_COLLISION if an object with the same name exist. svn path=/trunk/; revision=15470 --- reactos/ntoskrnl/ob/handle.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index f3617618e99..876f4b96f58 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -739,6 +739,10 @@ ObReferenceObjectByHandle(HANDLE Handle, "ObjectType %x, AccessMode %d, Object %x)\n",Handle,DesiredAccess, ObjectType,AccessMode,Object); + if (Handle == NULL) + { + return STATUS_INVALID_HANDLE; + } /* * Handle special handle names */ @@ -986,13 +990,8 @@ ObInsertObject(IN PVOID Object, if (FoundHeader && RemainingPath.Buffer == NULL) { DPRINT("Object exists\n"); - if (FoundHeader->ObjectType != Header->ObjectType - || !(ObjectCreateInfo->Attributes & OBJ_OPENIF)) - { - ObDereferenceObject(FoundObject); - return STATUS_OBJECT_NAME_COLLISION; - } - return STATUS_OBJECT_EXISTS; + ObDereferenceObject(FoundObject); + return STATUS_OBJECT_NAME_COLLISION; } } else