mirror of
https://github.com/reactos/reactos.git
synced 2024-07-30 16:18:43 +00:00
- Save hive flags instead of ignoring them (but ignore no lazy flush for now).
- Get rid of CmiKeyObjectListHead and code that was adding/removing entries into it, it wasn't used for anything. - Change the stupid subkey array (which caused pool fragmentation and slow-downs) with a linked-list version, since we never used the array for random indexing (the point of an array vs a linked list). - Link key object children to parent key control blocks so that KCBs now own PKEY_OBJECTs (will help with parsing later). - Get rid of CmiAddKeyToList since this is just an InsertTailList now. - Remove ReactOS hacks in flush code. - Do full parallel hive loading code in normal boot too, not just in cd-rom boot: CmpSetFileSize was causing the problem to happen so it's been disabled for now; this allowed removal of multiple ReactOS hacks. - Use the "Allocate" flag during linking instead of hard-coding FALSE, since this also works now. - Set HIVE_NOLAZYFLUSH to newly create hives since this is required for later. - Remove CmiConnectedHiveList since it's not used for anything. svn path=/trunk/; revision=31030
This commit is contained in:
parent
60b1915ae7
commit
6dea234022
|
@ -460,6 +460,7 @@ HvInitialize(
|
||||||
Hive->StorageTypeCount = HTYPE_COUNT;
|
Hive->StorageTypeCount = HTYPE_COUNT;
|
||||||
Hive->Cluster = 1;
|
Hive->Cluster = 1;
|
||||||
Hive->Version = HSYS_MINOR;
|
Hive->Version = HSYS_MINOR;
|
||||||
|
Hive->HiveFlags = HiveFlags &~ HIVE_NOLAZYFLUSH;
|
||||||
|
|
||||||
switch (Operation)
|
switch (Operation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,14 +4,9 @@
|
||||||
#include "ntoskrnl/config/cm.h"
|
#include "ntoskrnl/config/cm.h"
|
||||||
|
|
||||||
extern POBJECT_TYPE CmpKeyObjectType;
|
extern POBJECT_TYPE CmpKeyObjectType;
|
||||||
extern KSPIN_LOCK CmiKeyListLock;
|
|
||||||
extern ERESOURCE CmpRegistryLock;
|
extern ERESOURCE CmpRegistryLock;
|
||||||
extern EX_PUSH_LOCK CmpHiveListHeadLock;
|
extern EX_PUSH_LOCK CmpHiveListHeadLock;
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
|
|
||||||
IN PVOID Argument2);
|
|
||||||
|
|
||||||
#define VERIFY_BIN_HEADER(x) ASSERT(x->HeaderId == REG_BIN_ID)
|
#define VERIFY_BIN_HEADER(x) ASSERT(x->HeaderId == REG_BIN_ID)
|
||||||
#define VERIFY_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE)
|
#define VERIFY_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE)
|
||||||
#define VERIFY_ROOT_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE)
|
#define VERIFY_ROOT_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE)
|
||||||
|
|
|
@ -175,7 +175,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
KeyObject->KeyControlBlock->ValueCache.Count = Node->ValueList.Count;
|
KeyObject->KeyControlBlock->ValueCache.Count = Node->ValueList.Count;
|
||||||
|
|
||||||
/* Link child to parent */
|
/* Link child to parent */
|
||||||
CmiAddKeyToList(Parent, KeyObject);
|
CmiAddKeyToList(Parent->KeyControlBlock, KeyObject);
|
||||||
|
|
||||||
/* Create the actual handle to the object */
|
/* Create the actual handle to the object */
|
||||||
Status = CmpCreateHandle(KeyObject,
|
Status = CmpCreateHandle(KeyObject,
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
#include "cm.h"
|
#include "cm.h"
|
||||||
|
|
||||||
extern LIST_ENTRY CmiKeyObjectListHead;
|
|
||||||
extern ULONG CmiTimer;
|
extern ULONG CmiTimer;
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
@ -440,22 +439,18 @@ Next:
|
||||||
|
|
||||||
/* Preconditions: Must be called with CmpRegistryLock held. */
|
/* Preconditions: Must be called with CmpRegistryLock held. */
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CmiScanKeyList(PKEY_OBJECT Parent,
|
CmiScanKeyList(PCM_KEY_CONTROL_BLOCK Parent,
|
||||||
PCUNICODE_STRING KeyName,
|
PCUNICODE_STRING KeyName,
|
||||||
ULONG Attributes,
|
ULONG Attributes,
|
||||||
PKEY_OBJECT* ReturnedObject)
|
PKEY_OBJECT* ReturnedObject)
|
||||||
{
|
{
|
||||||
PKEY_OBJECT CurKey = NULL;
|
PKEY_OBJECT CurKey = NULL;
|
||||||
ULONG Index;
|
PLIST_ENTRY NextEntry;
|
||||||
|
|
||||||
DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
|
NextEntry = Parent->KeyBodyListHead.Flink;
|
||||||
KeyName, &Parent->Name);
|
while (NextEntry != &Parent->KeyBodyListHead)
|
||||||
|
|
||||||
/* FIXME: if list maintained in alphabetic order, use dichotomic search */
|
|
||||||
/* (a binary search) */
|
|
||||||
for (Index=0; Index < Parent->SubKeyCounts; Index++)
|
|
||||||
{
|
{
|
||||||
CurKey = Parent->SubKeys[Index];
|
CurKey = CONTAINING_RECORD(NextEntry, KEY_OBJECT, KeyBodyEntry);
|
||||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||||
{
|
{
|
||||||
DPRINT("Comparing %wZ and %wZ\n", KeyName, &CurKey->Name);
|
DPRINT("Comparing %wZ and %wZ\n", KeyName, &CurKey->Name);
|
||||||
|
@ -473,9 +468,11 @@ CmiScanKeyList(PKEY_OBJECT Parent,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index < Parent->SubKeyCounts)
|
if (NextEntry != &Parent->KeyBodyListHead)
|
||||||
{
|
{
|
||||||
if (CurKey->KeyControlBlock->Delete)
|
if (CurKey->KeyControlBlock->Delete)
|
||||||
{
|
{
|
||||||
|
@ -588,7 +585,7 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
|
ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
|
||||||
|
|
||||||
Status = CmiScanKeyList(ParsedKey,
|
Status = CmiScanKeyList(ParsedKey->KeyControlBlock,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
Attributes,
|
Attributes,
|
||||||
&FoundObject);
|
&FoundObject);
|
||||||
|
@ -722,9 +719,8 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
|
|
||||||
FoundObject->KeyControlBlock = Kcb;
|
FoundObject->KeyControlBlock = Kcb;
|
||||||
ASSERT(FoundObject->KeyControlBlock->KeyHive == ParsedKey->KeyControlBlock->KeyHive);
|
ASSERT(FoundObject->KeyControlBlock->KeyHive == ParsedKey->KeyControlBlock->KeyHive);
|
||||||
InsertTailList(&CmiKeyObjectListHead, &FoundObject->KeyBodyList);
|
|
||||||
RtlpCreateUnicodeString(&FoundObject->Name, KeyName.Buffer, NonPagedPool);
|
RtlpCreateUnicodeString(&FoundObject->Name, KeyName.Buffer, NonPagedPool);
|
||||||
CmiAddKeyToList(ParsedKey, FoundObject);
|
CmiAddKeyToList(ParsedKey->KeyControlBlock, FoundObject);
|
||||||
DPRINT("Created object 0x%p\n", FoundObject);
|
DPRINT("Created object 0x%p\n", FoundObject);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -784,9 +780,6 @@ CmpParseKey(IN PVOID ParsedObject,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList(&FoundObject->KeyBodyList);
|
|
||||||
InsertHeadList(&CmiKeyObjectListHead, &FoundObject->KeyBodyList);
|
|
||||||
|
|
||||||
ExReleaseResourceLite(&CmpRegistryLock);
|
ExReleaseResourceLite(&CmpRegistryLock);
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
|
|
||||||
|
@ -831,16 +824,10 @@ CmpDeleteKeyObject(PVOID DeletedObject)
|
||||||
KeEnterCriticalRegion();
|
KeEnterCriticalRegion();
|
||||||
ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
|
ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE);
|
||||||
|
|
||||||
RemoveEntryList(&KeyObject->KeyBodyList);
|
|
||||||
RtlFreeUnicodeString(&KeyObject->Name);
|
RtlFreeUnicodeString(&KeyObject->Name);
|
||||||
|
|
||||||
ASSERT((KeyObject->KeyControlBlock->Delete) == FALSE);
|
ASSERT((KeyObject->KeyControlBlock->Delete) == FALSE);
|
||||||
|
|
||||||
if (KeyObject->SizeOfSubKeys)
|
|
||||||
{
|
|
||||||
ExFreePool(KeyObject->SubKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExReleaseResourceLite(&CmpRegistryLock);
|
ExReleaseResourceLite(&CmpRegistryLock);
|
||||||
KeLeaveCriticalRegion();
|
KeLeaveCriticalRegion();
|
||||||
PostOperationInfo.Status = STATUS_SUCCESS;
|
PostOperationInfo.Status = STATUS_SUCCESS;
|
||||||
|
@ -917,41 +904,10 @@ CmpQueryKeyName(PVOID ObjectBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CmiAddKeyToList(PKEY_OBJECT ParentKey,
|
CmiAddKeyToList(PCM_KEY_CONTROL_BLOCK ParentKey,
|
||||||
PKEY_OBJECT NewKey)
|
PKEY_OBJECT NewKey)
|
||||||
{
|
{
|
||||||
DPRINT("ParentKey %.08x\n", ParentKey);
|
InsertTailList(&ParentKey->KeyBodyListHead, &NewKey->KeyBodyEntry);
|
||||||
|
|
||||||
if (ParentKey->SizeOfSubKeys <= ParentKey->SubKeyCounts)
|
|
||||||
{
|
|
||||||
PKEY_OBJECT *tmpSubKeys = ExAllocatePool(NonPagedPool,
|
|
||||||
(ParentKey->SubKeyCounts + 1) * sizeof(ULONG));
|
|
||||||
|
|
||||||
if (ParentKey->SubKeyCounts > 0)
|
|
||||||
{
|
|
||||||
RtlCopyMemory (tmpSubKeys,
|
|
||||||
ParentKey->SubKeys,
|
|
||||||
ParentKey->SubKeyCounts * sizeof(ULONG));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ParentKey->SubKeys)
|
|
||||||
ExFreePool(ParentKey->SubKeys);
|
|
||||||
|
|
||||||
ParentKey->SubKeys = tmpSubKeys;
|
|
||||||
ParentKey->SizeOfSubKeys = ParentKey->SubKeyCounts + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Please maintain the list in alphabetic order */
|
|
||||||
/* to allow a dichotomic search */
|
|
||||||
ParentKey->SubKeys[ParentKey->SubKeyCounts++] = NewKey;
|
|
||||||
|
|
||||||
DPRINT("Reference parent key: 0x%p\n", ParentKey);
|
|
||||||
|
|
||||||
ObReferenceObjectByPointer(ParentKey,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
CmpKeyObjectType,
|
|
||||||
KernelMode);
|
|
||||||
//NewKey->ParentKey = ParentKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
|
|
@ -202,8 +202,6 @@ typedef struct _CM_KEY_BODY
|
||||||
struct _CM_KEY_CONTROL_BLOCK *KeyControlBlock;
|
struct _CM_KEY_CONTROL_BLOCK *KeyControlBlock;
|
||||||
struct _CM_NOTIFY_BLOCK *NotifyBlock;
|
struct _CM_NOTIFY_BLOCK *NotifyBlock;
|
||||||
HANDLE ProcessID;
|
HANDLE ProcessID;
|
||||||
ULONG Callers;
|
|
||||||
PVOID CallerAddress[10];
|
|
||||||
LIST_ENTRY KeyBodyList;
|
LIST_ENTRY KeyBodyList;
|
||||||
} CM_KEY_BODY, *PCM_KEY_BODY;
|
} CM_KEY_BODY, *PCM_KEY_BODY;
|
||||||
|
|
||||||
|
@ -496,11 +494,8 @@ typedef struct _KEY_OBJECT
|
||||||
{
|
{
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
UNICODE_STRING Name;
|
UNICODE_STRING Name;
|
||||||
LIST_ENTRY KeyBodyList;
|
|
||||||
ULONG SubKeyCounts;
|
|
||||||
ULONG SizeOfSubKeys;
|
|
||||||
struct _KEY_OBJECT **SubKeys;
|
|
||||||
PCM_KEY_CONTROL_BLOCK KeyControlBlock;
|
PCM_KEY_CONTROL_BLOCK KeyControlBlock;
|
||||||
|
LIST_ENTRY KeyBodyEntry;
|
||||||
} KEY_OBJECT, *PKEY_OBJECT;
|
} KEY_OBJECT, *PKEY_OBJECT;
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -513,7 +508,7 @@ CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
|
||||||
IN PVOID ParseContext);
|
IN PVOID ParseContext);
|
||||||
NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
|
NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
|
||||||
VOID
|
VOID
|
||||||
CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
|
CmiAddKeyToList(IN PCM_KEY_CONTROL_BLOCK ParentKey,
|
||||||
IN PKEY_OBJECT NewKey);
|
IN PKEY_OBJECT NewKey);
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -39,26 +39,9 @@ CmpDoFlushAll(IN BOOLEAN ForceFlush)
|
||||||
Hive = CONTAINING_RECORD(NextEntry, CMHIVE, HiveList);
|
Hive = CONTAINING_RECORD(NextEntry, CMHIVE, HiveList);
|
||||||
if (!(Hive->Hive.HiveFlags & HIVE_NOLAZYFLUSH))
|
if (!(Hive->Hive.HiveFlags & HIVE_NOLAZYFLUSH))
|
||||||
{
|
{
|
||||||
/* Find out why this is needed? [Aleksey] */
|
|
||||||
ULONG Disposition;
|
|
||||||
CmpOpenHiveFiles(&Hive->FileFullPath,
|
|
||||||
L".LOG",
|
|
||||||
&Hive->FileHandles[HFILE_TYPE_PRIMARY],
|
|
||||||
&Hive->FileHandles[HFILE_TYPE_LOG],
|
|
||||||
&Disposition,
|
|
||||||
&Disposition,
|
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
TRUE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Do the sync */
|
/* Do the sync */
|
||||||
Status = HvSyncHive(&Hive->Hive);
|
Status = HvSyncHive(&Hive->Hive);
|
||||||
if (!NT_SUCCESS(Status)) Result = FALSE;
|
if (!NT_SUCCESS(Status)) Result = FALSE;
|
||||||
|
|
||||||
/* ReactOS requires this */
|
|
||||||
ZwClose(Hive->FileHandles[HFILE_TYPE_PRIMARY]);
|
|
||||||
ZwClose(Hive->FileHandles[HFILE_TYPE_LOG]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try the next entry */
|
/* Try the next entry */
|
||||||
|
@ -1170,30 +1153,12 @@ CmFlushKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ULONG Disposition;
|
|
||||||
|
|
||||||
/* ReactOS Requires this */
|
|
||||||
CmpOpenHiveFiles(&CmHive->FileFullPath,
|
|
||||||
L".LOG",
|
|
||||||
&CmHive->FileHandles[HFILE_TYPE_PRIMARY],
|
|
||||||
&CmHive->FileHandles[HFILE_TYPE_LOG],
|
|
||||||
&Disposition,
|
|
||||||
&Disposition,
|
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
TRUE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Flush only this hive */
|
/* Flush only this hive */
|
||||||
if (!HvSyncHive(Hive))
|
if (!HvSyncHive(Hive))
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
Status = STATUS_REGISTRY_IO_FAILED;
|
Status = STATUS_REGISTRY_IO_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ReactOS requires this */
|
|
||||||
ZwClose(CmHive->FileHandles[HFILE_TYPE_PRIMARY]);
|
|
||||||
ZwClose(CmHive->FileHandles[HFILE_TYPE_LOG]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the status */
|
/* Return the status */
|
||||||
|
|
|
@ -230,10 +230,6 @@ CmpDoCreateChild(IN PHHIVE Hive,
|
||||||
|
|
||||||
/* Now fill out the Cm object */
|
/* Now fill out the Cm object */
|
||||||
KeyBody->KeyControlBlock = Kcb;
|
KeyBody->KeyControlBlock = Kcb;
|
||||||
KeyBody->SubKeyCounts = 0;
|
|
||||||
KeyBody->SubKeys = NULL;
|
|
||||||
KeyBody->SizeOfSubKeys = 0;
|
|
||||||
InsertTailList(&CmiKeyObjectListHead, &KeyBody->KeyBodyList);
|
|
||||||
|
|
||||||
Quickie:
|
Quickie:
|
||||||
/* Check if we got here because of failure */
|
/* Check if we got here because of failure */
|
||||||
|
@ -488,10 +484,6 @@ CmpDoOpen(IN PHHIVE Hive,
|
||||||
/* Get the key body and fill it out */
|
/* Get the key body and fill it out */
|
||||||
KeyBody = (PKEY_OBJECT)(*Object);
|
KeyBody = (PKEY_OBJECT)(*Object);
|
||||||
KeyBody->KeyControlBlock = Kcb;
|
KeyBody->KeyControlBlock = Kcb;
|
||||||
KeyBody->SubKeyCounts = 0;
|
|
||||||
KeyBody->SubKeys = NULL;
|
|
||||||
KeyBody->SizeOfSubKeys = 0;
|
|
||||||
InsertTailList(&CmiKeyObjectListHead, &KeyBody->KeyBodyList);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,6 @@ POBJECT_TYPE CmpKeyObjectType;
|
||||||
PCMHIVE CmiVolatileHive;
|
PCMHIVE CmiVolatileHive;
|
||||||
LIST_ENTRY CmpHiveListHead;
|
LIST_ENTRY CmpHiveListHead;
|
||||||
ERESOURCE CmpRegistryLock;
|
ERESOURCE CmpRegistryLock;
|
||||||
LIST_ENTRY CmiKeyObjectListHead;
|
|
||||||
LIST_ENTRY CmiConnectedHiveList;
|
|
||||||
KGUARDED_MUTEX CmpSelfHealQueueLock;
|
KGUARDED_MUTEX CmpSelfHealQueueLock;
|
||||||
LIST_ENTRY CmpSelfHealQueueListHead;
|
LIST_ENTRY CmpSelfHealQueueListHead;
|
||||||
KEVENT CmpLoadWorkerEvent;
|
KEVENT CmpLoadWorkerEvent;
|
||||||
|
@ -184,10 +182,6 @@ CmpInitHiveFromFile(IN PCUNICODE_STRING HiveName,
|
||||||
NewHive->FileFullPath.MaximumLength = HiveName->MaximumLength;
|
NewHive->FileFullPath.MaximumLength = HiveName->MaximumLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ROS: Close the hive files */
|
|
||||||
ZwClose(FileHandle);
|
|
||||||
if (LogHandle) ZwClose(LogHandle);
|
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -530,8 +524,8 @@ CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
|
||||||
/* We have one */
|
/* We have one */
|
||||||
ParseContext.ChildHive.KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
|
ParseContext.ChildHive.KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("Ready to parse\n");
|
/* Create the link node */
|
||||||
Status = ObOpenObjectByName(&ObjectAttributes,
|
Status = ObOpenObjectByName(&ObjectAttributes,
|
||||||
CmpKeyObjectType,
|
CmpKeyObjectType,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
|
@ -539,8 +533,6 @@ CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
|
||||||
KEY_READ | KEY_WRITE,
|
KEY_READ | KEY_WRITE,
|
||||||
(PVOID)&ParseContext,
|
(PVOID)&ParseContext,
|
||||||
&KeyHandle);
|
&KeyHandle);
|
||||||
DPRINT1("Parse done: %lx\n", Status);
|
|
||||||
//while (TRUE);
|
|
||||||
|
|
||||||
/* Capture all the info */
|
/* Capture all the info */
|
||||||
Status = ObpCaptureObjectAttributes(&ObjectAttributes,
|
Status = ObpCaptureObjectAttributes(&ObjectAttributes,
|
||||||
|
@ -622,7 +614,7 @@ CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName,
|
||||||
ObReferenceObject(NewKey);
|
ObReferenceObject(NewKey);
|
||||||
|
|
||||||
/* Link this key to the parent */
|
/* Link this key to the parent */
|
||||||
CmiAddKeyToList(ParentKey, NewKey);
|
CmiAddKeyToList(ParentKey->KeyControlBlock, NewKey);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +662,7 @@ CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
((PHBASE_BLOCK)HiveBase)->Length = LoaderBlock->RegistryLength;
|
((PHBASE_BLOCK)HiveBase)->Length = LoaderBlock->RegistryLength;
|
||||||
Status = CmpInitializeHive((PCMHIVE*)&SystemHive,
|
Status = CmpInitializeHive((PCMHIVE*)&SystemHive,
|
||||||
HINIT_MEMORY,
|
HINIT_MEMORY,
|
||||||
0, //HIVE_NOLAZYFLUSH,
|
HIVE_NOLAZYFLUSH,
|
||||||
HFILE_TYPE_LOG,
|
HFILE_TYPE_LOG,
|
||||||
HiveBase,
|
HiveBase,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -915,14 +907,8 @@ CmpCreateRegistryRoot(VOID)
|
||||||
RootKey->ProcessID = PsGetCurrentProcessId();
|
RootKey->ProcessID = PsGetCurrentProcessId();
|
||||||
#else
|
#else
|
||||||
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
|
RtlpCreateUnicodeString(&RootKey->Name, L"Registry", NonPagedPool);
|
||||||
RootKey->SubKeyCounts = 0;
|
|
||||||
RootKey->SubKeys = NULL;
|
|
||||||
RootKey->SizeOfSubKeys = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Insert it into the object list head */
|
|
||||||
InsertTailList(&CmiKeyObjectListHead, &RootKey->KeyBodyList);
|
|
||||||
|
|
||||||
/* Insert the key into the namespace */
|
/* Insert the key into the namespace */
|
||||||
Status = ObInsertObject(RootKey,
|
Status = ObInsertObject(RootKey,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1023,8 +1009,8 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
{
|
{
|
||||||
WCHAR FileBuffer[MAX_PATH], RegBuffer[MAX_PATH], ConfigPath[MAX_PATH];
|
WCHAR FileBuffer[MAX_PATH], RegBuffer[MAX_PATH], ConfigPath[MAX_PATH];
|
||||||
UNICODE_STRING TempName, FileName, RegName;
|
UNICODE_STRING TempName, FileName, RegName;
|
||||||
ULONG FileStart, RegStart, i, ErrorResponse, ClusterSize, WorkerCount;
|
ULONG FileStart, RegStart, i, ErrorResponse, WorkerCount, Length;
|
||||||
ULONG PrimaryDisposition, SecondaryDisposition, Length;
|
ULONG PrimaryDisposition, SecondaryDisposition, ClusterSize;
|
||||||
PCMHIVE CmHive;
|
PCMHIVE CmHive;
|
||||||
HANDLE PrimaryHandle, LogHandle;
|
HANDLE PrimaryHandle, LogHandle;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -1101,13 +1087,12 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ExpInTextModeSetup) {
|
|
||||||
/* We already have a hive, is it volatile? */
|
|
||||||
CmHive = CmpMachineHiveList[i].CmHive;
|
CmHive = CmpMachineHiveList[i].CmHive;
|
||||||
|
/* We already have a hive, is it volatile? */
|
||||||
if (!(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
|
if (!(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
|
||||||
{
|
{
|
||||||
DPRINT1("[HiveLoad]: Open from file %wZ\n", &FileName);
|
DPRINT1("[HiveLoad]: Open from file %wZ\n", &FileName);
|
||||||
|
|
||||||
/* It's now, open the hive file and log */
|
/* It's now, open the hive file and log */
|
||||||
Status = CmpOpenHiveFiles(&FileName,
|
Status = CmpOpenHiveFiles(&FileName,
|
||||||
L".LOG",
|
L".LOG",
|
||||||
|
@ -1137,31 +1122,31 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
/* Save the file handles. This should remove our sync hacks */
|
/* Save the file handles. This should remove our sync hacks */
|
||||||
CmHive->FileHandles[HFILE_TYPE_LOG] = LogHandle;
|
CmHive->FileHandles[HFILE_TYPE_LOG] = LogHandle;
|
||||||
CmHive->FileHandles[HFILE_TYPE_PRIMARY] = PrimaryHandle;
|
CmHive->FileHandles[HFILE_TYPE_PRIMARY] = PrimaryHandle;
|
||||||
|
|
||||||
/* Allow lazy flushing since the handles are there -- remove sync hacks */
|
/* Allow lazy flushing since the handles are there -- remove sync hacks */
|
||||||
//ASSERT(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH);
|
//ASSERT(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH);
|
||||||
CmHive->Hive.HiveFlags &= ~HIVE_NOLAZYFLUSH;
|
CmHive->Hive.HiveFlags &= ~HIVE_NOLAZYFLUSH;
|
||||||
|
|
||||||
/* Get the real size of the hive */
|
/* Get the real size of the hive */
|
||||||
Length = CmHive->Hive.Storage[Stable].Length + HBLOCK_SIZE;
|
Length = CmHive->Hive.Storage[Stable].Length + HBLOCK_SIZE;
|
||||||
|
|
||||||
/* Check if the cluster size doesn't match */
|
/* Check if the cluster size doesn't match */
|
||||||
if (CmHive->Hive.Cluster != ClusterSize) ASSERT(FALSE);
|
if (CmHive->Hive.Cluster != ClusterSize) ASSERT(FALSE);
|
||||||
|
|
||||||
/* Set the file size */
|
/* Set the file size */
|
||||||
if (!CmpFileSetSize((PHHIVE)CmHive, HFILE_TYPE_PRIMARY, Length, Length))
|
//if (!CmpFileSetSize((PHHIVE)CmHive, HFILE_TYPE_PRIMARY, Length, Length))
|
||||||
{
|
{
|
||||||
/* This shouldn't fail */
|
/* This shouldn't fail */
|
||||||
ASSERT(FALSE);
|
//ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Another thing we don't support is NTLDR-recovery */
|
/* Another thing we don't support is NTLDR-recovery */
|
||||||
if (CmHive->Hive.BaseBlock->BootRecover) ASSERT(FALSE);
|
if (CmHive->Hive.BaseBlock->BootRecover) ASSERT(FALSE);
|
||||||
|
|
||||||
/* Finally, set our allocated hive to the same hive we've had */
|
/* Finally, set our allocated hive to the same hive we've had */
|
||||||
CmpMachineHiveList[i].CmHive2 = CmHive;
|
CmpMachineHiveList[i].CmHive2 = CmHive;
|
||||||
ASSERT(CmpMachineHiveList[i].CmHive == CmpMachineHiveList[i].CmHive2);
|
ASSERT(CmpMachineHiveList[i].CmHive == CmpMachineHiveList[i].CmHive2);
|
||||||
}}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
|
@ -1289,7 +1274,7 @@ CmpInitializeHiveList(IN USHORT Flag)
|
||||||
Status = CmpLinkHiveToMaster(&RegName,
|
Status = CmpLinkHiveToMaster(&RegName,
|
||||||
NULL,
|
NULL,
|
||||||
CmpMachineHiveList[i].CmHive2,
|
CmpMachineHiveList[i].CmHive2,
|
||||||
FALSE, //CmpMachineHiveList[i].Allocate,
|
CmpMachineHiveList[i].Allocate,
|
||||||
SecurityDescriptor);
|
SecurityDescriptor);
|
||||||
if (Status != STATUS_SUCCESS)
|
if (Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -1368,12 +1353,6 @@ CmInitSystem1(VOID)
|
||||||
/* Save the current process and lock the registry */
|
/* Save the current process and lock the registry */
|
||||||
CmpSystemProcess = PsGetCurrentProcess();
|
CmpSystemProcess = PsGetCurrentProcess();
|
||||||
|
|
||||||
#if 1
|
|
||||||
/* OLD CM: Initialize the key object list */
|
|
||||||
InitializeListHead(&CmiKeyObjectListHead);
|
|
||||||
InitializeListHead(&CmiConnectedHiveList);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create the key object types */
|
/* Create the key object types */
|
||||||
Status = CmpCreateObjectTypes();
|
Status = CmpCreateObjectTypes();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -1475,7 +1454,7 @@ CmInitSystem1(VOID)
|
||||||
((PHBASE_BLOCK)BaseAddress)->Length = Length;
|
((PHBASE_BLOCK)BaseAddress)->Length = Length;
|
||||||
Status = CmpInitializeHive((PCMHIVE*)&HardwareHive,
|
Status = CmpInitializeHive((PCMHIVE*)&HardwareHive,
|
||||||
HINIT_MEMORY, //HINIT_CREATE,
|
HINIT_MEMORY, //HINIT_CREATE,
|
||||||
HIVE_VOLATILE,
|
HIVE_VOLATILE | HIVE_NOLAZYFLUSH,
|
||||||
HFILE_TYPE_PRIMARY,
|
HFILE_TYPE_PRIMARY,
|
||||||
BaseAddress, // NULL,
|
BaseAddress, // NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
Loading…
Reference in a new issue