update for HEAD-2003091401
[reactos.git] / ntoskrnl / ob / namespc.c
index 0800e34..e20966d 100644 (file)
 
 /* INCLUDES ***************************************************************/
 
-#ifdef WIN32_REGDBG
-#include "cm_win32.h"
-#else
-
 #include <limits.h>
-#include <ddk/ntddk.h>
+#define NTOS_MODE_KERNEL
+#include <ntos.h>
 #include <internal/ob.h>
 #include <internal/io.h>
 #include <internal/pool.h>
@@ -24,7 +21,6 @@
 #define NDEBUG
 #include <internal/debug.h>
 
-#endif
 
 /* GLOBALS ****************************************************************/
 
@@ -46,7 +42,10 @@ static GENERIC_MAPPING ObpTypeMapping = {
        0x000F0001};
 
 /* FUNCTIONS **************************************************************/
-#ifndef WIN32_REGDBG
+
+/*
+ * @implemented
+ */
 NTSTATUS STDCALL
 ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
                        ULONG Attributes,
@@ -90,7 +89,7 @@ DPRINT("Object %p\n", Object);
    RtlFreeUnicodeString (&RemainingPath);
    return(STATUS_SUCCESS);
 }
-#endif // WIN32_REGDBG
+
 
 /**********************************************************************
  * NAME                                                        EXPORTED
@@ -117,6 +116,8 @@ DPRINT("Object %p\n", Object);
  *
  * RETURN VALUE
  *     Status.
+ *
+ * @implemented
  */
 NTSTATUS STDCALL
 ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
@@ -139,6 +140,7 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
                         ObjectType);
    if (!NT_SUCCESS(Status))
      {
+       DPRINT("ObFindObject() failed (Status %lx)\n", Status);
        return Status;
      }
 
@@ -184,6 +186,7 @@ ObpAddEntryDirectory(PDIRECTORY_OBJECT Parent,
   KeReleaseSpinLock(&Parent->Lock, oldlvl);
 }
 
+
 VOID
 ObpRemoveEntryDirectory(POBJECT_HEADER Header)
 /*
@@ -201,6 +204,7 @@ ObpRemoveEntryDirectory(POBJECT_HEADER Header)
   KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl);
 }
 
+
 PVOID
 ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
                      PWSTR Name,
@@ -249,6 +253,7 @@ ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
    return(NULL);
 }
 
+
 NTSTATUS STDCALL
 ObpParseDirectory(PVOID Object,
                  PVOID * NextObject,
@@ -256,56 +261,61 @@ ObpParseDirectory(PVOID Object,
                  PWSTR * Path,
                  ULONG Attributes)
 {
-   PWSTR end;
-   PVOID FoundObject;
-   
-   DPRINT("ObpParseDirectory(Object %x, Path %x, *Path %S)\n",
-         Object,Path,*Path);
-   
-   *NextObject = NULL;
-   
-   if ((*Path) == NULL)
-     {
-       return STATUS_UNSUCCESSFUL;
-     }
-   
-   end = wcschr((*Path)+1, '\\');
-   if (end != NULL)
-     {
-       *end = 0;
-     }
-   
-   FoundObject = ObpFindEntryDirectory(Object, (*Path)+1, Attributes);
-   
-   if (FoundObject == NULL)
-     {
-       if (end != NULL)
-         {
-            *end = '\\';
-         }
-       return STATUS_UNSUCCESSFUL;
-     }
-   
-   ObReferenceObjectByPointer(FoundObject,
-                             STANDARD_RIGHTS_REQUIRED,
-                             NULL,
-                             UserMode);
-   
-   if (end != NULL)
-     {
-       *end = '\\';
-       *Path = end;
-     }
-   else
-     {
-       *Path = NULL;
-     }
-   
-   *NextObject = FoundObject;
-   
-   return STATUS_SUCCESS;
+  PWSTR Start;
+  PWSTR End;
+  PVOID FoundObject;
+
+  DPRINT("ObpParseDirectory(Object %x, Path %x, *Path %S)\n",
+        Object,Path,*Path);
+
+  *NextObject = NULL;
+
+  if ((*Path) == NULL)
+    {
+      return STATUS_UNSUCCESSFUL;
+    }
+
+  Start = *Path;
+  if (*Start == L'\\')
+    Start++;
+
+  End = wcschr(Start, L'\\');
+  if (End != NULL)
+    {
+      *End = 0;
+    }
+
+  FoundObject = ObpFindEntryDirectory(Object, Start, Attributes);
+  if (FoundObject == NULL)
+    {
+      if (End != NULL)
+       {
+         *End = L'\\';
+       }
+      return STATUS_UNSUCCESSFUL;
+    }
+
+  ObReferenceObjectByPointer(FoundObject,
+                            STANDARD_RIGHTS_REQUIRED,
+                            NULL,
+                            UserMode);
+
+  if (End != NULL)
+    {
+      *End = L'\\';
+      *Path = End;
+    }
+  else
+    {
+      *Path = NULL;
+    }
+
+  *NextObject = FoundObject;
+
+  return STATUS_SUCCESS;
 }
 
+
 NTSTATUS STDCALL
 ObpCreateDirectory(PVOID ObjectBody,
                   PVOID Parent,
@@ -389,7 +399,7 @@ ObInit(VOID)
                       L"ObjectType");
 
   /* create root directory */
-  ObCreateObject(NULL,
+  ObRosCreateObject(NULL,
                 STANDARD_RIGHTS_REQUIRED,
                 NULL,
                 ObDirectoryType,
@@ -403,7 +413,7 @@ ObInit(VOID)
                             OBJ_PERMANENT,
                             NULL,
                             NULL);
-  ObCreateObject(NULL,
+  ObRosCreateObject(NULL,
                 STANDARD_RIGHTS_REQUIRED,
                 &ObjectAttributes,
                 ObDirectoryType,
@@ -437,7 +447,7 @@ ObpCreateTypeObject(POBJECT_TYPE ObjectType)
                             OBJ_PERMANENT,
                             NULL,
                             NULL);
-  Status = ObCreateObject(NULL,
+  Status = ObRosCreateObject(NULL,
                          STANDARD_RIGHTS_REQUIRED,
                          &ObjectAttributes,
                          ObTypeObjectType,
@@ -450,5 +460,4 @@ ObpCreateTypeObject(POBJECT_TYPE ObjectType)
   return(STATUS_SUCCESS);
 }
 
-
 /* EOF */