mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[FREELDR] Some initialization fixes.
- Initialize BootPath and BootOptions buffers when fallback behaviour is not taken.
- Correctly skip all the understood whitespace (space & tabs) and the
quotes before reading the boot options when using the alternative syntax:
[Operating Systems]
section_name = "ReactOS" /bootoptions
Fixes the minor regression introduced in 370e8564
(r43875).
This commit is contained in:
parent
b978d42bd9
commit
909bfff460
|
@ -191,6 +191,7 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
|
||||||
UiDrawProgressBarCenter(1, 100, "Loading ReactOS Setup...");
|
UiDrawProgressBarCenter(1, 100, "Loading ReactOS Setup...");
|
||||||
|
|
||||||
/* Read the system path is set in the .ini file */
|
/* Read the system path is set in the .ini file */
|
||||||
|
BootPath[0] = ANSI_NULL;
|
||||||
if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", BootPath, sizeof(BootPath)))
|
if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", BootPath, sizeof(BootPath)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -231,15 +232,23 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
|
||||||
if ((strlen(BootPath) == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
if ((strlen(BootPath) == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
||||||
strcat(BootPath, "\\");
|
strcat(BootPath, "\\");
|
||||||
|
|
||||||
/* Read booting options */
|
/* Read boot options */
|
||||||
|
BootOptions2[0] = ANSI_NULL;
|
||||||
if (!HasSection || !IniReadSettingByName(SectionId, "Options", BootOptions2, sizeof(BootOptions2)))
|
if (!HasSection || !IniReadSettingByName(SectionId, "Options", BootOptions2, sizeof(BootOptions2)))
|
||||||
{
|
{
|
||||||
/* Get options after the title */
|
/* Retrieve the options after the quoted title */
|
||||||
PCSTR p = SettingsValue;
|
PCSTR p = SettingsValue;
|
||||||
while (*p == ' ' || *p == '"')
|
|
||||||
p++;
|
/* Trim any leading whitespace and quotes */
|
||||||
while (*p != '\0' && *p != '"')
|
while (*p == ' ' || *p == '\t' || *p == '"')
|
||||||
p++;
|
++p;
|
||||||
|
/* Skip all the text up to the first last quote */
|
||||||
|
while (*p != ANSI_NULL && *p != '"')
|
||||||
|
++p;
|
||||||
|
/* Trim any trailing whitespace and quotes */
|
||||||
|
while (*p == ' ' || *p == '\t' || *p == '"')
|
||||||
|
++p;
|
||||||
|
|
||||||
strcpy(BootOptions2, p);
|
strcpy(BootOptions2, p);
|
||||||
TRACE("BootOptions: '%s'\n", BootOptions2);
|
TRACE("BootOptions: '%s'\n", BootOptions2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,13 +652,13 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||||
{
|
{
|
||||||
ULONG_PTR SectionId;
|
ULONG_PTR SectionId;
|
||||||
PCSTR SectionName = OperatingSystem->SystemPartition;
|
PCSTR SectionName = OperatingSystem->SystemPartition;
|
||||||
CHAR SettingsValue[80];
|
PCHAR File;
|
||||||
|
BOOLEAN Success;
|
||||||
BOOLEAN HasSection;
|
BOOLEAN HasSection;
|
||||||
|
CHAR SettingsValue[80];
|
||||||
CHAR BootPath[MAX_PATH];
|
CHAR BootPath[MAX_PATH];
|
||||||
CHAR FileName[MAX_PATH];
|
CHAR FileName[MAX_PATH];
|
||||||
CHAR BootOptions[256];
|
CHAR BootOptions[256];
|
||||||
PCHAR File;
|
|
||||||
BOOLEAN Success;
|
|
||||||
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
||||||
|
|
||||||
/* Get OS setting value */
|
/* Get OS setting value */
|
||||||
|
@ -673,6 +673,7 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||||
UiDrawProgressBarCenter(1, 100, "Loading NT...");
|
UiDrawProgressBarCenter(1, 100, "Loading NT...");
|
||||||
|
|
||||||
/* Read the system path is set in the .ini file */
|
/* Read the system path is set in the .ini file */
|
||||||
|
BootPath[0] = ANSI_NULL;
|
||||||
if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", BootPath, sizeof(BootPath)))
|
if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", BootPath, sizeof(BootPath)))
|
||||||
{
|
{
|
||||||
strcpy(BootPath, SectionName);
|
strcpy(BootPath, SectionName);
|
||||||
|
@ -704,15 +705,23 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||||
if ((BootPath[0] == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
if ((BootPath[0] == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
||||||
strcat(BootPath, "\\");
|
strcat(BootPath, "\\");
|
||||||
|
|
||||||
/* Read booting options */
|
/* Read boot options */
|
||||||
|
BootOptions[0] = ANSI_NULL;
|
||||||
if (!HasSection || !IniReadSettingByName(SectionId, "Options", BootOptions, sizeof(BootOptions)))
|
if (!HasSection || !IniReadSettingByName(SectionId, "Options", BootOptions, sizeof(BootOptions)))
|
||||||
{
|
{
|
||||||
/* Get options after the title */
|
/* Retrieve the options after the quoted title */
|
||||||
PCSTR p = SettingsValue;
|
PCSTR p = SettingsValue;
|
||||||
while (*p == ' ' || *p == '"')
|
|
||||||
p++;
|
/* Trim any leading whitespace and quotes */
|
||||||
while (*p != '\0' && *p != '"')
|
while (*p == ' ' || *p == '\t' || *p == '"')
|
||||||
p++;
|
++p;
|
||||||
|
/* Skip all the text up to the first last quote */
|
||||||
|
while (*p != ANSI_NULL && *p != '"')
|
||||||
|
++p;
|
||||||
|
/* Trim any trailing whitespace and quotes */
|
||||||
|
while (*p == ' ' || *p == '\t' || *p == '"')
|
||||||
|
++p;
|
||||||
|
|
||||||
strcpy(BootOptions, p);
|
strcpy(BootOptions, p);
|
||||||
TRACE("BootOptions: '%s'\n", BootOptions);
|
TRACE("BootOptions: '%s'\n", BootOptions);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue