a little work on the registry code
authorRex Jolliff <rex@lvcablemodem.com>
Mon, 10 May 1999 00:06:49 +0000 (00:06 +0000)
committerRex Jolliff <rex@lvcablemodem.com>
Mon, 10 May 1999 00:06:49 +0000 (00:06 +0000)
svn path=/trunk/; revision=442

reactos/include/ddk/cmtypes.h
reactos/include/ddk/obtypes.h
reactos/lib/crtdll/makefile
reactos/ntoskrnl/cm/registry.c

index 560502e..2d29118 100644 (file)
@@ -1,4 +1,8 @@
 
+/*
+ * Object Manager structures and typedefs
+ */
+
 typedef struct _KEY_VALUE
 {
   ULONG Flags;
@@ -10,6 +14,9 @@ typedef struct _KEY_VALUE
 } KEY_VALUE, *PKEY_VALUE;
 
 typedef struct _KEY_OBJECT
+/*
+ * Type defining the Object Manager Key Object
+ */
 {
   CSHORT Type;
   CSHORT Size;
@@ -30,7 +37,11 @@ typedef struct _KEY_OBJECT
   struct _KEY_OBJECT *NextKey;
 } KEY_OBJECT, *PKEY_OBJECT;
 
-/* key query information class */
+#define  KO_MARKED_FOR_DELETE  0x00000001
+
+/*
+ * key query information class 
+ */
 
 typedef enum _KEY_INFORMATION_CLASS
 {
index 0bf1ce6..5b4befe 100644 (file)
@@ -70,6 +70,11 @@ typedef struct _OBJECT_TYPE
    /*
     * PURPOSE: Called when an open attempts to open a file apparently
     * residing within the object
+    * RETURNS: a pointer to the object that corresponds to the child
+    *   child of ParsedObject that is on Path.  Path is modified to
+    *   to point to the remainder of the path after the child. NULL
+    *   should be return when a leaf is reached and Path should be
+    *   left unchanged as a reault.
     */
    PVOID (*Parse)(PVOID ParsedObject, PWSTR* Path);
    
index 2deac2a..6a30ae4 100644 (file)
@@ -88,8 +88,9 @@ TCHAR_OBJECTS = tchar/strdec.o tchar/strinc.o tchar/strninc.o  tchar/strncnt.o t
 
 TIME_OBJECTS = time/ctime.o time/difftime.o time/strftime.o time/time.o time/clock.o
 
+# float/fpclass.o 
 FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o\
-               float/chgsign.o float/fpclass.o float/isnan.o
+               float/chgsign.o float/isnan.o
 
 SYS_STAT_OBJECTS = sys_stat/fstat.o sys_stat/stat.o sys_stat/futime.o
 
index 0250776..9ad65b4 100644 (file)
 
 #include <internal/debug.h>
 
+/* #define  PROTO_REG  1  /* Comment out to disable */
+
 /* FILE STATICS *************************************************************/
 
 POBJECT_TYPE CmKeyType = NULL;
 PKEY_OBJECT RootKey = NULL;
 
+#if PROTO_REG
+static PVOID CmpObjectParse(PVOID ParsedObject, PWSTR* Path);
+#endif
+
 /* FUNCTIONS *****************************************************************/
 
 VOID
 CmInitializeRegistry(VOID)
 {
-#if 0
+#if PROTO_REG
   ANSI_STRING AnsiString;
   
   CmKeyType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
@@ -110,7 +116,7 @@ ZwCreateKey(PHANDLE KeyHandle,
             ULONG CreateOptions,
             PULONG Disposition)
 {
-#if 0
+#if PROTO_REG
   /* FIXME: Should CurLevel be alloced to handle arbitrary size components? */
   WCHAR *S, *T, CurLevel[255];
   PKEY_OBJECT ParentKey, CurSubKey, NewKey;
@@ -691,3 +697,61 @@ NTSTATUS RtlWriteRegistryValue(ULONG RelativeTo,
    UNIMPLEMENTED;
 }
 
+
+#if 0
+static PVOID 
+CmpObjectParse(PVOID ParsedObject, PWSTR* Path)
+{
+  PWSTR  S, SubKeyBuffer;
+  PKEY_OBJECT  CurrentKey, ChildKey;
+
+  UNIMPLEMENTED
+
+  /*  If the path is an empty string, we're done  */
+  if (Path == NULL || Path[0] == 0)
+    {
+      return NULL;
+    }
+
+  /*  Extract subkey name from path  */
+  S = *Path;
+  while (*S != '\\')
+    {
+      S++;
+    }
+  SubKeyBuffer = ExAllocatePool(NonPagedPool, (S - *Path) * sizeof(WSTR));
+  wstrncpy(SubKeyBuffer, *Path, (S - *Path));
+  SubKeyBuffer[S - *Path] = 0;
+  
+  /* %%% Scan Key for matching SubKey  */
+  CurrentKey = (PKEY_OBJECT) ParsedObject;
+  ChildKey = CurrentKey->
+          /*  Move Key Object pointer to first child  */
+          ParentKey = ParentKey->SubKeys;
+          
+          /*  Extract the next path component from requested path  */
+          wstrncpy(CurLevel, S, T-S);
+          CurLevel[T-S] = 0;
+          DPRINT("CurLevel:[%w]", CurLevel);
+          
+          /*  Walk through children looking for path component  */
+          while (ParentKey != NULL)
+            {
+              if (wstrcmp(CurLevel, ParentKey->Name) == 0)
+                {
+                  break;
+                }
+              ParentKey = ParentKey->NextKey;
+            }
+
+
+  /* %%% If SubKey is not found return NULL  */
+  /* %%% Adjust path to next level  */
+  /* %%% Return object for SubKey  */
+
+  ExFreePool(SubKeyBuffer);
+
+}
+#endif
+
+