Skip to content

Commit c10fe76

Browse files
vgalntbinarymaster
andcommitted
[FREELDR] Add parsing boot options from .ini files. (reactos#2511)
Co-Authored-By: Stanislav Motylkov <[email protected]>
1 parent 26e26d2 commit c10fe76

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

boot/freeldr/freeldr/ntldr/winldr.c

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ extern void WinLdrSetupEms(IN PCHAR BootOptions);
2626

2727
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock;
2828

29+
BOOLEAN VirtualBias = FALSE;
30+
BOOLEAN SosEnabled = FALSE;
31+
BOOLEAN PaeEnabled = FALSE;
32+
BOOLEAN PaeDisabled = FALSE;
33+
BOOLEAN SafeBoot = FALSE;
34+
BOOLEAN BootLogo = FALSE;
35+
BOOLEAN NoexecuteDisabled = FALSE;
36+
BOOLEAN NoexecuteEnabled = FALSE;
37+
2938
// debug stuff
3039
VOID DumpMemoryAllocMap(VOID);
3140

@@ -639,6 +648,95 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
639648
}
640649
}
641650

651+
/* Parse the boot options */
652+
Options = BootOptions;
653+
TRACE("LoadWindowsCore: BootOptions '%s'\n", BootOptions);
654+
while (Options)
655+
{
656+
/* Skip possible initial whitespace */
657+
Options += strspn(Options, " \t");
658+
659+
/* Check whether a new option starts */
660+
if (*Options == '/')
661+
{
662+
Options++;
663+
664+
if (_strnicmp(Options, "3GB", 3) == 0)
665+
{
666+
/* We found the 3GB option. */
667+
FIXME("LoadWindowsCore: 3GB - TRUE (not implemented)\n");
668+
VirtualBias = TRUE;
669+
}
670+
if (_strnicmp(Options, "SOS", 3) == 0)
671+
{
672+
/* We found the SOS option. */
673+
FIXME("LoadWindowsCore: SOS - TRUE (not implemented)\n");
674+
SosEnabled = TRUE;
675+
}
676+
if (OperatingSystemVersion > _WIN32_WINNT_NT4)
677+
{
678+
if (_strnicmp(Options, "SAFEBOOT", 8) == 0)
679+
{
680+
/* We found the SAFEBOOT option. */
681+
FIXME("LoadWindowsCore: SAFEBOOT - TRUE (not implemented)\n");
682+
SafeBoot = TRUE;
683+
}
684+
if (_strnicmp(Options, "PAE", 3) == 0)
685+
{
686+
/* We found the PAE option. */
687+
FIXME("LoadWindowsCore: PAE - TRUE (not implemented)\n");
688+
PaeEnabled = TRUE;
689+
}
690+
}
691+
if (OperatingSystemVersion > _WIN32_WINNT_WIN2K)
692+
{
693+
if (_strnicmp(Options, "NOPAE", 5) == 0)
694+
{
695+
/* We found the NOPAE option. */
696+
FIXME("LoadWindowsCore: NOPAE - TRUE (not implemented)\n");
697+
PaeDisabled = TRUE;
698+
}
699+
if (_strnicmp(Options, "BOOTLOGO", 8) == 0)
700+
{
701+
/* We found the BOOTLOGO option. */
702+
FIXME("LoadWindowsCore: BOOTLOGO - TRUE (not implemented)\n");
703+
BootLogo = TRUE;
704+
}
705+
if (!LoaderBlock->SetupLdrBlock)
706+
{
707+
if (_strnicmp(Options, "NOEXECUTE=ALWAYSOFF", 19) == 0)
708+
{
709+
/* We found the NOEXECUTE=ALWAYSOFF option. */
710+
FIXME("LoadWindowsCore: NOEXECUTE=ALWAYSOFF - TRUE (not implemented)\n");
711+
NoexecuteDisabled = TRUE;
712+
}
713+
else if (_strnicmp(Options, "NOEXECUTE", 9) == 0)
714+
{
715+
/* We found the NOEXECUTE option. */
716+
FIXME("LoadWindowsCore: NOEXECUTE - TRUE (not implemented)\n");
717+
NoexecuteEnabled = TRUE;
718+
}
719+
720+
if (_strnicmp(Options, "EXECUTE", 7) == 0)
721+
{
722+
/* We found the EXECUTE option. */
723+
FIXME("LoadWindowsCore: EXECUTE - TRUE (not implemented)\n");
724+
NoexecuteDisabled = TRUE;
725+
}
726+
}
727+
}
728+
}
729+
730+
/* Search for another whitespace */
731+
Options = strpbrk(Options, " \t");
732+
}
733+
734+
if (SafeBoot)
735+
{
736+
PaeDisabled = TRUE;
737+
NoexecuteDisabled = TRUE;
738+
}
739+
642740
/* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
643741
Success = PeLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
644742
Success &= PeLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);

0 commit comments

Comments
 (0)