VOID OptionMenuCustomBootPartition(VOID) { ULONG_PTR SectionId; CHAR SectionName[100]; CHAR BootDriveString[20]; CHAR BootPartitionString[20]; TIMEINFO* TimeInfo; OperatingSystemItem OperatingSystem; RtlZeroMemory(SectionName, sizeof(SectionName)); RtlZeroMemory(BootDriveString, sizeof(BootDriveString)); RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString)); if (!UiEditBox(BootDrivePrompt, BootDriveString, 20)) { return; } if (!UiEditBox(BootPartitionPrompt, BootPartitionString, 20)) { return; } // Generate a unique section name TimeInfo = ArcGetTime(); sprintf(SectionName, "CustomBootPartition%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", "Partition")) { return; } // Add the BootDrive if (!IniAddSettingValueToSection(SectionId, "BootDrive", BootDriveString)) { return; } // Add the BootPartition if (!IniAddSettingValueToSection(SectionId, "BootPartition", BootPartitionString)) { return; } UiMessageBox(CustomBootPrompt); OperatingSystem.SystemPartition = SectionName; OperatingSystem.LoadIdentifier = NULL; OperatingSystem.OsLoadOptions = NULL; // LoadAndBootPartition(&OperatingSystem, 0); LoadOperatingSystem(&OperatingSystem); }
VOID RunLoader(VOID) { ULONG_PTR SectionId; ULONG OperatingSystemCount; OperatingSystemItem* OperatingSystemList; PCSTR* OperatingSystemDisplayNames; ULONG DefaultOperatingSystem; LONG TimeOut; ULONG SelectedOperatingSystem; ULONG i; if (!MachInitializeBootDevices()) { UiMessageBoxCritical("Error when detecting hardware."); return; } #ifdef _M_IX86 /* Load additional SCSI driver (if any) */ if (LoadBootDeviceDriver() != ESUCCESS) { UiMessageBoxCritical("Unable to load additional boot device drivers."); } #endif if (!IniFileInitialize()) { UiMessageBoxCritical("Error initializing .ini file."); return; } /* Debugger main initialization */ DebugInit(TRUE); if (!IniOpenSection("FreeLoader", &SectionId)) { UiMessageBoxCritical("Section [FreeLoader] not found in freeldr.ini."); return; } TimeOut = GetTimeOut(); /* UI main initialization */ if (!UiInitialize(TRUE)) { UiMessageBoxCritical("Unable to initialize UI."); return; } OperatingSystemList = InitOperatingSystemList(&OperatingSystemCount); if (!OperatingSystemList) { UiMessageBox("Unable to read operating systems section in freeldr.ini.\nPress ENTER to reboot."); goto Reboot; } if (OperatingSystemCount == 0) { UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot."); goto Reboot; } DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemList, OperatingSystemCount); /* Create list of display names */ OperatingSystemDisplayNames = FrLdrTempAlloc(sizeof(PCSTR) * OperatingSystemCount, 'mNSO'); if (!OperatingSystemDisplayNames) goto Reboot; for (i = 0; i < OperatingSystemCount; i++) { OperatingSystemDisplayNames[i] = OperatingSystemList[i].LoadIdentifier; } /* Find all the message box settings and run them */ UiShowMessageBoxesInSection("FreeLoader"); for (;;) { /* Redraw the backdrop */ UiDrawBackdrop(); /* Show the operating system list menu */ if (!UiDisplayMenu("Please select the operating system to start:", "For troubleshooting and advanced startup options for " "ReactOS, press F8.", TRUE, OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, TimeOut, &SelectedOperatingSystem, FALSE, MainBootMenuKeyPressFilter)) { UiMessageBox("Press ENTER to reboot."); goto Reboot; } TimeOut = -1; /* Load the chosen operating system */ LoadOperatingSystem(&OperatingSystemList[SelectedOperatingSystem]); } Reboot: UiUnInitialize("Rebooting..."); return; }
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) { ULONG_PTR SectionId; CHAR SectionName[100]; CHAR BootDriveString[20]; CHAR BootPartitionString[20]; CHAR LinuxKernelString[200]; CHAR LinuxInitrdString[200]; CHAR LinuxCommandLineString[200]; TIMEINFO* TimeInfo; OperatingSystemItem OperatingSystem; RtlZeroMemory(SectionName, sizeof(SectionName)); RtlZeroMemory(BootDriveString, sizeof(BootDriveString)); RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString)); RtlZeroMemory(LinuxKernelString, sizeof(LinuxKernelString)); RtlZeroMemory(LinuxInitrdString, sizeof(LinuxInitrdString)); RtlZeroMemory(LinuxCommandLineString, sizeof(LinuxCommandLineString)); if (!UiEditBox(BootDrivePrompt, BootDriveString, 20)) return; if (!UiEditBox(BootPartitionPrompt, BootPartitionString, 20)) return; if (!UiEditBox(LinuxKernelPrompt, LinuxKernelString, 200)) return; if (!UiEditBox(LinuxInitrdPrompt, LinuxInitrdString, 200)) return; if (!UiEditBox(LinuxCommandLinePrompt, LinuxCommandLineString, 200)) return; /* Generate a unique section name */ TimeInfo = ArcGetTime(); sprintf(SectionName, "CustomLinux%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", "Linux")) return; /* Add the BootDrive */ if (!IniAddSettingValueToSection(SectionId, "BootDrive", BootDriveString)) return; /* Add the BootPartition */ if (!IniAddSettingValueToSection(SectionId, "BootPartition", BootPartitionString)) return; /* Add the Kernel */ if (!IniAddSettingValueToSection(SectionId, "Kernel", LinuxKernelString)) return; /* Add the Initrd */ if (strlen(LinuxInitrdString) > 0) { if (!IniAddSettingValueToSection(SectionId, "Initrd", LinuxInitrdString)) return; } /* Add the CommandLine */ if (!IniAddSettingValueToSection(SectionId, "CommandLine", LinuxCommandLineString)) return; UiMessageBox(CustomBootPrompt); OperatingSystem.SystemPartition = SectionName; OperatingSystem.LoadIdentifier = "Custom Linux Setup"; OperatingSystem.OsLoadOptions = NULL; // LoadAndBootLinux(&OperatingSystem, 0); LoadOperatingSystem(&OperatingSystem); }