Author: hbelusca
Date: Fri Jun 2 15:47:52 2017
New Revision: 74747
URL:
http://svn.reactos.org/svn/reactos?rev=74747&view=rev
Log:
[NTOS]: Cm fixes:
- Rework CmpSetSystemValues() and remove its 1st-stage text-mode setup hack, since I'm
going to have a real hive for the 1st-stage either.
- Lock, then unlock the registry in NtInitializeRegistry when initializing the hives &
flusher.
- Call CmpInitializeHiveList() (i.e., initialize the other hives like \Software, \User,
\.Default) only when we are not in setup-mode.
Modified:
branches/setup_improvements/ntoskrnl/config/cmlazy.c
branches/setup_improvements/ntoskrnl/config/cmsysini.c
branches/setup_improvements/ntoskrnl/config/ntapi.c
branches/setup_improvements/ntoskrnl/ex/init.c
branches/setup_improvements/ntoskrnl/include/internal/cm.h
Modified: branches/setup_improvements/ntoskrnl/config/cmlazy.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/con…
==============================================================================
--- branches/setup_improvements/ntoskrnl/config/cmlazy.c [iso-8859-1] (original)
+++ branches/setup_improvements/ntoskrnl/config/cmlazy.c [iso-8859-1] Fri Jun 2 15:47:52
2017
@@ -262,8 +262,9 @@
/* Testing: Force Lazy Flushing */
CmpHoldLazyFlush = FALSE;
- /* Setup the hive list */
- CmpInitializeHiveList(SetupBoot);
+ /* Setup the hive list if this is not a Setup boot*/
+ if (!SetupBoot)
+ CmpInitializeHiveList();
}
NTSTATUS
Modified: branches/setup_improvements/ntoskrnl/config/cmsysini.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/con…
==============================================================================
--- branches/setup_improvements/ntoskrnl/config/cmsysini.c [iso-8859-1] (original)
+++ branches/setup_improvements/ntoskrnl/config/cmsysini.c [iso-8859-1] Fri Jun 2
15:47:52 2017
@@ -394,10 +394,11 @@
INIT_FUNCTION
CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
+ NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
+ HANDLE KeyHandle;
UNICODE_STRING KeyName, ValueName = { 0, 0, NULL };
- HANDLE KeyHandle = NULL;
- NTSTATUS Status;
+
ASSERT(LoaderBlock != NULL);
/* Setup attributes for loader options */
@@ -410,9 +411,10 @@
NULL,
NULL);
Status = NtOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
- if (!NT_SUCCESS(Status)) goto Quickie;
-
- /* Key opened, now write to the key */
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ /* Setup the value for the system start options */
RtlInitUnicodeString(&KeyName, L"SystemStartOptions");
Status = NtSetValueKey(KeyHandle,
&KeyName,
@@ -420,9 +422,10 @@
REG_SZ,
CmpLoadOptions.Buffer,
CmpLoadOptions.Length);
- if (!NT_SUCCESS(Status)) goto Quickie;
-
- /* Setup value name for system boot device in ARC format */
+ if (!NT_SUCCESS(Status))
+ goto Quit;
+
+ /* Setup the value for the system boot device in ARC format */
RtlInitUnicodeString(&KeyName, L"SystemBootDevice");
RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->ArcBootDeviceName);
Status = NtSetValueKey(KeyHandle,
@@ -432,15 +435,13 @@
ValueName.Buffer,
ValueName.Length);
-Quickie:
- /* Free the buffers */
+ /* Free the temporary string */
RtlFreeUnicodeString(&ValueName);
+Quit:
/* Close the key and return */
- if (KeyHandle) NtClose(KeyHandle);
-
- /* Return the status */
- return (ExpInTextModeSetup ? STATUS_SUCCESS : Status);
+ NtClose(KeyHandle);
+ return Status;
}
static
@@ -1413,7 +1414,7 @@
VOID
NTAPI
-CmpInitializeHiveList(IN USHORT Flag)
+CmpInitializeHiveList(VOID)
{
WCHAR FileBuffer[MAX_PATH], RegBuffer[MAX_PATH], ConfigPath[MAX_PATH];
UNICODE_STRING TempName, FileName, RegName;
Modified: branches/setup_improvements/ntoskrnl/config/ntapi.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/con…
==============================================================================
--- branches/setup_improvements/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ branches/setup_improvements/ntoskrnl/config/ntapi.c [iso-8859-1] Fri Jun 2 15:47:52
2017
@@ -950,7 +950,8 @@
PAGED_CODE();
/* Always do this as kernel mode */
- if (KeGetPreviousMode() == UserMode) return ZwInitializeRegistry(Flag);
+ if (KeGetPreviousMode() == UserMode)
+ return ZwInitializeRegistry(Flag);
/* Enough of the system has booted by now */
Ki386PerfEnd();
@@ -992,8 +993,8 @@
if (!CmFirstTime) return STATUS_ACCESS_DENIED;
CmFirstTime = FALSE;
- /* Acquire registry lock */
- //CmpLockRegistryExclusive();
+ /* Lock the registry exclusively */
+ CmpLockRegistryExclusive();
/* Initialize the hives and lazy flusher */
CmpCmdInit(SetupBoot);
@@ -1002,7 +1003,7 @@
CmpSetVersionData();
/* Release the registry lock */
- //CmpUnlockRegistry();
+ CmpUnlockRegistry();
return STATUS_SUCCESS;
}
Modified: branches/setup_improvements/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/ex/…
==============================================================================
--- branches/setup_improvements/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ branches/setup_improvements/ntoskrnl/ex/init.c [iso-8859-1] Fri Jun 2 15:47:52 2017
@@ -963,7 +963,8 @@
if (LoaderBlock->SetupLdrBlock)
{
/* Check if this is text-mode setup */
- if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_TEXT_MODE)
ExpInTextModeSetup = TRUE;
+ if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_TEXT_MODE)
+ ExpInTextModeSetup = TRUE;
/* Check if this is network boot */
if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_REMOTE_BOOT)
Modified: branches/setup_improvements/ntoskrnl/include/internal/cm.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/inc…
==============================================================================
--- branches/setup_improvements/ntoskrnl/include/internal/cm.h [iso-8859-1] (original)
+++ branches/setup_improvements/ntoskrnl/include/internal/cm.h [iso-8859-1] Fri Jun 2
15:47:52 2017
@@ -859,7 +859,7 @@
VOID
NTAPI
CmpInitializeHiveList(
- IN USHORT Flag
+ VOID
);
//