Author: hbelusca Date: Thu Dec 27 21:52:40 2012 New Revision: 58020
URL: http://svn.reactos.org/svn/reactos?rev=58020&view=rev Log: [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.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c trunk/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h trunk/reactos/boot/freeldr/freeldr/include/freeldr.h trunk/reactos/boot/freeldr/freeldr/include/reactos.h trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -67,6 +67,9 @@ case 2: // Boot Sector File OptionMenuCustomBootBootSectorFile(); break; + case 3: // ReactOS + OptionMenuCustomBootReactOS(); + break; case 4: // Linux OptionMenuCustomBootLinux(); break; @@ -117,7 +120,8 @@ OperatingSystem.LoadIdentifier = NULL; OperatingSystem.OsLoadOptions = NULL;
- LoadAndBootDrive(&OperatingSystem, 0); + // LoadAndBootDrive(&OperatingSystem, 0); + LoadOperatingSystem(&OperatingSystem); }
VOID OptionMenuCustomBootPartition(VOID) @@ -177,7 +181,8 @@ OperatingSystem.LoadIdentifier = NULL; OperatingSystem.OsLoadOptions = NULL;
- LoadAndBootPartition(&OperatingSystem, 0); + // LoadAndBootPartition(&OperatingSystem, 0); + LoadOperatingSystem(&OperatingSystem); }
VOID OptionMenuCustomBootBootSectorFile(VOID) @@ -250,7 +255,87 @@ 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 @@ OperatingSystem.LoadIdentifier = "Custom Linux Setup"; OperatingSystem.OsLoadOptions = NULL;
- LoadAndBootLinux(&OperatingSystem, 0); + // LoadAndBootLinux(&OperatingSystem, 0); + LoadOperatingSystem(&OperatingSystem); }
VOID OptionMenuReboot(VOID)
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -22,7 +22,7 @@ void sound(int freq); void delay(unsigned msec);
-void PcBeep(void) +VOID PcBeep(VOID) { sound(700); delay(200);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -25,6 +25,8 @@ #endif
VOID PcMachInit(const char *CmdLine); + +VOID PcBeep(VOID);
VOID PcConsPutChar(int Ch); BOOLEAN PcConsKbHit(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -119,6 +119,7 @@ #endif
VOID BootMain(LPSTR CmdLine); +VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem); VOID RunLoader(VOID);
#endif // defined __FREELDR_H
Modified: trunk/reactos/boot/freeldr/freeldr/include/reactos.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -34,6 +34,6 @@ 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
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reacto... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -160,8 +160,6 @@ return FALSE; }
- -#if 0 VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition) { char tmp[50]; @@ -198,6 +196,7 @@ } }
+#if 0 UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) { char * p;
Modified: trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] Thu Dec 27 21:52:40 2012 @@ -193,7 +193,7 @@ return; }
- if (!InfGetDataField (&InfContext, 1, &LoadOptions)) + if (!InfGetDataField(&InfContext, 1, &LoadOptions)) { ERR("Failed to get load options\n"); return;