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 DoOptionsMenu(VOID) { ULONG SelectedMenuItem; CHAR DebugChannelString[100]; if (!UiDisplayMenu("Select an option:", "", TRUE, OptionsMenuList, OptionsMenuItemCount, 11, // Use "Start ReactOS normally" as default; see the switch below. -1, &SelectedMenuItem, TRUE, NULL)) { /* The user pressed ESC */ return; } /* Clear the backdrop */ UiDrawBackdrop(); switch (SelectedMenuItem) { case 0: // Safe Mode BootOptionChoice = SAFE_MODE; BootLogging = TRUE; break; case 1: // Safe Mode with Networking BootOptionChoice = SAFE_MODE_WITH_NETWORKING; BootLogging = TRUE; break; case 2: // Safe Mode with Command Prompt BootOptionChoice = SAFE_MODE_WITH_COMMAND_PROMPT; BootLogging = TRUE; break; // case 3: // Separator // break; case 4: // Enable Boot Logging BootLogging = TRUE; break; case 5: // Enable VGA Mode VgaMode = TRUE; break; case 6: // Last Known Good Configuration BootOptionChoice = LAST_KNOWN_GOOD_CONFIGURATION; break; case 7: // Directory Services Restore Mode BootOptionChoice = DIRECTORY_SERVICES_RESTORE_MODE; break; case 8: // Debugging Mode DebuggingMode = TRUE; break; case 9: // FreeLdr debugging DebugChannelString[0] = 0; if (UiEditBox(FrldrDbgMsg, DebugChannelString, sizeof(DebugChannelString) / sizeof(DebugChannelString[0]))) { DbgParseDebugChannels(DebugChannelString); } break; // case 10: // Separator // break; case 11: // Start ReactOS normally // Reset all the parameters to their default values. BootOptionChoice = NO_OPTION; BootLogging = FALSE; VgaMode = FALSE; DebuggingMode = FALSE; break; #ifdef HAS_OPTION_MENU_CUSTOM_BOOT case 12: // Custom Boot OptionMenuCustomBoot(); break; #endif #ifdef HAS_OPTION_MENU_REBOOT case 13: // Reboot OptionMenuReboot(); break; #endif } }
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); }