From ee6bd345aa8cb7b06f7a160721ffae7b22a23ccc Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 22 Nov 2005 00:29:22 +0000 Subject: [PATCH] Fix some registry structures to match the Windows format. svn path=/trunk/; revision=19437 --- .../boot/freeldr/freeldr/reactos/binhive.c | 49 +++++++++---------- reactos/ntoskrnl/cm/cm.h | 29 ++++++----- reactos/ntoskrnl/cm/regfile.c | 44 ++++++++--------- reactos/tools/mkhive/binhive.c | 41 +++++++--------- 4 files changed, 77 insertions(+), 86 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/reactos/binhive.c b/reactos/boot/freeldr/freeldr/reactos/binhive.c index b3558696097..f9ea51ffa4d 100644 --- a/reactos/boot/freeldr/freeldr/reactos/binhive.c +++ b/reactos/boot/freeldr/freeldr/reactos/binhive.c @@ -57,19 +57,20 @@ typedef struct _HIVE_HEADER ULONG UpdateCounter2; /* When this hive file was last modified */ - ULONGLONG DateModified; /* FILETIME */ + ULONGLONG DateModified; - /* Registry format version ? (1?) */ - ULONG Unused3; + /* Registry format major version (1) */ + ULONG MajorVersion; - /* Registry format version ? (3?) */ - ULONG Unused4; + /* Registry format minor version (3) + Version 3 added fast indexes, version 5 has large value optimizations */ + ULONG MinorVersion; - /* Registry format version ? (0?) */ - ULONG Unused5; + /* Registry file type (0 - Primary, 1 - Log) */ + ULONG Type; - /* Registry format version ? (1?) */ - ULONG Unused6; + /* Registry format (1 is the only defined value so far) */ + ULONG Format; /* Offset into file from the byte after the end of the base block. If the hive is volatile, this is the actual pointer to the KEY_CELL */ @@ -82,10 +83,9 @@ typedef struct _HIVE_HEADER ULONG Unused7; /* Name of hive file */ - WCHAR FileName[64]; + WCHAR FileName[48]; - /* ? */ - ULONG Unused8[83]; + ULONG Reserved[99]; /* Checksum of first 0x200 bytes */ ULONG Checksum; @@ -97,20 +97,19 @@ typedef struct _BIN_HEADER /* Bin identifier "hbin" (0x6E696268) */ ULONG HeaderId; - /* Bin offset */ + /* Block offset of this bin */ BLOCK_OFFSET BinOffset; /* Size in bytes, multiple of the block size (4KB) */ ULONG BinSize; - /* ? */ - ULONG Unused1; + ULONG Reserved[2]; /* When this bin was last modified */ - ULONGLONG DateModified; /* FILETIME */ + ULONGLONG DateModified; - /* ? */ - ULONG Unused2; + /* ? (In-memory only) */ + ULONG MemAlloc; } __attribute__((packed)) HBIN, *PHBIN; @@ -298,15 +297,14 @@ CmiCreateDefaultHiveHeader (PHIVE_HEADER Header) Header->BlockId = REG_HIVE_ID; Header->UpdateCounter1 = 0; Header->UpdateCounter2 = 0; - Header->DateModified = 0ULL; - Header->Unused3 = 1; - Header->Unused4 = 3; - Header->Unused5 = 0; - Header->Unused6 = 1; + Header->DateModified = 0; + Header->MajorVersion = 1; + Header->MinorVersion = 3; + Header->Type = 0; + Header->Format = 1; Header->Unused7 = 1; Header->RootKeyOffset = -1; Header->BlockSize = REG_BLOCK_SIZE; - Header->Unused6 = 1; Header->Checksum = 0; } @@ -717,9 +715,8 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, tmpBin->BinOffset = RegistryHive->FileSize - REG_BLOCK_SIZE; RegistryHive->FileSize += BinSize; tmpBin->BinSize = BinSize; - tmpBin->Unused1 = 0; tmpBin->DateModified = 0ULL; - tmpBin->Unused2 = 0; + tmpBin->MemAlloc = 0; /* Increase size of list of blocks */ BlockList = MmAllocateMemory (sizeof(PHBIN) * (RegistryHive->BlockListSize + BlockCount)); diff --git a/reactos/ntoskrnl/cm/cm.h b/reactos/ntoskrnl/cm/cm.h index e945b5cee10..fd340162c68 100644 --- a/reactos/ntoskrnl/cm/cm.h +++ b/reactos/ntoskrnl/cm/cm.h @@ -70,17 +70,18 @@ typedef struct _HIVE_HEADER /* When this hive file was last modified */ LARGE_INTEGER DateModified; - /* Registry format version ? (1?) */ - ULONG Unused3; + /* Registry format major version (1) */ + ULONG MajorVersion; - /* Registry format version ? (3?) */ - ULONG Unused4; + /* Registry format minor version (3) + Version 3 added fast indexes, version 5 has large value optimizations */ + ULONG MinorVersion; - /* Registry format version ? (0?) */ - ULONG Unused5; + /* Registry file type (0 - Primary, 1 - Log) */ + ULONG Type; - /* Registry format version ? (1?) */ - ULONG Unused6; + /* Registry format (1 is the only defined value so far) */ + ULONG Format; /* Offset into file from the byte after the end of the base block. If the hive is volatile, this is the actual pointer to the KEY_CELL */ @@ -93,10 +94,9 @@ typedef struct _HIVE_HEADER ULONG Unused7; /* Name of hive file */ - WCHAR FileName[64]; + WCHAR FileName[48]; - /* ? */ - ULONG Unused8[83]; + ULONG Reserved[99]; /* Checksum of first 0x200 bytes */ ULONG Checksum; @@ -113,14 +113,13 @@ typedef struct _BIN_HEADER /* Size in bytes, multiple of the block size (4KB) */ ULONG BinSize; - /* ? */ - ULONG Unused1; + ULONG Reserved[2]; /* When this bin was last modified */ LARGE_INTEGER DateModified; - /* ? */ - ULONG Unused2; + /* ? (In-memory only) */ + ULONG MemAlloc; } HBIN, *PHBIN; typedef struct _CELL_HEADER diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index c73b659283b..237638af3f4 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -39,14 +39,13 @@ CmiCreateDefaultHiveHeader(PHIVE_HEADER Header) Header->UpdateCounter2 = 0; Header->DateModified.u.LowPart = 0; Header->DateModified.u.HighPart = 0; - Header->Unused3 = 1; - Header->Unused4 = 3; - Header->Unused5 = 0; - Header->Unused6 = 1; + Header->MajorVersion = 1; + Header->MinorVersion = 3; + Header->Type = 0; + Header->Format = 1; Header->Unused7 = 1; Header->RootKeyOffset = (BLOCK_OFFSET)-1; Header->BlockSize = REG_BLOCK_SIZE; - Header->Unused6 = 1; Header->Checksum = 0; } @@ -297,32 +296,32 @@ CmiVerifyHiveHeader(PHIVE_HEADER Header) ASSERT(Header->BlockId == REG_HIVE_ID); } - if (Header->Unused3 != 1) + if (Header->MajorVersion != 1) { - DbgPrint("Unused3 is %.08x (must be 1)\n", - Header->Unused3); - ASSERT(Header->Unused3 == 1); + DbgPrint("MajorVersion is %.08x (must be 1)\n", + Header->MajorVersion); + ASSERT(Header->MajorVersion == 1); } - if (Header->Unused4 != 3) + if (Header->MinorVersion != 3) { - DbgPrint("Unused4 is %.08x (must be 3)\n", - Header->Unused4); - ASSERT(Header->Unused4 == 3); + DbgPrint("MinorVersion is %.08x (must be 3)\n", + Header->MajorVersion); + ASSERT(Header->MajorVersion == 3); } - if (Header->Unused5 != 0) + if (Header->Type != 0) { - DbgPrint("Unused5 is %.08x (must be 0)\n", - Header->Unused5); - ASSERT(Header->Unused5 == 0); + DbgPrint("Type is %.08x (must be 0)\n", + Header->Type); + ASSERT(Header->Type == 0); } - if (Header->Unused6 != 1) + if (Header->Format != 1) { - DbgPrint("Unused6 is %.08x (must be 1)\n", - Header->Unused6); - ASSERT(Header->Unused6 == 1); + DbgPrint("Format is %.08x (must be 1)\n", + Header->Format); + ASSERT(Header->Format == 1); } if (Header->Unused7 != 1) @@ -3252,9 +3251,8 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, tmpBin->BinOffset = RegistryHive->FileSize - REG_BLOCK_SIZE; RegistryHive->FileSize += BinSize; tmpBin->BinSize = BinSize; - tmpBin->Unused1 = 0; KeQuerySystemTime(&tmpBin->DateModified); - tmpBin->Unused2 = 0; + tmpBin->MemAlloc = 0; DPRINT (" BinOffset %lx BinSize %lx\n", tmpBin->BinOffset,tmpBin->BinSize); diff --git a/reactos/tools/mkhive/binhive.c b/reactos/tools/mkhive/binhive.c index ddf3a47c87a..6b999f50c1d 100644 --- a/reactos/tools/mkhive/binhive.c +++ b/reactos/tools/mkhive/binhive.c @@ -83,17 +83,18 @@ typedef struct _HIVE_HEADER /* When this hive file was last modified */ FILETIME DateModified; - /* Registry format version ? (1?) */ - ULONG Unused3; + /* Registry format major version (1) */ + ULONG MajorVersion; - /* Registry format version ? (3?) */ - ULONG Unused4; + /* Registry format minor version (3) + Version 3 added fast indexes, version 5 has large value optimizations */ + ULONG MinorVersion; - /* Registry format version ? (0?) */ - ULONG Unused5; + /* Registry file type (0 - Primary, 1 - Log) */ + ULONG Type; - /* Registry format version ? (1?) */ - ULONG Unused6; + /* Registry format (1 is the only defined value so far) */ + ULONG Format; /* Offset into file from the byte after the end of the base block. If the hive is volatile, this is the actual pointer to the KEY_CELL */ @@ -106,10 +107,9 @@ typedef struct _HIVE_HEADER ULONG Unused7; /* Name of hive file */ - WCHAR FileName[64]; + WCHAR FileName[48]; - /* ? */ - ULONG Unused8[83]; + ULONG Reserved[99]; /* Checksum of first 0x200 bytes */ ULONG Checksum; @@ -126,14 +126,13 @@ typedef struct _HBIN /* Size in bytes, multiple of the block size (4KB) */ ULONG BinSize; - /* ? */ - ULONG Unused1; + ULONG Reserved[2]; /* When this bin was last modified */ FILETIME DateModified; - /* ? */ - ULONG Unused2; + /* ? (In-memory only) */ + ULONG MemAlloc; } GCC_PACKED HBIN, *PHBIN; typedef struct _CELL_HEADER @@ -292,14 +291,13 @@ CmiCreateDefaultHiveHeader (PHIVE_HEADER Header) Header->UpdateCounter1 = 0; Header->UpdateCounter2 = 0; Header->DateModified = 0; - Header->Unused3 = 1; - Header->Unused4 = 3; - Header->Unused5 = 0; - Header->Unused6 = 1; + Header->MajorVersion = 1; + Header->MinorVersion = 3; + Header->Type = 0; + Header->Format = 1; Header->Unused7 = 1; Header->RootKeyOffset = -1; Header->BlockSize = REG_BLOCK_SIZE; - Header->Unused6 = 1; Header->Checksum = 0; } @@ -736,9 +734,8 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, tmpBin->BinOffset = RegistryHive->FileSize - REG_BLOCK_SIZE; RegistryHive->FileSize += BinSize; tmpBin->BinSize = BinSize; - tmpBin->Unused1 = 0; tmpBin->DateModified = 0; - tmpBin->Unused2 = 0; + tmpBin->MemAlloc = 0; /* Increase size of list of blocks */ tmpBlockList = malloc (sizeof(PHBIN) * (RegistryHive->BlockListSize + BlockCount)); -- 2.17.1