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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 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";
36 CHAR BootPartitionPrompt
[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
37 CHAR BootSectorFilePrompt
[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
38 CHAR LinuxKernelPrompt
[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
39 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.";
40 CHAR LinuxCommandLinePrompt
[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
41 CHAR ReactOSSystemPathPrompt
[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
42 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";
44 CHAR CustomBootPrompt
[] = "Press ENTER to boot your custom boot setup.";
46 VOID
OptionMenuCustomBoot(VOID
)
48 PCHAR CustomBootMenuList
[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
49 ULONG CustomBootMenuCount
= sizeof(CustomBootMenuList
) / sizeof(CustomBootMenuList
[0]);
50 ULONG SelectedMenuItem
;
52 if (!UiDisplayMenu(CustomBootMenuList
, CustomBootMenuCount
, 0, -1, &SelectedMenuItem
, TRUE
, NULL
))
54 // The user pressed ESC
58 switch (SelectedMenuItem
)
61 OptionMenuCustomBootDisk();
64 OptionMenuCustomBootPartition();
66 case 2: // Boot Sector File
67 OptionMenuCustomBootBootSectorFile();
70 OptionMenuCustomBootReactOS();
73 OptionMenuCustomBootLinux();
78 VOID
OptionMenuCustomBootDisk(VOID
)
80 CHAR SectionName
[100];
81 CHAR BootDriveString
[20];
83 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
85 RtlZeroMemory(SectionName
, sizeof(SectionName
));
86 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
88 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
93 // Generate a unique section name
94 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
95 sprintf(SectionName
, "CustomBootDisk%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
98 if (!IniAddSection(SectionName
, &SectionId
))
104 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Drive"))
110 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
115 UiMessageBox(CustomBootPrompt
);
117 LoadAndBootDrive(SectionName
);
120 VOID
OptionMenuCustomBootPartition(VOID
)
122 CHAR SectionName
[100];
123 CHAR BootDriveString
[20];
124 CHAR BootPartitionString
[20];
126 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
128 RtlZeroMemory(SectionName
, sizeof(SectionName
));
129 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
130 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
132 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
137 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
142 // Generate a unique section name
143 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
144 sprintf(SectionName
, "CustomBootPartition%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
147 if (!IniAddSection(SectionName
, &SectionId
))
153 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Partition"))
159 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
164 // Add the BootPartition
165 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
170 UiMessageBox(CustomBootPrompt
);
172 LoadAndBootPartition(SectionName
);
175 VOID
OptionMenuCustomBootBootSectorFile(VOID
)
177 CHAR SectionName
[100];
178 CHAR BootDriveString
[20];
179 CHAR BootPartitionString
[20];
180 CHAR BootSectorFileString
[200];
182 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
184 RtlZeroMemory(SectionName
, sizeof(SectionName
));
185 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
186 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
187 RtlZeroMemory(BootSectorFileString
, sizeof(BootSectorFileString
));
189 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
194 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
199 if (!UiEditBox(BootSectorFilePrompt
, BootSectorFileString
, 200))
204 // Generate a unique section name
205 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
206 sprintf(SectionName
, "CustomBootSectorFile%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
209 if (!IniAddSection(SectionName
, &SectionId
))
215 if (!IniAddSettingValueToSection(SectionId
, "BootType", "BootSector"))
221 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
226 // Add the BootPartition
227 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
232 // Add the BootSectorFile
233 if (!IniAddSettingValueToSection(SectionId
, "BootSectorFile", BootSectorFileString
))
238 UiMessageBox(CustomBootPrompt
);
240 LoadAndBootBootSector(SectionName
);
243 VOID
OptionMenuCustomBootReactOS(VOID
)
245 CHAR SectionName
[100];
246 CHAR BootDriveString
[20];
247 CHAR BootPartitionString
[20];
248 CHAR ReactOSSystemPath
[200];
249 CHAR ReactOSARCPath
[200];
250 CHAR ReactOSOptions
[200];
252 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
254 RtlZeroMemory(SectionName
, sizeof(SectionName
));
255 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
256 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
257 RtlZeroMemory(ReactOSSystemPath
, sizeof(ReactOSSystemPath
));
258 RtlZeroMemory(ReactOSOptions
, sizeof(ReactOSOptions
));
260 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
265 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
270 if (!UiEditBox(ReactOSSystemPathPrompt
, ReactOSSystemPath
, 200))
275 if (!UiEditBox(ReactOSOptionsPrompt
, ReactOSOptions
, 200))
280 // Generate a unique section name
281 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
282 sprintf(SectionName
, "CustomReactOS%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
285 if (!IniAddSection(SectionName
, &SectionId
))
291 if (!IniAddSettingValueToSection(SectionId
, "BootType", "ReactOS"))
296 // Construct the ReactOS ARC system path
297 ConstructArcPath(ReactOSARCPath
, ReactOSSystemPath
, DriveMapGetBiosDriveNumber(BootDriveString
), atoi(BootPartitionString
));
299 // Add the system path
300 if (!IniAddSettingValueToSection(SectionId
, "SystemPath", ReactOSARCPath
))
305 // Add the CommandLine
306 if (!IniAddSettingValueToSection(SectionId
, "Options", ReactOSOptions
))
311 UiMessageBox(CustomBootPrompt
);
313 LoadAndBootReactOS(SectionName
);
316 VOID
OptionMenuCustomBootLinux(VOID
)
318 CHAR SectionName
[100];
319 CHAR BootDriveString
[20];
320 CHAR BootPartitionString
[20];
321 CHAR LinuxKernelString
[200];
322 CHAR LinuxInitrdString
[200];
323 CHAR LinuxCommandLineString
[200];
325 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
327 RtlZeroMemory(SectionName
, sizeof(SectionName
));
328 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
329 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
330 RtlZeroMemory(LinuxKernelString
, sizeof(LinuxKernelString
));
331 RtlZeroMemory(LinuxInitrdString
, sizeof(LinuxInitrdString
));
332 RtlZeroMemory(LinuxCommandLineString
, sizeof(LinuxCommandLineString
));
334 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
339 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
344 if (!UiEditBox(LinuxKernelPrompt
, LinuxKernelString
, 200))
349 if (!UiEditBox(LinuxInitrdPrompt
, LinuxInitrdString
, 200))
354 if (!UiEditBox(LinuxCommandLinePrompt
, LinuxCommandLineString
, 200))
359 // Generate a unique section name
360 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
361 sprintf(SectionName
, "CustomLinux%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
364 if (!IniAddSection(SectionName
, &SectionId
))
370 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Linux"))
376 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
381 // Add the BootPartition
382 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
388 if (!IniAddSettingValueToSection(SectionId
, "Kernel", LinuxKernelString
))
394 if (strlen(LinuxInitrdString
) > 0)
396 if (!IniAddSettingValueToSection(SectionId
, "Initrd", LinuxInitrdString
))
402 // Add the CommandLine
403 if (!IniAddSettingValueToSection(SectionId
, "CommandLine", LinuxCommandLineString
))
408 UiMessageBox(CustomBootPrompt
);
410 LoadAndBootLinux(SectionName
, "Custom Linux Setup");