2 * PROJECT: registry manipulation library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
5 * Copyright 2001 - 2005 Eric Kohl
16 HCELL_INDEX RootCellIndex
;
19 NameSize
= wcslen(Name
) * sizeof(WCHAR
);
20 RootCellIndex
= HvAllocateCell(Hive
,
21 sizeof(CM_KEY_NODE
) + NameSize
,
24 if (RootCellIndex
== HCELL_NIL
)
27 Hive
->BaseBlock
->RootCell
= RootCellIndex
;
28 Hive
->BaseBlock
->CheckSum
= HvpHiveHeaderChecksum(Hive
->BaseBlock
);
30 KeyCell
= (PCM_KEY_NODE
)HvGetCell(Hive
, RootCellIndex
);
31 KeyCell
->Id
= REG_KEY_CELL_ID
;
32 KeyCell
->Flags
= REG_KEY_ROOT_CELL
;
33 KeyCell
->LastWriteTime
.QuadPart
= 0;
34 KeyCell
->Parent
= HCELL_NIL
;
35 KeyCell
->SubKeyCounts
[0] = 0;
36 KeyCell
->SubKeyCounts
[1] = 0;
37 KeyCell
->SubKeyLists
[0] = HCELL_NIL
;
38 KeyCell
->SubKeyLists
[1] = HCELL_NIL
;
39 KeyCell
->ValueList
.Count
= 0;
40 KeyCell
->ValueList
.List
= HCELL_NIL
;
41 KeyCell
->SecurityKeyOffset
= HCELL_NIL
;
42 KeyCell
->ClassNameOffset
= HCELL_NIL
;
43 KeyCell
->NameSize
= (USHORT
)NameSize
;
44 KeyCell
->ClassSize
= 0;
45 memcpy(KeyCell
->Name
, Name
, NameSize
);
55 PCM_KEY_NODE SubKeyCell
;
56 PHASH_TABLE_CELL HashCell
;
59 ASSERT(KeyCell
->Id
== REG_KEY_CELL_ID
);
61 KeyCell
->SubKeyLists
[Volatile
] = HCELL_NIL
;
62 KeyCell
->SubKeyCounts
[Volatile
] = 0;
64 /* Enumerate and add subkeys */
65 if (KeyCell
->SubKeyCounts
[Stable
] > 0)
67 HashCell
= HvGetCell(RegistryHive
, KeyCell
->SubKeyLists
[Stable
]);
69 for (i
= 0; i
< KeyCell
->SubKeyCounts
[Stable
]; i
++)
71 SubKeyCell
= HvGetCell(RegistryHive
, HashCell
->Table
[i
].KeyOffset
);
72 CmpPrepareKey(RegistryHive
, SubKeyCell
);
81 PCM_KEY_NODE RootCell
;
83 RootCell
= HvGetCell(RegistryHive
, RegistryHive
->BaseBlock
->RootCell
);
84 CmpPrepareKey(RegistryHive
, RootCell
);