3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 const CHAR BootDrivePrompt
[] = "Enter the boot drive.\n\nExamples:\nfd0 - first floppy drive\nhd0 - first hard drive\nhd1 - second hard drive\ncd0 - first CD-ROM drive.\n\nBIOS drive numbers may also be used:\n0 - first floppy drive\n0x80 - first hard drive\n0x81 - second hard drive";
24 const CHAR BootPartitionPrompt
[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
25 const CHAR BootSectorFilePrompt
[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
26 const CHAR LinuxKernelPrompt
[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
27 const CHAR LinuxInitrdPrompt
[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk.";
28 const CHAR LinuxCommandLinePrompt
[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
29 const CHAR ReactOSSystemPathPrompt
[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
30 const CHAR ReactOSOptionsPrompt
[] = "Enter the options you want passed to the kernel.\n\nExamples:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n/FASTDETECT /SOS /NOGUIBOOT\n/BASEVIDEO /MAXMEM=64\n/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL";
32 const CHAR CustomBootPrompt
[] = "Press ENTER to boot your custom boot setup.";
34 VOID
OptionMenuCustomBoot(VOID
)
36 PCSTR CustomBootMenuList
[] = {
43 ULONG CustomBootMenuCount
= sizeof(CustomBootMenuList
) / sizeof(CustomBootMenuList
[0]);
44 ULONG SelectedMenuItem
;
46 if (!UiDisplayMenu(CustomBootMenuList
, CustomBootMenuCount
, 0, -1, &SelectedMenuItem
, TRUE
, NULL
))
48 // The user pressed ESC
52 switch (SelectedMenuItem
)
55 OptionMenuCustomBootDisk();
58 OptionMenuCustomBootPartition();
60 case 2: // Boot Sector File
61 OptionMenuCustomBootBootSectorFile();
64 OptionMenuCustomBootLinux();
69 VOID
OptionMenuCustomBootDisk(VOID
)
71 CHAR SectionName
[100];
72 CHAR BootDriveString
[20];
76 RtlZeroMemory(SectionName
, sizeof(SectionName
));
77 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
79 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
84 // Generate a unique section name
85 TimeInfo
= ArcGetTime();
86 sprintf(SectionName
, "CustomBootDisk%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
89 if (!IniAddSection(SectionName
, &SectionId
))
95 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Drive"))
101 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
106 UiMessageBox(CustomBootPrompt
);
108 LoadAndBootDrive(SectionName
);
111 VOID
OptionMenuCustomBootPartition(VOID
)
113 CHAR SectionName
[100];
114 CHAR BootDriveString
[20];
115 CHAR BootPartitionString
[20];
119 RtlZeroMemory(SectionName
, sizeof(SectionName
));
120 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
121 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
123 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
128 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
133 // Generate a unique section name
134 TimeInfo
= ArcGetTime();
135 sprintf(SectionName
, "CustomBootPartition%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
138 if (!IniAddSection(SectionName
, &SectionId
))
144 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Partition"))
150 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
155 // Add the BootPartition
156 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
161 UiMessageBox(CustomBootPrompt
);
163 LoadAndBootPartition(SectionName
);
166 VOID
OptionMenuCustomBootBootSectorFile(VOID
)
168 CHAR SectionName
[100];
169 CHAR BootDriveString
[20];
170 CHAR BootPartitionString
[20];
171 CHAR BootSectorFileString
[200];
175 RtlZeroMemory(SectionName
, sizeof(SectionName
));
176 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
177 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
178 RtlZeroMemory(BootSectorFileString
, sizeof(BootSectorFileString
));
180 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
185 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
190 if (!UiEditBox(BootSectorFilePrompt
, BootSectorFileString
, 200))
195 // Generate a unique section name
196 TimeInfo
= ArcGetTime();
197 sprintf(SectionName
, "CustomBootSectorFile%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
200 if (!IniAddSection(SectionName
, &SectionId
))
206 if (!IniAddSettingValueToSection(SectionId
, "BootType", "BootSector"))
212 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
217 // Add the BootPartition
218 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
223 // Add the BootSectorFile
224 if (!IniAddSettingValueToSection(SectionId
, "BootSectorFile", BootSectorFileString
))
229 UiMessageBox(CustomBootPrompt
);
231 LoadAndBootBootSector(SectionName
);
234 VOID
OptionMenuCustomBootLinux(VOID
)
236 CHAR SectionName
[100];
237 CHAR BootDriveString
[20];
238 CHAR BootPartitionString
[20];
239 CHAR LinuxKernelString
[200];
240 CHAR LinuxInitrdString
[200];
241 CHAR LinuxCommandLineString
[200];
245 RtlZeroMemory(SectionName
, sizeof(SectionName
));
246 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
247 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
248 RtlZeroMemory(LinuxKernelString
, sizeof(LinuxKernelString
));
249 RtlZeroMemory(LinuxInitrdString
, sizeof(LinuxInitrdString
));
250 RtlZeroMemory(LinuxCommandLineString
, sizeof(LinuxCommandLineString
));
252 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
257 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
262 if (!UiEditBox(LinuxKernelPrompt
, LinuxKernelString
, 200))
267 if (!UiEditBox(LinuxInitrdPrompt
, LinuxInitrdString
, 200))
272 if (!UiEditBox(LinuxCommandLinePrompt
, LinuxCommandLineString
, 200))
277 // Generate a unique section name
278 TimeInfo
= ArcGetTime();
279 sprintf(SectionName
, "CustomLinux%u%u%u%u%u%u", TimeInfo
->Year
, TimeInfo
->Day
, TimeInfo
->Month
, TimeInfo
->Hour
, TimeInfo
->Minute
, TimeInfo
->Second
);
282 if (!IniAddSection(SectionName
, &SectionId
))
288 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Linux"))
294 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
299 // Add the BootPartition
300 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
306 if (!IniAddSettingValueToSection(SectionId
, "Kernel", LinuxKernelString
))
312 if (strlen(LinuxInitrdString
) > 0)
314 if (!IniAddSettingValueToSection(SectionId
, "Initrd", LinuxInitrdString
))
320 // Add the CommandLine
321 if (!IniAddSettingValueToSection(SectionId
, "CommandLine", LinuxCommandLineString
))
326 UiMessageBox(CustomBootPrompt
);
328 LoadAndBootLinux(SectionName
, "Custom Linux Setup");
331 VOID
OptionMenuReboot(VOID
)
333 UiMessageBox("The system will now reboot.");
335 DiskStopFloppyMotor();