#define NDEBUG
#include <debug.h>
+/* This is the size that we can expect from the win 2003 loader */
+#define LOADER_PARAMETER_EXTENSION_MIN_SIZE \
+ RTL_SIZEOF_THROUGH_FIELD(LOADER_PARAMETER_EXTENSION, AcpiTableSize)
+
/* Temporary hack */
BOOLEAN
NTAPI
/* NT Version Info */
ULONG NtMajorVersion = VER_PRODUCTMAJORVERSION;
ULONG NtMinorVersion = VER_PRODUCTMINORVERSION;
-#if DBG
+#if DBG /* Checked Build */
ULONG NtBuildNumber = VER_PRODUCTBUILD | 0xC0000000;
-#else
+#else /* Free Build */
ULONG NtBuildNumber = VER_PRODUCTBUILD;
#endif
ULONG CmNtCSDReleaseType;
UNICODE_STRING CmVersionString;
UNICODE_STRING CmCSDVersionString;
-CHAR NtBuildLab[] = KERNEL_VERSION_BUILD_STR;
+
+CHAR NtBuildLab[] = KERNEL_VERSION_BUILD_STR "."
+ REACTOS_COMPILER_NAME "_" REACTOS_COMPILER_VERSION;
/* Init flags and settings */
ULONG ExpInitializationPhase;
(USHORT)Size);
/* Append the DLL path to it */
- RtlAppendUnicodeToString(&Environment, L"Path=" );
+ RtlAppendUnicodeToString(&Environment, L"Path=");
RtlAppendUnicodeStringToString(&Environment, &ProcessParams->DllPath);
RtlAppendUnicodeStringToString(&Environment, &NullString);
DPRINT1("Executive: Event Pair initialization failed\n");
return FALSE;
}
-
+
/* Initialize mutants */
if (ExpInitializeMutantImplementation() == FALSE)
{
DPRINT1("Executive: Mutant initialization failed\n");
return FALSE;
}
-
+
/* Initialize callbacks */
if (ExpInitializeCallbacks() == FALSE)
{
DPRINT1("Executive: Callback initialization failed\n");
return FALSE;
}
-
+
/* Initialize semaphores */
if (ExpInitializeSemaphoreImplementation() == FALSE)
{
DPRINT1("Executive: Semaphore initialization failed\n");
return FALSE;
}
-
+
/* Initialize timers */
if (ExpInitializeTimerImplementation() == FALSE)
{
DPRINT1("Executive: Timer initialization failed\n");
return FALSE;
}
-
+
/* Initialize profiling */
if (ExpInitializeProfileImplementation() == FALSE)
{
DPRINT1("Executive: Profile initialization failed\n");
return FALSE;
}
-
+
/* Initialize UUIDs */
ExpInitUuids();
-
+
/* Initialize keyed events */
if (ExpInitializeKeyedEventImplementation() == FALSE)
{
DPRINT1("Executive: Keyed event initialization failed\n");
return FALSE;
}
-
+
/* Initialize Win32K */
if (ExpWin32kInit() == FALSE)
{
/* Get the loader extension */
Extension = LoaderBlock->Extension;
- /* Validate the size (larger structures are OK, we'll just ignore them) */
- if (Extension->Size < sizeof(LOADER_PARAMETER_EXTENSION)) return FALSE;
+ /* Validate the size (Windows 2003 loader doesn't provide more) */
+ if (Extension->Size < LOADER_PARAMETER_EXTENSION_MIN_SIZE) return FALSE;
/* Don't validate upper versions */
if (Extension->MajorVersion > VER_PRODUCTMAJORVERSION) return TRUE;
/* Load the symbols */
DbgLoadImageSymbols(&SymbolString,
LdrEntry->DllBase,
- (ULONG_PTR)ZwCurrentProcess());
+ (ULONG_PTR)PsGetCurrentProcessId());
}
}
PLIST_ENTRY ListEntry;
PMEMORY_ALLOCATION_DESCRIPTOR MemDescriptor;
- DPRINT1("Burn RAM amount: %d pages\n", PagesToDestroy);
+ DPRINT1("Burn RAM amount: %lu pages\n", PagesToDestroy);
/* Loop the memory descriptors, beginning at the end */
for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Blink;
ULONG PerfMemUsed;
PLDR_DATA_TABLE_ENTRY NtosEntry;
PMESSAGE_RESOURCE_ENTRY MsgEntry;
- ANSI_STRING CsdString;
+ ANSI_STRING CSDString;
size_t Remaining = 0;
PCHAR RcEnd = NULL;
- CHAR VersionBuffer [65];
+ CHAR VersionBuffer[65];
/* Validate Loader */
if (!ExpIsLoaderValid(LoaderBlock))
/* Setup initial system settings */
CmGetSystemControlValues(LoaderBlock->RegistryBase, CmControlVector);
- /* Load static defaults for Service Pack 1 and add our SVN revision */
- /* Format of CSD : SPMajor - SPMinor */
- CmNtCSDVersion = 0x100 | (KERNEL_VERSION_BUILD_HEX << 16);
- CmNtCSDReleaseType = 0;
-
- /* Set Service Pack data for Service Pack 1 */
+ /* Set the Service Pack Number and add it to the CSD Version number if needed */
CmNtSpBuildNumber = VER_PRODUCTBUILD_QFE;
- if (!(CmNtCSDVersion & 0xFFFF0000))
+ if (((CmNtCSDVersion & 0xFFFF0000) == 0) && (CmNtCSDReleaseType == 1))
{
- /* Check the release type */
- if (CmNtCSDReleaseType == 1) CmNtSpBuildNumber |= VER_PRODUCTBUILD_QFE << 16;
+ CmNtCSDVersion |= (VER_PRODUCTBUILD_QFE << 16);
}
/* Add loaded CmNtGlobalFlag value */
if (NT_SUCCESS(Status))
{
/* Setup the string */
- RtlInitAnsiString(&CsdString, (PCHAR)MsgEntry->Text);
+ RtlInitAnsiString(&CSDString, (PCHAR)MsgEntry->Text);
/* Remove trailing newline */
- while ((CsdString.Length > 0) &&
- ((CsdString.Buffer[CsdString.Length - 1] == '\r') ||
- (CsdString.Buffer[CsdString.Length - 1] == '\n')))
+ while ((CSDString.Length > 0) &&
+ ((CSDString.Buffer[CSDString.Length - 1] == '\r') ||
+ (CSDString.Buffer[CSDString.Length - 1] == '\n')))
{
/* Skip the trailing character */
- CsdString.Length--;
+ CSDString.Length--;
}
/* Fill the buffer with version information */
Status = RtlStringCbPrintfA(Buffer,
sizeof(Buffer),
"%Z %u%c",
- &CsdString,
+ &CSDString,
(CmNtCSDVersion & 0xFF00) >> 8,
(CmNtCSDVersion & 0xFF) ?
'A' + (CmNtCSDVersion & 0xFF) - 1 :
}
/* Check if we have an RC number */
- if (CmNtCSDVersion & 0xFFFF0000)
+ if ((CmNtCSDVersion & 0xFFFF0000) && (CmNtCSDReleaseType == 1))
{
/* Check if we have no version data yet */
if (!(*Buffer))
/* Add the version format string */
Status = RtlStringCbPrintfA(RcEnd,
Remaining,
- "r%u",
+ "v.%u",
(CmNtCSDVersion & 0xFFFF0000) >> 16);
if (!NT_SUCCESS(Status))
{
}
/* Now setup the final string */
- RtlInitAnsiString(&CsdString, Buffer);
+ RtlInitAnsiString(&CSDString, Buffer);
Status = RtlAnsiStringToUnicodeString(&CmCSDVersionString,
- &CsdString,
+ &CSDString,
TRUE);
if (!NT_SUCCESS(Status))
{
if (!HalInitSystem(1, LoaderBlock)) KeBugCheck(HAL1_INITIALIZATION_FAILED);
/* Get the command line and upcase it */
- CommandLine = _strupr(LoaderBlock->LoadOptions);
+ CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
/* Check if GUI Boot is enabled */
- NoGuiBoot = (strstr(CommandLine, "NOGUIBOOT")) ? TRUE: FALSE;
+ NoGuiBoot = (CommandLine && strstr(CommandLine, "NOGUIBOOT") != NULL);
/* Get the SOS setting */
- SosEnabled = strstr(CommandLine, "SOS") ? TRUE: FALSE;
+ SosEnabled = (CommandLine && strstr(CommandLine, "SOS") != NULL);
/* Setup the boot driver */
InbvEnableBootDriver(!NoGuiBoot);
}
/* Check if this is LiveCD (WinPE) mode */
- if (strstr(CommandLine, "MININT"))
+ if (CommandLine && strstr(CommandLine, "MININT") != NULL)
{
/* Setup WinPE Settings */
InitIsWinPEMode = TRUE;
- InitWinPEModeType |= (strstr(CommandLine, "INRAM")) ? 0x80000000 : 1;
+ InitWinPEModeType |= (strstr(CommandLine, "INRAM") != NULL) ? 0x80000000 : 0x00000001;
}
/* Get the kernel's load entry */
if (NT_SUCCESS(MsgStatus))
{
/* Create the banner message */
+ /* ReactOS specific: Report ReactOS version, NtBuildLab information and reported NT kernel version */
Status = RtlStringCbPrintfA(EndBuffer,
Remaining,
(PCHAR)MsgEntry->Text,
+ KERNEL_VERSION_STR,
+ NtBuildLab,
StringBuffer,
NtBuildNumber & 0xFFFF,
BeginBuffer);
else
{
/* Use hard-coded banner message */
- Status = RtlStringCbCopyA(EndBuffer, Remaining, "REACTOS (R)\n");
+ Status = RtlStringCbCopyA(EndBuffer, Remaining, "REACTOS (R)\r\n");
if (!NT_SUCCESS(Status))
{
/* Bugcheck */
sizeof(InitBuffer->VersionBuffer),
NT_SUCCESS(MsgStatus) ?
(PCHAR)MsgEntry->Text :
- "%u System Processor [%u MB Memory] %Z\n",
+ "%u System Processor [%u MB Memory] %Z\r\n",
KeNumberProcessors,
Size,
&TempString);
MmFreeLoaderBlock(LoaderBlock);
LoaderBlock = Context = NULL;
+ /* Initialize the SRM in phase 1 */
+ if (!SeRmInitPhase1()) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
+
/* Update progress bar */
InbvUpdateProgressBar(100);
+ /* Clear the screen */
+ if (InbvBootDriverInstalled) FinalizeBootLogo();
+
/* Allow strings to be displayed */
InbvEnableDisplayString(TRUE);
/* Launch initial process */
- DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
+ DPRINT("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
ProcessInfo = &InitBuffer->ProcessInfo;
ExpLoadInitialProcess(InitBuffer, &ProcessParameters, &Environment);
&Size,
MEM_RELEASE);
- /* Clean the screen */
- if (InbvBootDriverInstalled) FinalizeBootLogo();
-
/* Increase init phase */
ExpInitializationPhase++;
/* Free the boot buffer */
ExFreePoolWithTag(InitBuffer, TAG_INIT);
- DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
+ DPRINT("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
}
VOID