#include <internal/ntoskrnl.h>
#include <reactos/resource.h>
#include <internal/mm.h>
+#include <internal/ifs.h>
#include <internal/module.h>
#include <internal/ldr.h>
#include <internal/ex.h>
}
+static BOOLEAN
+RtlpIsSystemHive(PCHAR FileName)
+{
+ PCHAR Name;
+
+ Name = strrchr(FileName, '\\');
+ if (Name == NULL)
+ {
+ Name = FileName;
+ }
+ else
+ {
+ Name = Name + 1;
+ }
+
+ return((_stricmp(Name, "system.hiv") == 0) ||
+ (_stricmp(Name, "system") == 0));
+}
+
+
static VOID
InitSystemSharedUserPage (PCSZ ParameterLine)
{
}
}
+
VOID
ExpInitializeExecutive(VOID)
{
+ LARGE_INTEGER Timeout;
+ HANDLE ProcessHandle;
+ HANDLE ThreadHandle;
ULONG BootDriverCount;
ULONG i;
ULONG start;
PCHAR name;
CHAR str[50];
NTSTATUS Status;
+ BOOLEAN SetupBoot;
/*
* Fail at runtime if someone has changed various structures without
if (KeNumberProcessors > 1)
{
sprintf(str,
- "Found %d system processors. [%lu MB Memory]\n",
+ "Found %d system processors. [%u MB Memory]\n",
KeNumberProcessors,
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
else
{
sprintf(str,
- "Found 1 system processor. [%lu MB Memory]\n",
+ "Found 1 system processor. [%u MB Memory]\n",
(KeLoaderBlock.MemHigher + 1088)/ 1024);
}
HalDisplayString(str);
MmInit3();
CcInit();
KdInit2();
+ FsRtlpInitFileLockingImplementation();
/* Report all resources used by hal */
HalReportResourceUsage();
}
/* Pass 2: load registry chunks passed in */
+ SetupBoot = TRUE;
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
CPRINT("Process registry chunk at %08lx\n", start);
CmImportHive((PCHAR)start, length);
}
+ if (RtlpIsSystemHive(name))
+ {
+ SetupBoot = FALSE;
+ }
}
/* Initialize volatile registry settings */
- CmInit2((PCHAR)KeLoaderBlock.CommandLine);
+ if (SetupBoot == FALSE)
+ {
+ CmInit2((PCHAR)KeLoaderBlock.CommandLine);
+ }
/*
* Enter the kernel debugger before starting up the boot drivers
DebugLogInit2();
#endif /* DBGPRINT_FILE_LOG */
+#ifdef KDBG
+ KdbInitProfiling2();
+#endif /* KDBG */
+
PiInitDefaultLocale();
/*
* Launch initial process
*/
- LdrLoadInitialProcess();
+ Status = LdrLoadInitialProcess(&ProcessHandle,
+ &ThreadHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ /*
+ * Crash the system if the initial process terminates within 5 seconds.
+ */
+ Timeout.QuadPart = -50000000LL;
+ Status = NtWaitForSingleObject(ProcessHandle,
+ FALSE,
+ &Timeout);
+ if (Status != STATUS_TIMEOUT)
+ {
+ KeBugCheckEx(SESSION5_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ NtClose(ThreadHandle);
+ NtClose(ProcessHandle);
PsTerminateSystemThread(STATUS_SUCCESS);
}
}
}
sprintf(KeLoaderCommandLine,
- "multi(0)disk(0)rdisk(%ld)partition(%ld)%s %s",
+ "multi(0)disk(0)rdisk(%d)partition(%d)%s %s",
DiskNumber, PartNumber + 1, Temp, options);
p = KeLoaderCommandLine;