From 169894bcc5fb08c2106b1c3ad226e6c2829c6e67 Mon Sep 17 00:00:00 2001 From: Rex Jolliff Date: Mon, 10 May 1999 00:06:49 +0000 Subject: [PATCH] a little work on the registry code svn path=/trunk/; revision=442 --- reactos/include/ddk/cmtypes.h | 13 ++++++- reactos/include/ddk/obtypes.h | 5 +++ reactos/lib/crtdll/makefile | 3 +- reactos/ntoskrnl/cm/registry.c | 68 +++++++++++++++++++++++++++++++++- 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/reactos/include/ddk/cmtypes.h b/reactos/include/ddk/cmtypes.h index 560502e72c1..2d29118ba5d 100644 --- a/reactos/include/ddk/cmtypes.h +++ b/reactos/include/ddk/cmtypes.h @@ -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 { diff --git a/reactos/include/ddk/obtypes.h b/reactos/include/ddk/obtypes.h index 0bf1ce69e0e..5b4befeb3e1 100644 --- a/reactos/include/ddk/obtypes.h +++ b/reactos/include/ddk/obtypes.h @@ -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); diff --git a/reactos/lib/crtdll/makefile b/reactos/lib/crtdll/makefile index 2deac2a7fc7..6a30ae45ecc 100644 --- a/reactos/lib/crtdll/makefile +++ b/reactos/lib/crtdll/makefile @@ -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 diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index 02507761844..9ad65b460f3 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -14,17 +14,23 @@ #include +/* #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 + +