[ros-diffs] [fireball] 30704: - Huge cleanup of cm.h -- remove stuff that's not needed/used anymore - Get rid of registry.c. - Move CmpLinkHiveToMaster to cmsysini.c since it now uses new config code and works properly. - Move CmpRosGetHardwareHive to cmsysini.c since it's an initialization function (will go away eventually).

fireball at svn.reactos.org fireball at svn.reactos.org
Fri Nov 23 20:29:46 CET 2007


Author: fireball
Date: Fri Nov 23 22:29:45 2007
New Revision: 30704

URL: http://svn.reactos.org/svn/reactos?rev=30704&view=rev
Log:
- Huge cleanup of cm.h -- remove stuff that's not needed/used anymore
- Get rid of registry.c.
- Move CmpLinkHiveToMaster to cmsysini.c since it now uses new config code and works properly.
- Move CmpRosGetHardwareHive to cmsysini.c since it's an initialization function (will go away eventually).

Removed:
    trunk/reactos/ntoskrnl/cm/registry.c
Modified:
    trunk/reactos/ntoskrnl/cm/cm.h
    trunk/reactos/ntoskrnl/config/cm.h
    trunk/reactos/ntoskrnl/config/cmsysini.c
    trunk/reactos/ntoskrnl/ex/shutdown.c
    trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
    trunk/reactos/ntoskrnl/ntoskrnl.rbuild

Modified: trunk/reactos/ntoskrnl/cm/cm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/cm.h (original)
+++ trunk/reactos/ntoskrnl/cm/cm.h Fri Nov 23 22:29:45 2007
@@ -3,64 +3,10 @@
 
 #include "ntoskrnl/config/cm.h"
 
-#ifdef DBG
-#define CHECKED 1
-#else
-#define CHECKED 0
-#endif
-
-#define  REG_ROOT_KEY_NAME		L"\\Registry"
-#define  REG_MACHINE_KEY_NAME		L"\\Registry\\Machine"
-#define  REG_HARDWARE_KEY_NAME		L"\\Registry\\Machine\\HARDWARE"
-#define  REG_DESCRIPTION_KEY_NAME	L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION"
-#define  REG_DEVICEMAP_KEY_NAME		L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP"
-#define  REG_RESOURCEMAP_KEY_NAME	L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP"
-#define  REG_CLASSES_KEY_NAME		L"\\Registry\\Machine\\Software\\Classes"
-#define  REG_SYSTEM_KEY_NAME		L"\\Registry\\Machine\\SYSTEM"
-#define  REG_SOFTWARE_KEY_NAME		L"\\Registry\\Machine\\SOFTWARE"
-#define  REG_SAM_KEY_NAME		L"\\Registry\\Machine\\SAM"
-#define  REG_SEC_KEY_NAME		L"\\Registry\\Machine\\SECURITY"
-#define  REG_USER_KEY_NAME		L"\\Registry\\User"
-#define  REG_DEFAULT_USER_KEY_NAME	L"\\Registry\\User\\.Default"
-#define  REG_CURRENT_USER_KEY_NAME	L"\\Registry\\User\\CurrentUser"
-
-#define  SYSTEM_REG_FILE		L"\\SystemRoot\\System32\\Config\\SYSTEM"
-#define  SYSTEM_LOG_FILE		L"\\SystemRoot\\System32\\Config\\SYSTEM.log"
-#define  SOFTWARE_REG_FILE		L"\\SystemRoot\\System32\\Config\\SOFTWARE"
-#define  DEFAULT_USER_REG_FILE		L"\\SystemRoot\\System32\\Config\\DEFAULT"
-#define  SAM_REG_FILE			L"\\SystemRoot\\System32\\Config\\SAM"
-#define  SEC_REG_FILE			L"\\SystemRoot\\System32\\Config\\SECURITY"
-
-#define  REG_SYSTEM_FILE_NAME		L"\\system"
-#define  REG_SOFTWARE_FILE_NAME		L"\\software"
-#define  REG_DEFAULT_USER_FILE_NAME	L"\\default"
-#define  REG_SAM_FILE_NAME		L"\\sam"
-#define  REG_SEC_FILE_NAME		L"\\security"
-
-/* Bits 31-22 (top 10 bits) of the cell index is the directory index */
-#define CmiDirectoryIndex(CellIndex)(CellIndex & 0xffc000000)
-/* Bits 21-12 (middle 10 bits) of the cell index is the table index */
-#define CmiTableIndex(Cellndex)(CellIndex & 0x003ff000)
-/* Bits 11-0 (bottom 12 bits) of the cell index is the byte offset */
-#define CmiByteOffset(Cellndex)(CellIndex & 0x00000fff)
-
-
 extern POBJECT_TYPE CmpKeyObjectType;
 extern KSPIN_LOCK CmiKeyListLock;
-
 extern ERESOURCE CmpRegistryLock;
 extern EX_PUSH_LOCK CmpHiveListHeadLock;
-
-/* Registry Callback Function */
-typedef struct _REGISTRY_CALLBACK
-{
-    LIST_ENTRY ListEntry;
-    EX_RUNDOWN_REF RundownRef;
-    PEX_CALLBACK_FUNCTION Function;
-    PVOID Context;
-    LARGE_INTEGER Cookie;
-    BOOLEAN PendingDelete;
-} REGISTRY_CALLBACK, *PREGISTRY_CALLBACK;
 
 NTSTATUS
 CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
@@ -74,39 +20,4 @@
 #define VERIFY_KEY_OBJECT(x)
 #define VERIFY_REGISTRY_HIVE(x)
 
-NTSTATUS STDCALL
-CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
-                   IN PVOID                 Context,
-                   IN OUT PLARGE_INTEGER    Cookie
-                    );
-
-NTSTATUS STDCALL
-CmUnRegisterCallback(IN LARGE_INTEGER    Cookie);
-
-VOID
-CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
-		IN PKEY_OBJECT NewKey);
-VOID
-NTAPI
-CmpLazyFlush(VOID);
-
-NTSTATUS
-CmiInitHives(BOOLEAN SetupBoot);
-
-NTSTATUS
-NTAPI
-CmFindObject(
-    POBJECT_CREATE_INFORMATION ObjectCreateInfo,
-    PUNICODE_STRING ObjectName,
-    PVOID* ReturnedObject,
-    PUNICODE_STRING RemainingPath,
-    POBJECT_TYPE ObjectType,
-    IN PACCESS_STATE AccessState,
-    IN PVOID ParseContext
-);
-
-// Some Ob definitions for debug messages in Cm
-#define ObGetObjectPointerCount(x) OBJECT_TO_OBJECT_HEADER(x)->PointerCount
-#define ObGetObjectHandleCount(x) OBJECT_TO_OBJECT_HEADER(x)->HandleCount
-
 #endif /*__INCLUDE_CM_H*/

Removed: trunk/reactos/ntoskrnl/cm/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev=30703&view=auto
==============================================================================
--- trunk/reactos/ntoskrnl/cm/registry.c (original)
+++ trunk/reactos/ntoskrnl/cm/registry.c (removed)
@@ -1,233 +1,0 @@
-/*
- * PROJECT:         ReactOS Kernel
- * COPYRIGHT:       GPL - See COPYING in the top level directory
- * FILE:            ntoskrnl/cm/registry.c
- * PURPOSE:         Registry functions
- *
- * PROGRAMMERS:     Hartmut Birr
- *                  Alex Ionescu
- *                  Rex Jolliff
- *                  Eric Kohl
- *                  Matt Pyne
- *                  Jean Michault
- *                  Art Yerkes
- */
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-#include "cm.h"
-
-#if defined (ALLOC_PRAGMA)
-#pragma alloc_text(INIT, CmInitSystem1)
-#endif
-
-/* GLOBALS ******************************************************************/
-
-extern BOOLEAN ExpInTextModeSetup;
-
-POBJECT_TYPE  CmpKeyObjectType = NULL;
-PCMHIVE  CmiVolatileHive = NULL;
-
-LIST_ENTRY CmpHiveListHead;
-
-ERESOURCE CmpRegistryLock;
-
-LIST_ENTRY CmiKeyObjectListHead;
-LIST_ENTRY CmiConnectedHiveList;
-
-extern LIST_ENTRY CmiCallbackHead;
-extern FAST_MUTEX CmiCallbackLock;
-
-PVOID
-NTAPI
-CmpRosGetHardwareHive(OUT PULONG Length)
-{
-    PLIST_ENTRY ListHead, NextEntry;
-    PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL;
-
-    /* Loop the memory descriptors */
-    ListHead = &KeLoaderBlock->MemoryDescriptorListHead;
-    NextEntry = ListHead->Flink;
-    while (NextEntry != ListHead)
-    {
-        /* Get the current block */
-        MdBlock = CONTAINING_RECORD(NextEntry,
-                                    MEMORY_ALLOCATION_DESCRIPTOR,
-                                    ListEntry);
-
-        /* Check if this is an registry block */
-        if (MdBlock->MemoryType == LoaderRegistryData)
-        {
-            /* Check if it's not the SYSTEM hive that we already initialized */
-            if ((MdBlock->BasePage) !=
-                (((ULONG_PTR)KeLoaderBlock->RegistryBase &~ KSEG0_BASE) >> PAGE_SHIFT))
-            {
-                /* Hardware hive break out */
-                break;
-            }
-        }
-
-        /* Go to the next block */
-        NextEntry = MdBlock->ListEntry.Flink;
-    }
-
-    /* We need a hardware hive */
-    ASSERT(MdBlock);
-    *Length = MdBlock->PageCount << PAGE_SHIFT;
-    return (PVOID)((MdBlock->BasePage << PAGE_SHIFT) | KSEG0_BASE);
-}
-
-/* Precondition: Must not hold the hive lock CmpRegistryLock */
-VOID
-NTAPI
-EnlistKeyBodyWithKeyObject(IN PKEY_OBJECT KeyObject,
-                           IN ULONG Flags)
-{
-    /* Acquire hive lock */
-    KeEnterCriticalRegion();
-    ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
-
-    /* Insert it into the global list (we don't have KCBs here) */
-    InsertTailList(&CmiKeyObjectListHead, &KeyObject->KeyBodyList);
-
-    /* Release hive lock */
-    ExReleaseResourceLite(&CmpRegistryLock);
-    KeLeaveCriticalRegion();
-}
-
-NTSTATUS
-NTAPI
-CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
-                    IN HANDLE RootDirectory,
-                    IN PCMHIVE RegistryHive,
-                    IN BOOLEAN Allocate,
-                    IN PSECURITY_DESCRIPTOR SecurityDescriptor)
-{
-    OBJECT_ATTRIBUTES ObjectAttributes;
-    UNICODE_STRING RemainingPath;
-    PKEY_OBJECT ParentKey;
-    PKEY_OBJECT NewKey;
-    NTSTATUS Status;
-    UNICODE_STRING ObjectName;
-    OBJECT_CREATE_INFORMATION ObjectCreateInfo;
-    CM_PARSE_CONTEXT ParseContext = {0};
-    PAGED_CODE();
-
-    /* Setup the object attributes */
-    InitializeObjectAttributes(&ObjectAttributes,
-                               LinkName,
-                               OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
-                               RootDirectory,
-                               SecurityDescriptor);
-    
-    /* Setup the parse context */
-    ParseContext.CreateLink = TRUE;
-    ParseContext.CreateOperation = TRUE;
-    ParseContext.ChildHive.KeyHive = &RegistryHive->Hive;
-    
-    /* Check if we have a root keycell or if we need to create it */
-    if (Allocate)
-    {
-        /* Create it */
-        ParseContext.ChildHive.KeyCell = HCELL_NIL;
-    }
-    else
-    {
-        /* We have one */
-        ParseContext.ChildHive.KeyCell = RegistryHive->Hive.BaseBlock->RootCell;   
-    }
-    
-    /* Capture all the info */
-    Status = ObpCaptureObjectAttributes(&ObjectAttributes,
-                                        KernelMode,
-                                        FALSE,
-                                        &ObjectCreateInfo,
-                                        &ObjectName);
-    if (!NT_SUCCESS(Status)) return Status;
-    
-    /* Do the parse */
-    Status = CmFindObject(&ObjectCreateInfo,
-                          &ObjectName,
-                          (PVOID*)&ParentKey,
-                          &RemainingPath,
-                          CmpKeyObjectType,
-                          NULL,
-                          NULL);
-    
-    /* Let go of captured attributes and name */
-    ObpReleaseCapturedAttributes(&ObjectCreateInfo);   
-    if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
-    
-    /* Get out of here if we failed */
-    if (!NT_SUCCESS(Status)) return Status;
-    
-    /* Scan for no name */
-    if (!(RemainingPath.Length) || (RemainingPath.Buffer[0] == UNICODE_NULL))
-    {
-        /* Fail */
-        ObDereferenceObject(ParentKey);
-        return STATUS_OBJECT_NAME_NOT_FOUND;
-    }
-    
-    /* Scan for leading backslash */
-    while ((RemainingPath.Length) &&
-           (*RemainingPath.Buffer == OBJ_NAME_PATH_SEPARATOR))
-    {
-        /* Ignore it */
-        RemainingPath.Length -= sizeof(WCHAR);
-        RemainingPath.MaximumLength -= sizeof(WCHAR);
-        RemainingPath.Buffer++;
-    }
-    
-    /* Create the link node */
-    Status = CmpCreateLinkNode(ParentKey->KeyControlBlock->KeyHive,
-                               ParentKey->KeyControlBlock->KeyCell,
-                               NULL,
-                               RemainingPath,
-                               KernelMode,
-                               0,
-                               &ParseContext,
-                               ParentKey->KeyControlBlock,
-                               (PVOID*)&NewKey);
-    if (!NT_SUCCESS(Status))
-    {
-        /* Failed */
-        DPRINT1("CmpLinkHiveToMaster failed: %lx\n", Status);
-        ObDereferenceObject(ParentKey);
-        return Status;
-    }
-    
-    /* Free the create information */
-    ObpFreeAndReleaseCapturedAttributes(OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo);
-    OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo = NULL;
-    
-    /* Mark the hive as clean */
-    RegistryHive->Hive.DirtyFlag = FALSE;
-    
-    /* Update KCB information */
-    NewKey->KeyControlBlock->KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
-    NewKey->KeyControlBlock->KeyHive = &RegistryHive->Hive;
-    
-    /* Build the key name */
-    RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, 
-                              &RemainingPath,
-                              &NewKey->Name);
-    
-    /* Reference the new key */
-    ObReferenceObject(NewKey);
-    
-    /* Link this key to the parent */
-    CmiAddKeyToList(ParentKey, NewKey);
-    return STATUS_SUCCESS;    
-}
-
-VOID
-NTAPI
-CmShutdownRegistry(VOID)
-{
-    CmShutdownSystem();
-}
-
-/* EOF */

Modified: trunk/reactos/ntoskrnl/config/cm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cm.h (original)
+++ trunk/reactos/ntoskrnl/config/cm.h Fri Nov 23 22:29:45 2007
@@ -501,10 +501,6 @@
 //
 // BUGBUG Old Hive Stuff for Temporary Support
 //
-#define SYSTEM_REG_FILE         L"\\SystemRoot\\System32\\Config\\SYSTEM"
-#define SYSTEM_LOG_FILE         L"\\SystemRoot\\System32\\Config\\SYSTEM.log"
-#define REG_SYSTEM_KEY_NAME     L"\\Registry\\Machine\\SYSTEM"
-#define REG_HARDWARE_KEY_NAME   L"\\Registry\\Machine\\HARDWARE"
 typedef struct _KEY_OBJECT
 {
     ULONG Type;
@@ -515,10 +511,19 @@
     struct _KEY_OBJECT **SubKeys;
     PCM_KEY_CONTROL_BLOCK KeyControlBlock;
 } KEY_OBJECT, *PKEY_OBJECT;
-extern PCMHIVE CmiVolatileHive;
-extern LIST_ENTRY CmiKeyObjectListHead, CmiConnectedHiveList;
-PVOID NTAPI CmpRosGetHardwareHive(OUT PULONG Length);
+NTSTATUS
+NTAPI
+CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
+             PUNICODE_STRING ObjectName,
+             PVOID* ReturnedObject,
+             PUNICODE_STRING RemainingPath,
+             POBJECT_TYPE ObjectType,
+             IN PACCESS_STATE AccessState,
+             IN PVOID ParseContext);
 NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
+VOID
+CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
+                IN PKEY_OBJECT NewKey);
 ///////////////////////////////////////////////////////////////////////////////
 
 //
@@ -1399,6 +1404,8 @@
 extern BOOLEAN CmpNoWrite;
 extern BOOLEAN CmpForceForceFlush;
 extern BOOLEAN CmpWasSetupBoot;
+extern PCMHIVE CmiVolatileHive;
+extern LIST_ENTRY CmiKeyObjectListHead;
 
 //
 // Inlined functions

Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c Fri Nov 23 22:29:45 2007
@@ -13,6 +13,12 @@
 #define NDEBUG
 #include "debug.h"
 
+POBJECT_TYPE CmpKeyObjectType;
+PCMHIVE CmiVolatileHive;
+LIST_ENTRY CmpHiveListHead;
+ERESOURCE CmpRegistryLock;
+LIST_ENTRY CmiKeyObjectListHead;
+LIST_ENTRY CmiConnectedHiveList;
 KGUARDED_MUTEX CmpSelfHealQueueLock;
 LIST_ENTRY CmpSelfHealQueueListHead;
 KEVENT CmpLoadWorkerEvent;
@@ -28,6 +34,45 @@
 BOOLEAN CmpWasSetupBoot;
 
 /* FUNCTIONS *****************************************************************/
+
+PVOID
+NTAPI
+CmpRosGetHardwareHive(OUT PULONG Length)
+{
+    PLIST_ENTRY ListHead, NextEntry;
+    PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL;
+    
+    /* Loop the memory descriptors */
+    ListHead = &KeLoaderBlock->MemoryDescriptorListHead;
+    NextEntry = ListHead->Flink;
+    while (NextEntry != ListHead)
+    {
+        /* Get the current block */
+        MdBlock = CONTAINING_RECORD(NextEntry,
+                                    MEMORY_ALLOCATION_DESCRIPTOR,
+                                    ListEntry);
+        
+        /* Check if this is an registry block */
+        if (MdBlock->MemoryType == LoaderRegistryData)
+        {
+            /* Check if it's not the SYSTEM hive that we already initialized */
+            if ((MdBlock->BasePage) !=
+                (((ULONG_PTR)KeLoaderBlock->RegistryBase &~ KSEG0_BASE) >> PAGE_SHIFT))
+            {
+                /* Hardware hive break out */
+                break;
+            }
+        }
+        
+        /* Go to the next block */
+        NextEntry = MdBlock->ListEntry.Flink;
+    }
+    
+    /* We need a hardware hive */
+    ASSERT(MdBlock);
+    *Length = MdBlock->PageCount << PAGE_SHIFT;
+    return (PVOID)((MdBlock->BasePage << PAGE_SHIFT) | KSEG0_BASE);
+}
 
 NTSTATUS
 NTAPI
@@ -443,6 +488,132 @@
     return STATUS_SUCCESS;
 }
 
+NTSTATUS
+NTAPI
+CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
+                    IN HANDLE RootDirectory,
+                    IN PCMHIVE RegistryHive,
+                    IN BOOLEAN Allocate,
+                    IN PSECURITY_DESCRIPTOR SecurityDescriptor)
+{
+    OBJECT_ATTRIBUTES ObjectAttributes;
+    UNICODE_STRING RemainingPath;
+    PKEY_OBJECT ParentKey;
+    PKEY_OBJECT NewKey;
+    NTSTATUS Status;
+    UNICODE_STRING ObjectName;
+    OBJECT_CREATE_INFORMATION ObjectCreateInfo;
+    CM_PARSE_CONTEXT ParseContext = {0};
+    PAGED_CODE();
+    
+    /* Setup the object attributes */
+    InitializeObjectAttributes(&ObjectAttributes,
+                               LinkName,
+                               OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
+                               RootDirectory,
+                               SecurityDescriptor);
+    
+    /* Setup the parse context */
+    ParseContext.CreateLink = TRUE;
+    ParseContext.CreateOperation = TRUE;
+    ParseContext.ChildHive.KeyHive = &RegistryHive->Hive;
+    
+    /* Check if we have a root keycell or if we need to create it */
+    if (Allocate)
+    {
+        /* Create it */
+        ParseContext.ChildHive.KeyCell = HCELL_NIL;
+    }
+    else
+    {
+        /* We have one */
+        ParseContext.ChildHive.KeyCell = RegistryHive->Hive.BaseBlock->RootCell;   
+    }
+    
+    /* Capture all the info */
+    Status = ObpCaptureObjectAttributes(&ObjectAttributes,
+                                        KernelMode,
+                                        FALSE,
+                                        &ObjectCreateInfo,
+                                        &ObjectName);
+    if (!NT_SUCCESS(Status)) return Status;
+    
+    /* Do the parse */
+    Status = CmFindObject(&ObjectCreateInfo,
+                          &ObjectName,
+                          (PVOID*)&ParentKey,
+                          &RemainingPath,
+                          CmpKeyObjectType,
+                          NULL,
+                          NULL);
+    
+    /* Let go of captured attributes and name */
+    ObpReleaseCapturedAttributes(&ObjectCreateInfo);   
+    if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
+    
+    /* Get out of here if we failed */
+    if (!NT_SUCCESS(Status)) return Status;
+    
+    /* Scan for no name */
+    if (!(RemainingPath.Length) || (RemainingPath.Buffer[0] == UNICODE_NULL))
+    {
+        /* Fail */
+        ObDereferenceObject(ParentKey);
+        return STATUS_OBJECT_NAME_NOT_FOUND;
+    }
+    
+    /* Scan for leading backslash */
+    while ((RemainingPath.Length) &&
+           (*RemainingPath.Buffer == OBJ_NAME_PATH_SEPARATOR))
+    {
+        /* Ignore it */
+        RemainingPath.Length -= sizeof(WCHAR);
+        RemainingPath.MaximumLength -= sizeof(WCHAR);
+        RemainingPath.Buffer++;
+    }
+    
+    /* Create the link node */
+    Status = CmpCreateLinkNode(ParentKey->KeyControlBlock->KeyHive,
+                               ParentKey->KeyControlBlock->KeyCell,
+                               NULL,
+                               RemainingPath,
+                               KernelMode,
+                               0,
+                               &ParseContext,
+                               ParentKey->KeyControlBlock,
+                               (PVOID*)&NewKey);
+    if (!NT_SUCCESS(Status))
+    {
+        /* Failed */
+        DPRINT1("CmpLinkHiveToMaster failed: %lx\n", Status);
+        ObDereferenceObject(ParentKey);
+        return Status;
+    }
+    
+    /* Free the create information */
+    ObpFreeAndReleaseCapturedAttributes(OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo);
+    OBJECT_TO_OBJECT_HEADER(NewKey)->ObjectCreateInfo = NULL;
+    
+    /* Mark the hive as clean */
+    RegistryHive->Hive.DirtyFlag = FALSE;
+    
+    /* Update KCB information */
+    NewKey->KeyControlBlock->KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
+    NewKey->KeyControlBlock->KeyHive = &RegistryHive->Hive;
+    
+    /* Build the key name */
+    RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, 
+                              &RemainingPath,
+                              &NewKey->Name);
+    
+    /* Reference the new key */
+    ObReferenceObject(NewKey);
+    
+    /* Link this key to the parent */
+    CmiAddKeyToList(ParentKey, NewKey);
+    return STATUS_SUCCESS;    
+}
+
 BOOLEAN
 NTAPI
 CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
@@ -499,7 +670,8 @@
         CmPrepareHive(&SystemHive->Hive);
 
         /* Set the hive filename */
-        RtlCreateUnicodeString(&SystemHive->FileFullPath, SYSTEM_REG_FILE);
+        RtlCreateUnicodeString(&SystemHive->FileFullPath,
+                               L"\\SystemRoot\\System32\\Config\\SYSTEM");
 
         /* We imported, no need to create a new hive */
         Allocate = FALSE;
@@ -523,7 +695,8 @@
         if (!NT_SUCCESS(Status)) return FALSE;
         
         /* Set the hive filename */
-        RtlCreateUnicodeString(&SystemHive->FileFullPath, SYSTEM_REG_FILE);
+        RtlCreateUnicodeString(&SystemHive->FileFullPath,
+                               L"\\SystemRoot\\System32\\Config\\SYSTEM");
 
         /* Tell CmpLinkHiveToMaster to allocate a hive */
         Allocate = TRUE;
@@ -552,7 +725,7 @@
     SecurityDescriptor = CmpHiveRootSecurityDescriptor();
 
     /* Attach it to the system key */
-    RtlInitUnicodeString(&KeyName, REG_SYSTEM_KEY_NAME);
+    RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SYSTEM");
     Status = CmpLinkHiveToMaster(&KeyName,
                                  NULL,
                                  (PCMHIVE)SystemHive,
@@ -736,7 +909,7 @@
 #endif
 
     /* Insert it into the object list head */
-    EnlistKeyBodyWithKeyObject(RootKey, 0);
+    InsertTailList(&CmiKeyObjectListHead, &RootKey->KeyBodyList);
 
     /* Insert the key into the namespace */
     Status = ObInsertObject(RootKey,
@@ -1309,7 +1482,7 @@
     CmpMachineHiveList[0].CmHive = (PCMHIVE)HardwareHive;
 
     /* Attach it to the machine key */
-    RtlInitUnicodeString(&KeyName, REG_HARDWARE_KEY_NAME);
+    RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE");
     Status = CmpLinkHiveToMaster(&KeyName,
                                  NULL,
                                  (PCMHIVE)HardwareHive,

Modified: trunk/reactos/ntoskrnl/ex/shutdown.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/shutdown.c?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/shutdown.c (original)
+++ trunk/reactos/ntoskrnl/ex/shutdown.c Fri Nov 23 22:29:45 2007
@@ -170,7 +170,7 @@
    Waittime.QuadPart = (LONGLONG)-10000000; /* 1sec */
    KeDelayExecutionThread(KernelMode, FALSE, &Waittime);
 
-   CmShutdownRegistry();
+   CmShutdownSystem();
    IoShutdownRegisteredFileSystems();
    IoShutdownRegisteredDevices();
 

Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Fri Nov 23 22:29:45 2007
@@ -72,9 +72,7 @@
  */
 BOOLEAN NTAPI ObInit(VOID);
 BOOLEAN NTAPI CmInitSystem1(VOID);
-VOID NTAPI CmShutdownRegistry(VOID);
-//BOOLEAN CmImportSystemHive(PCHAR ChunkBase, ULONG ChunkSize);
-//BOOLEAN CmImportHardwareHive(PCHAR ChunkBase, ULONG ChunkSize);
+VOID NTAPI CmShutdownSystem(VOID);
 BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
 
 /* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */

Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?rev=30704&r1=30703&r2=30704&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Fri Nov 23 22:29:45 2007
@@ -140,7 +140,6 @@
 	</directory>
 	<directory name="cm">
 		<file>ntfunc.c</file>
-		<file>registry.c</file>
 		<file>regobj.c</file>
 	</directory>
 	<directory name="dbgk">




More information about the Ros-diffs mailing list