[FREELDR]

- Move PcBeep function declaration to a better header.
- Resuscitate OptionMenuCustomBootReactOS() from revision r52491, update it to match recent changes in freeldr as well as making it using new boot method, and reuse ConstructArcPath.
  Why I'm doing this ? Because it can be useful to enter personalized boot options by hand at boot time rather than being obliged to edit freeldr.ini. This needs care, not brutal deletion.

svn path=/trunk/; revision=58020
This commit is contained in:
Hermès Bélusca-Maïto 2012-12-27 21:52:40 +00:00
parent dcb9fa5856
commit b8b7caccfe
7 changed files with 98 additions and 10 deletions

View file

@ -67,6 +67,9 @@ VOID OptionMenuCustomBoot(VOID)
case 2: // Boot Sector File
OptionMenuCustomBootBootSectorFile();
break;
case 3: // ReactOS
OptionMenuCustomBootReactOS();
break;
case 4: // Linux
OptionMenuCustomBootLinux();
break;
@ -117,7 +120,8 @@ VOID OptionMenuCustomBootDisk(VOID)
OperatingSystem.LoadIdentifier = NULL;
OperatingSystem.OsLoadOptions = NULL;
LoadAndBootDrive(&OperatingSystem, 0);
// LoadAndBootDrive(&OperatingSystem, 0);
LoadOperatingSystem(&OperatingSystem);
}
VOID OptionMenuCustomBootPartition(VOID)
@ -177,7 +181,8 @@ VOID OptionMenuCustomBootPartition(VOID)
OperatingSystem.LoadIdentifier = NULL;
OperatingSystem.OsLoadOptions = NULL;
LoadAndBootPartition(&OperatingSystem, 0);
// LoadAndBootPartition(&OperatingSystem, 0);
LoadOperatingSystem(&OperatingSystem);
}
VOID OptionMenuCustomBootBootSectorFile(VOID)
@ -250,7 +255,87 @@ VOID OptionMenuCustomBootBootSectorFile(VOID)
OperatingSystem.LoadIdentifier = NULL;
OperatingSystem.OsLoadOptions = NULL;
LoadAndBootBootSector(&OperatingSystem, 0);
// LoadAndBootBootSector(&OperatingSystem, 0);
LoadOperatingSystem(&OperatingSystem);
}
VOID OptionMenuCustomBootReactOS(VOID)
{
ULONG_PTR SectionId;
CHAR SectionName[100];
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
CHAR ReactOSSystemPath[200];
CHAR ReactOSARCPath[200];
CHAR ReactOSOptions[200];
TIMEINFO* TimeInfo;
OperatingSystemItem OperatingSystem;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString));
RtlZeroMemory(ReactOSSystemPath, sizeof(ReactOSSystemPath));
RtlZeroMemory(ReactOSOptions, sizeof(ReactOSOptions));
if (!UiEditBox(BootDrivePrompt, BootDriveString, 20))
{
return;
}
if (!UiEditBox(BootPartitionPrompt, BootPartitionString, 20))
{
return;
}
if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSSystemPath, 200))
{
return;
}
if (!UiEditBox(ReactOSOptionsPrompt, ReactOSOptions, 200))
{
return;
}
// Generate a unique section name
TimeInfo = ArcGetTime();
sprintf(SectionName, "CustomReactOS%u%u%u%u%u%u", TimeInfo->Year, TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute, TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
{
return;
}
// Add the BootType
if (!IniAddSettingValueToSection(SectionId, "BootType", "Windows2003"))
{
return;
}
// Construct the ReactOS ARC system path
ConstructArcPath(ReactOSARCPath, ReactOSSystemPath, DriveMapGetBiosDriveNumber(BootDriveString), atoi(BootPartitionString));
// Add the system path
if (!IniAddSettingValueToSection(SectionId, "SystemPath", ReactOSARCPath))
{
return;
}
// Add the CommandLine
if (!IniAddSettingValueToSection(SectionId, "Options", ReactOSOptions))
{
return;
}
UiMessageBox(CustomBootPrompt);
OperatingSystem.SystemPartition = SectionName;
OperatingSystem.LoadIdentifier = NULL;
OperatingSystem.OsLoadOptions = NULL; // ReactOSOptions
// LoadAndBootWindows(&OperatingSystem, _WIN32_WINNT_WS03);
LoadOperatingSystem(&OperatingSystem);
}
VOID OptionMenuCustomBootLinux(VOID)
@ -352,7 +437,8 @@ VOID OptionMenuCustomBootLinux(VOID)
OperatingSystem.LoadIdentifier = "Custom Linux Setup";
OperatingSystem.OsLoadOptions = NULL;
LoadAndBootLinux(&OperatingSystem, 0);
// LoadAndBootLinux(&OperatingSystem, 0);
LoadOperatingSystem(&OperatingSystem);
}
VOID OptionMenuReboot(VOID)

View file

@ -22,7 +22,7 @@
void sound(int freq);
void delay(unsigned msec);
void PcBeep(void)
VOID PcBeep(VOID)
{
sound(700);
delay(200);

View file

@ -26,6 +26,8 @@
VOID PcMachInit(const char *CmdLine);
VOID PcBeep(VOID);
VOID PcConsPutChar(int Ch);
BOOLEAN PcConsKbHit(VOID);
int PcConsGetCh(VOID);

View file

@ -119,6 +119,7 @@
#endif
VOID BootMain(LPSTR CmdLine);
VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem);
VOID RunLoader(VOID);
#endif // defined __FREELDR_H

View file

@ -34,6 +34,6 @@ DissectArcPath2(
OUT ULONG *PathSyntax);
BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition);
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition);
#if 0
UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath);
void PcBeep(void);
#endif

View file

@ -160,8 +160,6 @@ DissectArcPath2(
return FALSE;
}
#if 0
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
{
char tmp[50];
@ -198,6 +196,7 @@ VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Parti
}
}
#if 0
UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath)
{
char * p;

View file

@ -193,7 +193,7 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
return;
}
if (!InfGetDataField (&InfContext, 1, &LoadOptions))
if (!InfGetDataField(&InfContext, 1, &LoadOptions))
{
ERR("Failed to get load options\n");
return;