Use ULONG_PTR instead of ULONG when doing pointer arithmetics.
[reactos.git] / reactos / ntoskrnl / ob / object.c
index b050105..216db50 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: object.c,v 1.47 2002/05/07 22:39:26 hbirr Exp $
+/* $Id: object.c,v 1.48 2002/05/13 18:10:41 chorns Exp $
  * 
  * COPYRIGHT:     See COPYING in the top level directory
  * PROJECT:       ReactOS kernel
@@ -143,7 +143,7 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
    
    Path = ObjectAttributes->ObjectName->Buffer;
    
-   if (Path[0] == 0)
+   if ((Path == NULL) && (Path[0] == 0))
      {
        *ReturnedObject = CurrentObject;
        return(STATUS_SUCCESS);
@@ -155,16 +155,8 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
        return(STATUS_UNSUCCESSFUL);
      }
    
-   if (Path)
-     {
        RtlCreateUnicodeString (&PathString, Path);
        current = PathString.Buffer;
-     }
-   else
-     {
-       RtlInitUnicodeString (&PathString, NULL);
-       current = NULL;
-     }
 
    RootObject = CurrentObject;
 
@@ -244,15 +236,18 @@ ObCreateObject(OUT PHANDLE Handle,
 
   DPRINT("ObCreateObject(Handle %x, ObjectAttributes %x, Type %x)\n",
         Handle, ObjectAttributes, Type);
+
   if (ObjectAttributes != NULL &&
-      ObjectAttributes->ObjectName != NULL)
+      ObjectAttributes->ObjectName != NULL &&
+      ObjectAttributes->ObjectName->Buffer != NULL)
     {
       DPRINT("ObjectAttributes->ObjectName->Buffer %S\n",
             ObjectAttributes->ObjectName->Buffer);
     }
 
   if (ObjectAttributes != NULL &&
-      ObjectAttributes->ObjectName != NULL)
+      ObjectAttributes->ObjectName != NULL &&
+      ObjectAttributes->ObjectName->Buffer != NULL)
     {
       Status = ObFindObject(ObjectAttributes,
                            &Parent,
@@ -268,7 +263,6 @@ ObCreateObject(OUT PHANDLE Handle,
     {
       RtlInitUnicodeString(&RemainingPath, NULL);
     }
-
   RtlMapGenericMask(&DesiredAccess,
                    Type->Mapping);
 
@@ -304,6 +298,7 @@ ObCreateObject(OUT PHANDLE Handle,
                                          Parent,
                                          RemainingPath.Buffer,
                                          ObjectAttributes);
+
       if (!NT_SUCCESS(Status))
        {
          if (ObjectAttached == TRUE)
@@ -320,6 +315,7 @@ ObCreateObject(OUT PHANDLE Handle,
          return(Status);
        }
     }
+
   RtlFreeUnicodeString( &RemainingPath );
 
   *Object = HEADER_TO_BODY(Header);