* Removed CmiLockBlock() and CmiReleaseBlock().
authorEric Kohl <eric.kohl@reactos.org>
Sat, 12 Apr 2003 15:09:57 +0000 (15:09 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 12 Apr 2003 15:09:57 +0000 (15:09 +0000)
* Added new hive flags to distinguish between volatile/non-volatile and pointer/offset hives.

svn path=/trunk/; revision=4525

reactos/ntoskrnl/cm/cm.h
reactos/ntoskrnl/cm/ntfunc.c
reactos/ntoskrnl/cm/regfile.c
reactos/ntoskrnl/cm/registry.c
reactos/ntoskrnl/cm/regobj.c

index 5e027da..69f6866 100644 (file)
@@ -263,10 +263,17 @@ typedef struct _REGISTRY_HIVE
 } REGISTRY_HIVE, *PREGISTRY_HIVE;
 
 /* REGISTRY_HIVE.Flags constants */
+/* When set, the hive is volatile. It will not be sync'ed to disk. */
 #define HIVE_VOLATILE   0x00000001
+/* When set, the hive uses pointers instead of offsets. */
+#define HIVE_POINTER    0x00000002
+/* When set, the hive is temporary. It will not be sync'ed to disk. */
+#define HIVE_TEMPORARY  0x00000004
 
 #define IsVolatileHive(Hive)(Hive->Flags & HIVE_VOLATILE)
-#define IsPermanentHive(Hive)(!(Hive->Flags & HIVE_VOLATILE))
+#define IsPointerHive(Hive)(Hive->Flags & HIVE_POINTER)
+#define IsTemporaryHive(Hive)(Hive->Flags & HIVE_TEMPORARY)
+
 
 #define IsFreeCell(Cell)(Cell->CellSize >= 0)
 #define IsUsedCell(Cell)(Cell->CellSize < 0)
@@ -523,14 +530,6 @@ CmiGetBlock(PREGISTRY_HIVE  RegistryHive,
            BLOCK_OFFSET  BlockOffset,
            OUT PHBIN * ppBin);
 
-VOID
-CmiLockBlock(PREGISTRY_HIVE  RegistryHive,
-  PVOID  Block);
-
-VOID
-CmiReleaseBlock(PREGISTRY_HIVE  RegistryHive,
-               PVOID  Block);
-
 VOID
 CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
                  BLOCK_OFFSET BlockOffset);
index 74e6dd3..e74f9dd 100644 (file)
@@ -8,9 +8,6 @@
 
 /* INCLUDES *****************************************************************/
 
-#ifdef WIN32_REGDBG
-#include "cm_win32.h"
-#else
 #include <ddk/ntddk.h>
 #include <roscfg.h>
 #include <internal/ob.h>
@@ -23,7 +20,6 @@
 #include <internal/debug.h>
 
 #include "cm.h"
-#endif
 
 
 /* GLOBALS ******************************************************************/
@@ -408,7 +404,6 @@ NtEnumerateKey(
               wcsncpy(NodeInformation->Name + SubKeyCell->NameSize ,
                       (PWCHAR) pClassData->Data,
                       SubKeyCell->ClassSize);
-              CmiReleaseBlock(RegistryHive, pClassData);
             }
         }
       break;
@@ -449,12 +444,10 @@ NtEnumerateKey(
               wcsncpy(FullInformation->Class,
                 (PWCHAR) pClassData->Data,
                 SubKeyCell->ClassSize);
-              CmiReleaseBlock(RegistryHive, pClassData);
             }
         }
       break;
     }
-  CmiReleaseBlock(RegistryHive, SubKeyCell);
 
   ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
   ObDereferenceObject(KeyObject);
@@ -592,7 +585,6 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
                 RtlCopyMemory(ValuePartialInformation->Data, 
                   DataCell->Data,
                   ValueCell->DataSize & LONG_MAX);
-                CmiReleaseBlock(RegistryHive, DataCell);
               }
               else
               {
@@ -659,7 +651,6 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
                     + ValueFullInformation->DataOffset,
                     DataCell->Data,
                     ValueCell->DataSize & LONG_MAX);
-                  CmiReleaseBlock(RegistryHive, DataCell);
                 }
               else
                 {
@@ -713,14 +704,14 @@ NtFlushKey(IN HANDLE KeyHandle)
   ExAcquireResourceExclusiveLite(&RegistryHive->HiveResource,
                                 TRUE);
 
-  if (IsPermanentHive(RegistryHive))
+  if (IsVolatileHive(RegistryHive))
     {
-      /* Flush non-volatile hive */
-      Status = CmiFlushRegistryHive(RegistryHive);
+      Status = STATUS_SUCCESS;
     }
   else
     {
-      Status = STATUS_SUCCESS;
+      /* Flush non-volatile hive */
+      Status = CmiFlushRegistryHive(RegistryHive);
     }
 
   ExReleaseResourceLite(&RegistryHive->HiveResource);
@@ -890,7 +881,6 @@ NtQueryKey(IN HANDLE KeyHandle,
               wcsncpy(NodeInformation->Name + KeyObject->NameSize * sizeof(WCHAR),
                 (PWCHAR)pClassData->Data,
                 KeyCell->ClassSize);
-              CmiReleaseBlock(RegistryHive, pClassData);
             }
           *ResultLength = sizeof(KEY_NODE_INFORMATION)
             + KeyObject->NameSize * sizeof(WCHAR)
@@ -931,7 +921,6 @@ NtQueryKey(IN HANDLE KeyHandle,
               wcsncpy(FullInformation->Class,
                 (PWCHAR)pClassData->Data,
                 KeyCell->ClassSize);
-              CmiReleaseBlock(RegistryHive, pClassData);
             }
           *ResultLength = sizeof(KEY_FULL_INFORMATION) + KeyCell->ClassSize;
         }
@@ -1068,7 +1057,6 @@ NtQueryValueKey(IN HANDLE KeyHandle,
                   RtlCopyMemory(ValuePartialInformation->Data,
                     DataCell->Data,
                     ValueCell->DataSize & LONG_MAX);
-                  CmiReleaseBlock(RegistryHive, DataCell);
                 }
               else
                 {
@@ -1133,7 +1121,6 @@ NtQueryValueKey(IN HANDLE KeyHandle,
                                 + ValueFullInformation->DataOffset,
                                 DataCell->Data,
                                 ValueCell->DataSize & LONG_MAX);
-                  CmiReleaseBlock(RegistryHive, DataCell);
                 }
               else
                 {
@@ -1267,12 +1254,11 @@ NtSetValueKey(IN HANDLE KeyHandle,
       RtlCopyMemory(DataCell->Data, Data, DataSize);
       ValueCell->DataSize = DataSize;
       ValueCell->DataType = Type;
-      CmiReleaseBlock(RegistryHive, DataCell);
 
       /* Update time of heap */
-      if (IsPermanentHive(RegistryHive))
+      if (!IsVolatileHive(RegistryHive))
        {
-         ZwQuerySystemTime((PTIME) &pBin->DateModified);
+         NtQuerySystemTime((PTIME) &pBin->DateModified);
        }
       CmiMarkBlockDirty(RegistryHive, ValueCell->DataOffset);
     }
@@ -1312,7 +1298,6 @@ NtSetValueKey(IN HANDLE KeyHandle,
       RtlCopyMemory(&NewDataCell->Data[0], Data, DataSize);
       ValueCell->DataSize = DataSize;
       ValueCell->DataType = Type;
-      CmiReleaseBlock(RegistryHive, NewDataCell);
       ValueCell->DataOffset = NewOffset;
       CmiMarkBlockDirty(RegistryHive, ValueCell->DataOffset);
     }
@@ -1326,9 +1311,9 @@ NtSetValueKey(IN HANDLE KeyHandle,
     }
 
   /* Update time of heap */
-  if (IsPermanentHive(RegistryHive) && CmiGetBlock(RegistryHive, VBOffset, &pBin))
+  if (!IsVolatileHive(RegistryHive) && CmiGetBlock(RegistryHive, VBOffset, &pBin))
     {
-      ZwQuerySystemTime((PTIME) &pBin->DateModified);
+      NtQuerySystemTime((PTIME) &pBin->DateModified);
     }
 
   ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
@@ -1502,9 +1487,12 @@ NtQueryMultipleValueKey(IN HANDLE KeyHandle,
 
          if (ValueCell->DataSize > 0)
            {
-             DataCell = CmiGetBlock(RegistryHive, ValueCell->DataOffset, NULL);
-             RtlCopyMemory(DataPtr, DataCell->Data, ValueCell->DataSize & LONG_MAX);
-             CmiReleaseBlock(RegistryHive, DataCell);
+             DataCell = CmiGetBlock(RegistryHive,
+                                    ValueCell->DataOffset,
+                                    NULL);
+             RtlCopyMemory(DataPtr,
+                           DataCell->Data,
+                           ValueCell->DataSize & LONG_MAX);
            }
          else
            {
index ff56a81..4862f5e 100644 (file)
@@ -1036,7 +1036,7 @@ CmiInitVolatileRegistryHive(PREGISTRY_HIVE RegistryHive)
 {
   PKEY_CELL RootKeyCell;
 
-  RegistryHive->Flags |= HIVE_VOLATILE;
+  RegistryHive->Flags |= (HIVE_VOLATILE | HIVE_POINTER);
 
   CmiCreateDefaultHiveHeader(RegistryHive->HiveHeader);
 
@@ -1829,12 +1829,9 @@ CmiGetMaxNameLength(PREGISTRY_HIVE  RegistryHive,
            {
              MaxName = CurSubKeyCell->NameSize;
            }
-         CmiReleaseBlock(RegistryHive, CurSubKeyCell);
        }
     }
 
-  CmiReleaseBlock(RegistryHive, HashBlock);
-
   return MaxName;
 }
 
@@ -1868,12 +1865,9 @@ CmiGetMaxClassLength(PREGISTRY_HIVE  RegistryHive,
            {
              MaxClass = CurSubKeyCell->ClassSize;
            }
-         CmiReleaseBlock(RegistryHive, CurSubKeyCell);
        }
     }
 
-  CmiReleaseBlock(RegistryHive, HashBlock);
-
   return MaxClass;
 }
 
@@ -1908,18 +1902,15 @@ CmiGetMaxValueNameLength(PREGISTRY_HIVE RegistryHive,
         {
           MaxValueName = CurValueCell->NameSize;
         }
-      CmiReleaseBlock(RegistryHive, CurValueCell);
     }
 
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-
   return MaxValueName;
 }
 
 
-ULONG  
+ULONG
 CmiGetMaxValueDataLength(PREGISTRY_HIVE RegistryHive,
-  PKEY_CELL KeyCell)
+                        PKEY_CELL KeyCell)
 {
   PVALUE_LIST_CELL ValueListCell;
   PVALUE_CELL CurValueCell;
@@ -1944,11 +1935,8 @@ CmiGetMaxValueDataLength(PREGISTRY_HIVE RegistryHive,
         {
           MaxValueData = CurValueCell->DataSize & LONG_MAX;
         }
-      CmiReleaseBlock(RegistryHive, CurValueCell);
     }
 
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-  
   return MaxValueData;
 }
 
@@ -1973,10 +1961,10 @@ CmiScanForSubKey(IN PREGISTRY_HIVE RegistryHive,
 
   assert(RegistryHive);
 
+  *SubKeyCell = NULL;
   KeyLength = strlen(KeyName);
 
   HashBlock = CmiGetBlock(RegistryHive, KeyCell->HashTableOffset, NULL);
-  *SubKeyCell = NULL;
   if (HashBlock == NULL)
     {
       return STATUS_SUCCESS;
@@ -2001,10 +1989,6 @@ CmiScanForSubKey(IN PREGISTRY_HIVE RegistryHive,
                   *BlockOffset = HashBlock->Table[i].KeyOffset;
                   break;
                 }
-              else
-                {
-                  CmiReleaseBlock(RegistryHive, CurSubKeyCell);
-                }
             }
         }
       else
@@ -2022,16 +2006,10 @@ CmiScanForSubKey(IN PREGISTRY_HIVE RegistryHive,
                   *BlockOffset = HashBlock->Table[i].KeyOffset;
                   break;
                 }
-              else
-                {
-                  CmiReleaseBlock(RegistryHive, CurSubKeyCell);
-                }
             }
         }
     }
-  
-  CmiReleaseBlock(RegistryHive, HashBlock);
-  
+
   return STATUS_SUCCESS;
 }
 
@@ -2119,8 +2097,8 @@ CmiAddSubKey(PREGISTRY_HIVE RegistryHive,
   SubKey->KeyCell = NewKeyCell;
   SubKey->BlockOffset = NKBOffset;
 
-  /* Don't modify hash table if key is volatile and parent is not */
-  if (IsVolatileHive(RegistryHive) && (!IsVolatileHive(Parent->RegistryHive)))
+  /* Don't modify hash table if key is located in a pointer-based hive and parent key is not */
+  if (IsPointerHive(RegistryHive) && (!IsPointerHive(Parent->RegistryHive)))
     {
       return(Status);
     }
@@ -2327,10 +2305,9 @@ CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
   PVALUE_CELL CurValueCell;
   ULONG i;
 
-  ValueListCell = CmiGetBlock(RegistryHive, KeyCell->ValuesOffset, NULL);
-
   *ValueCell = NULL;
 
+  ValueListCell = CmiGetBlock(RegistryHive, KeyCell->ValuesOffset, NULL);
   if (ValueListCell == NULL)
     {
       DPRINT("ValueListCell is NULL\n");
@@ -2357,11 +2334,8 @@ CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
          //DPRINT("Found value %s\n", ValueName);
          break;
        }
-      CmiReleaseBlock(RegistryHive, CurValueCell);
     }
 
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-
   return STATUS_SUCCESS;
 }
 
@@ -2375,10 +2349,9 @@ CmiGetValueFromKeyByIndex(IN PREGISTRY_HIVE RegistryHive,
   PVALUE_LIST_CELL ValueListCell;
   PVALUE_CELL CurValueCell;
 
-  ValueListCell = CmiGetBlock(RegistryHive, KeyCell->ValuesOffset, NULL);
-
   *ValueCell = NULL;
 
+  ValueListCell = CmiGetBlock(RegistryHive, KeyCell->ValuesOffset, NULL);
   if (ValueListCell == NULL)
     {
       return STATUS_NO_MORE_ENTRIES;
@@ -2392,17 +2365,13 @@ CmiGetValueFromKeyByIndex(IN PREGISTRY_HIVE RegistryHive,
     }
 
   CurValueCell = CmiGetBlock(RegistryHive,
-    ValueListCell->Values[Index],
-    NULL);
-
+                            ValueListCell->Values[Index],
+                            NULL);
   if (CurValueCell != NULL)
     {
       *ValueCell = CurValueCell;
     }
 
-  CmiReleaseBlock(RegistryHive, CurValueCell);
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-
   return STATUS_SUCCESS;
 }
 
@@ -2421,12 +2390,12 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
   BLOCK_OFFSET VBOffset;
   NTSTATUS Status;
 
+  *pVBOffset = VBOffset;
+
   Status = CmiAllocateValueCell(RegistryHive,
                                &NewValueCell,
                                &VBOffset,
                                ValueName);
-  *pVBOffset = VBOffset;
-
   if (!NT_SUCCESS(Status))
     {
       return Status;
@@ -2478,8 +2447,7 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
 
   ValueListCell->Values[KeyCell->NumberOfValues] = VBOffset;
   KeyCell->NumberOfValues++;
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-  CmiReleaseBlock(RegistryHive, NewValueCell);
+
   *pValueCell = NewValueCell;
 
   return STATUS_SUCCESS;
@@ -2517,25 +2485,22 @@ CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
        {
          CmiDestroyValueCell(RegistryHive, CurValueCell, ValueListCell->Values[i]);
 
-          if ((KeyCell->NumberOfValues - 1) < i)
-            {
-              RtlCopyMemory(&ValueListCell->Values[i],
-                &ValueListCell->Values[i + 1],
-                sizeof(BLOCK_OFFSET) * (KeyCell->NumberOfValues - 1 - i));
-            }
-          else
-            {
-              RtlZeroMemory(&ValueListCell->Values[i], sizeof(BLOCK_OFFSET));
-            }
+         if ((KeyCell->NumberOfValues - 1) < i)
+           {
+             RtlCopyMemory(&ValueListCell->Values[i],
+                           &ValueListCell->Values[i + 1],
+                           sizeof(BLOCK_OFFSET) * (KeyCell->NumberOfValues - 1 - i));
+           }
+         else
+           {
+             RtlZeroMemory(&ValueListCell->Values[i], sizeof(BLOCK_OFFSET));
+           }
 
-          KeyCell->NumberOfValues -= 1;
-          break;
+         KeyCell->NumberOfValues -= 1;
+         break;
        }
-      CmiReleaseBlock(RegistryHive, CurValueCell);
     }
 
-  CmiReleaseBlock(RegistryHive, ValueListCell);
-
   if (KeyCell->NumberOfValues == 0)
     {
       CmiDestroyBlock(RegistryHive,
@@ -2600,7 +2565,7 @@ CmiGetKeyFromHashByIndex(PREGISTRY_HIVE RegistryHive,
   if (HashBlock == NULL)
     return NULL;
 
-  if (IsVolatileHive(RegistryHive))
+  if (IsPointerHive(RegistryHive))
     {
       KeyCell = (PKEY_CELL) HashBlock->Table[Index].KeyOffset;
     }
@@ -2609,7 +2574,6 @@ CmiGetKeyFromHashByIndex(PREGISTRY_HIVE RegistryHive,
       KeyOffset =  HashBlock->Table[Index].KeyOffset;
       KeyCell = CmiGetBlock(RegistryHive, KeyOffset, NULL);
     }
-  CmiLockBlock(RegistryHive, KeyCell);
 
   return KeyCell;
 }
@@ -2738,17 +2702,17 @@ CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
        }
 
       /* Update time of heap */
-      if (IsPermanentHive(RegistryHive))
-       ZwQuerySystemTime((PTIME) &pBin->DateModified);
+      if (!IsVolatileHive(RegistryHive))
+       NtQuerySystemTime((PTIME) &pBin->DateModified);
     }
 
   /* Destroy the value cell */
   Status = CmiDestroyBlock(RegistryHive, ValueCell, VBOffset);
 
   /* Update time of heap */
-  if (IsPermanentHive(RegistryHive) && CmiGetBlock(RegistryHive, VBOffset, &pBin))
+  if (!IsVolatileHive(RegistryHive) && CmiGetBlock(RegistryHive, VBOffset, &pBin))
     {
-      ZwQuerySystemTime((PTIME) &pBin->DateModified);
+      NtQuerySystemTime((PTIME) &pBin->DateModified);
     }
 
   return Status;
@@ -2833,8 +2797,6 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive,
   if (NewBlockOffset)
     *NewBlockOffset = tmpBin->BlockOffset + REG_HBIN_DATA_OFFSET;
 
-  /* FIXME: set first dword to block_offset of another free bloc */
-
   /* Mark new bin dirty */
   CmiMarkBinDirty(RegistryHive,
                  tmpBin->BlockOffset);
@@ -2859,7 +2821,7 @@ CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
   BlockSize = (BlockSize + sizeof(DWORD) + 15) & 0xfffffff0;
 
   /* Handle volatile hives first */
-  if (IsVolatileHive(RegistryHive))
+  if (IsPointerHive(RegistryHive))
     {
       NewBlock = ExAllocatePool(NonPagedPool, BlockSize);
 
@@ -2871,7 +2833,6 @@ CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
        {
          RtlZeroMemory(NewBlock, BlockSize);
          NewBlock->CellSize = BlockSize;
-         CmiLockBlock(RegistryHive, NewBlock);
          *Block = NewBlock;
          if (pBlockOffset)
            *pBlockOffset = (BLOCK_OFFSET) NewBlock;
@@ -2898,7 +2859,7 @@ CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
 
              if (Temp)
                {
-                 ZwQuerySystemTime((PTIME) &pBin->DateModified);
+                 NtQuerySystemTime((PTIME) &pBin->DateModified);
                  CmiMarkBlockDirty(RegistryHive, RegistryHive->FreeListOffset[i]);
                }
 
@@ -2948,7 +2909,6 @@ CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
 
          RtlZeroMemory(*Block, BlockSize);
          ((PCELL_HEADER) (*Block))->CellSize = -BlockSize;
-         CmiLockBlock(RegistryHive, *Block);
        }
     }
 
@@ -2958,17 +2918,16 @@ CmiAllocateBlock(PREGISTRY_HIVE RegistryHive,
 
 NTSTATUS
 CmiDestroyBlock(PREGISTRY_HIVE RegistryHive,
-  PVOID Block,
-  BLOCK_OFFSET Offset)
+               PVOID Block,
+               BLOCK_OFFSET Offset)
 {
   NTSTATUS Status;
   PHBIN pBin;
 
   Status = STATUS_SUCCESS;
 
-  if (IsVolatileHive(RegistryHive))
+  if (IsPointerHive(RegistryHive))
     {
-      CmiReleaseBlock(RegistryHive, Block);
       ExFreePool(Block);
     }
   else
@@ -2982,18 +2941,14 @@ CmiDestroyBlock(PREGISTRY_HIVE RegistryHive,
       RtlZeroMemory(((PVOID)pFree) + sizeof(ULONG),
                    pFree->CellSize - sizeof(ULONG));
 
-      /* add block to the list of free blocks */
+      /* Add block to the list of free blocks */
       CmiAddFree(RegistryHive, Block, Offset, TRUE);
-      CmiReleaseBlock(RegistryHive, Block);
 
       /* Update time of heap */
-      if (IsPermanentHive(RegistryHive) && CmiGetBlock(RegistryHive, Offset,&pBin))
-       ZwQuerySystemTime((PTIME) &pBin->DateModified);
+      if (!IsVolatileHive(RegistryHive) && CmiGetBlock(RegistryHive, Offset,&pBin))
+       NtQuerySystemTime((PTIME) &pBin->DateModified);
 
       CmiMarkBlockDirty(RegistryHive, Offset);
-
-      /* FIXME: Set first dword to block_offset of another free block ? */
-      /* FIXME: Concatenate with previous and next block if free */
     }
 
   return Status;
@@ -3212,7 +3167,7 @@ CmiGetBlock(PREGISTRY_HIVE RegistryHive,
   if ((BlockOffset == 0) || (BlockOffset == (ULONG_PTR) -1))
     return NULL;
 
-  if (IsVolatileHive(RegistryHive))
+  if (IsPointerHive(RegistryHive))
     {
       return (PVOID) BlockOffset;
     }
@@ -3228,28 +3183,6 @@ CmiGetBlock(PREGISTRY_HIVE RegistryHive,
 }
 
 
-VOID
-CmiLockBlock(PREGISTRY_HIVE RegistryHive,
-            PVOID Block)
-{
-  if (IsPermanentHive(RegistryHive))
-    {
-      /* FIXME: Implement */
-    }
-}
-
-
-VOID
-CmiReleaseBlock(PREGISTRY_HIVE RegistryHive,
-               PVOID Block)
-{
-  if (IsPermanentHive(RegistryHive))
-    {
-      /* FIXME: Implement */
-    }
-}
-
-
 VOID
 CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
                  BLOCK_OFFSET BlockOffset)
@@ -3260,7 +3193,7 @@ CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
   ULONG BlockCount;
 
   if (IsVolatileHive(RegistryHive))
-      return;
+    return;
 
   DPRINT("CmiMarkBlockDirty(Offset 0x%lx)\n", (ULONG)BlockOffset);
 
@@ -3298,7 +3231,7 @@ CmiMarkBinDirty(PREGISTRY_HIVE RegistryHive,
   PHBIN Bin;
 
   if (IsVolatileHive(RegistryHive))
-      return;
+    return;
 
   DPRINT("CmiMarkBinDirty(Offset 0x%lx)\n", (ULONG)BinOffset);
 
index 91b221a..e48ce8d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: registry.c,v 1.91 2003/04/04 21:52:25 hbirr Exp $
+/* $Id: registry.c,v 1.92 2003/04/12 15:09:57 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -1061,7 +1061,7 @@ CmShutdownRegistry(VOID)
     {
       Hive = CONTAINING_RECORD(Entry, REGISTRY_HIVE, HiveList);
 
-      if (IsPermanentHive(Hive))
+      if (!IsVolatileHive(Hive))
        {
          /* Acquire hive resource exclusively */
          ExAcquireResourceExclusiveLite(&Hive->HiveResource,
@@ -1102,7 +1102,7 @@ CmiHiveSyncRoutine(PVOID DeferredContext)
     {
       Hive = CONTAINING_RECORD(Entry, REGISTRY_HIVE, HiveList);
 
-      if (IsPermanentHive(Hive))
+      if (!IsVolatileHive(Hive))
        {
          /* Acquire hive resource exclusively */
          ExAcquireResourceExclusiveLite(&Hive->HiveResource,
index 508ac5d..9a6d9cb 100644 (file)
@@ -6,9 +6,6 @@
  * UPDATE HISTORY:
 */
 
-#ifdef WIN32_REGDBG
-#include "cm_win32.h"
-#else
 #include <ddk/ntddk.h>
 #include <roscfg.h>
 #include <internal/ob.h>
@@ -22,7 +19,6 @@
 #include <internal/debug.h>
 
 #include "cm.h"
-#endif
 
 
 static NTSTATUS
@@ -209,16 +205,8 @@ CmiObjectParse(PVOID ParsedObject,
                                 NULL,
                                 UserMode);
     }
-#ifndef WIN32_REGDBG
+
   DPRINT("CmiObjectParse: %s\n", FoundObject->Name);
-#else
-  {
-      char buffer[_BUFFER_LEN];
-      memset(buffer, 0, _BUFFER_LEN);
-      strncpy(buffer, FoundObject->Name, min(FoundObject->NameSize, _BUFFER_LEN - 1));
-      DPRINT("CmiObjectParse: %s\n", buffer);
-  }
-#endif
 
   *Path = EndPtr;
 
@@ -283,12 +271,10 @@ CmiObjectDelete(PVOID DeletedObject)
                      KeyObject->ParentKey,
                      KeyObject);
 
-      if (IsPermanentHive(KeyObject->RegistryHive))
-       CmiSyncHives();
-    }
-  else
-    {
-      CmiReleaseBlock(KeyObject->RegistryHive, KeyObject->KeyCell);
+      if (!IsVolatileHive(KeyObject->RegistryHive))
+       {
+         CmiSyncHives();
+       }
     }
 }
 
@@ -393,17 +379,8 @@ CmiScanKeyList(PKEY_OBJECT Parent,
   WORD NameSize;
   DWORD Index;
 
-#ifndef WIN32_REGDBG
   DPRINT("Scanning key list for: %s (Parent: %s)\n",
     KeyName, Parent->Name);
-#else
-  {
-      char buffer[_BUFFER_LEN];
-      memset(buffer, 0, _BUFFER_LEN);
-      strncpy(buffer, Parent->Name, min(Parent->NameSize, _BUFFER_LEN - 1));
-      DPRINT("Scanning key list for: %s (Parent: %s)\n", KeyName, buffer);
-  }
-#endif
 
   NameSize = strlen(KeyName);
   KeAcquireSpinLock(&CmiKeyListLock, &OldIrql);
@@ -431,7 +408,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
        }
     }
   KeReleaseSpinLock(&CmiKeyListLock, OldIrql);
-  
+
   return NULL;
 }
 
@@ -484,7 +461,6 @@ CmiGetLinkTarget(PREGISTRY_HIVE RegistryHive,
                    DataCell->Data,
                    TargetPath->Length);
       TargetPath->Buffer[TargetPath->Length / sizeof(WCHAR)] = 0;
-      CmiReleaseBlock(RegistryHive, DataCell);
     }
   else
     {