ReactOS 0.4.15-dev-8109-gd7be748
cminit.c File Reference
#include "cmlib.h"
#include <debug.h>
Include dependency graph for cminit.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN CMAPI CmCreateRootNode (PHHIVE Hive, PCWSTR Name)
 

Variables

ULONG CmlibTraceLevel = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 9 of file cminit.c.

Function Documentation

◆ CmCreateRootNode()

BOOLEAN CMAPI CmCreateRootNode ( PHHIVE  Hive,
PCWSTR  Name 
)

Definition at line 17 of file cminit.c.

20{
22 PCM_KEY_NODE KeyCell;
23 HCELL_INDEX RootCellIndex;
24
25 /* Initialize the node name and allocate it */
27 RootCellIndex = HvAllocateCell(Hive,
29 CmpNameSize(Hive, &KeyName),
30 Stable,
31 HCELL_NIL);
32 if (RootCellIndex == HCELL_NIL) return FALSE;
33
34 /* Seutp the base block */
35 Hive->BaseBlock->RootCell = RootCellIndex;
37
38 /* Get the key cell */
39 KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, RootCellIndex);
40 if (!KeyCell)
41 {
42 HvFreeCell(Hive, RootCellIndex);
43 return FALSE;
44 }
45
46 /* Setup the cell */
49 // KeQuerySystemTime(&KeyCell->LastWriteTime);
50 KeyCell->LastWriteTime.QuadPart = 0ULL;
51 KeyCell->Parent = HCELL_NIL;
52 KeyCell->SubKeyCounts[Stable] = 0;
53 KeyCell->SubKeyCounts[Volatile] = 0;
54 KeyCell->SubKeyLists[Stable] = HCELL_NIL;
55 KeyCell->SubKeyLists[Volatile] = HCELL_NIL;
56 KeyCell->ValueList.Count = 0;
57 KeyCell->ValueList.List = HCELL_NIL;
58 KeyCell->Security = HCELL_NIL;
59 KeyCell->Class = HCELL_NIL;
60 KeyCell->ClassLength = 0;
61 KeyCell->MaxNameLen = 0;
62 KeyCell->MaxClassLen = 0;
63 KeyCell->MaxValueNameLen = 0;
64 KeyCell->MaxValueDataLen = 0;
65 KeyCell->NameLength = CmpCopyName(Hive, KeyCell->Name, &KeyName);
66 if (KeyCell->NameLength < KeyName.Length) KeyCell->Flags |= KEY_COMP_NAME;
67
68 /* Return success */
69 HvReleaseCell(Hive, RootCellIndex);
70 return TRUE;
71}
struct _CM_KEY_NODE * PCM_KEY_NODE
#define KEY_COMP_NAME
Definition: cmdata.h:35
#define KEY_NO_DELETE
Definition: cmdata.h:33
#define CM_KEY_NODE_SIGNATURE
Definition: cmdata.h:21
#define KEY_HIVE_ENTRY
Definition: cmdata.h:32
#define HvReleaseCell(Hive, Cell)
Definition: cmlib.h:460
USHORT NTAPI CmpCopyName(IN PHHIVE Hive, OUT PWCHAR Destination, IN PCUNICODE_STRING Source)
Definition: cmname.c:21
ULONG CMAPI HvpHiveHeaderChecksum(PHBASE_BLOCK HiveHeader)
Definition: hivesum.c:17
USHORT NTAPI CmpNameSize(IN PHHIVE Hive, IN PCUNICODE_STRING Name)
Definition: cmname.c:74
VOID CMAPI HvFreeCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset)
Definition: hivecell.c:468
#define HvGetCell(Hive, Cell)
Definition: cmlib.h:457
HCELL_INDEX CMAPI HvAllocateCell(PHHIVE RegistryHive, ULONG Size, HSTORAGE_TYPE Storage, IN HCELL_INDEX Vicinity)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ Volatile
Definition: hivedata.h:128
@ Stable
Definition: hivedata.h:127
#define HCELL_NIL
Definition: hivedata.h:110
ULONG HCELL_INDEX
Definition: hivedata.h:105
#define ULL(a, b)
Definition: format_msg.c:27
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
HCELL_INDEX List
Definition: cmdata.h:75
ULONG Count
Definition: cmdata.h:74
USHORT Signature
Definition: cmdata.h:92
HCELL_INDEX Parent
Definition: cmdata.h:96
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:116
HCELL_INDEX SubKeyLists[HTYPE_COUNT]
Definition: cmdata.h:102
ULONG MaxValueNameLen
Definition: cmdata.h:111
ULONG MaxNameLen
Definition: cmdata.h:109
ULONG SubKeyCounts[HTYPE_COUNT]
Definition: cmdata.h:97
HCELL_INDEX Security
Definition: cmdata.h:107
USHORT NameLength
Definition: cmdata.h:114
USHORT ClassLength
Definition: cmdata.h:115
ULONG MaxClassLen
Definition: cmdata.h:110
HCELL_INDEX Class
Definition: cmdata.h:108
ULONG MaxValueDataLen
Definition: cmdata.h:112
CHILD_LIST ValueList
Definition: cmdata.h:103
USHORT Flags
Definition: cmdata.h:93
LARGE_INTEGER LastWriteTime
Definition: cmdata.h:94
HCELL_INDEX RootCell
Definition: hivedata.h:168
ULONG CheckSum
Definition: hivedata.h:183
PHBASE_BLOCK BaseBlock
Definition: hivedata.h:328
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699

Referenced by CmiInitializeHive().

Variable Documentation

◆ CmlibTraceLevel

ULONG CmlibTraceLevel = 0

Definition at line 12 of file cminit.c.