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.
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
[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
37 ULONG CustomBootMenuCount
= sizeof(CustomBootMenuList
) / sizeof(CustomBootMenuList
[0]);
38 ULONG SelectedMenuItem
;
40 if (!UiDisplayMenu(CustomBootMenuList
, CustomBootMenuCount
, 0, -1, &SelectedMenuItem
, TRUE
, NULL
))
42 // The user pressed ESC
46 switch (SelectedMenuItem
)
49 OptionMenuCustomBootDisk();
52 OptionMenuCustomBootPartition();
54 case 2: // Boot Sector File
55 OptionMenuCustomBootBootSectorFile();
58 OptionMenuCustomBootReactOS();
61 OptionMenuCustomBootLinux();
66 VOID
OptionMenuCustomBootDisk(VOID
)
68 CHAR SectionName
[100];
69 CHAR BootDriveString
[20];
71 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
73 RtlZeroMemory(SectionName
, sizeof(SectionName
));
74 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
76 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
81 // Generate a unique section name
82 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
83 sprintf(SectionName
, "CustomBootDisk%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
86 if (!IniAddSection(SectionName
, &SectionId
))
92 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Drive"))
98 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
103 UiMessageBox(CustomBootPrompt
);
105 LoadAndBootDrive(SectionName
);
108 VOID
OptionMenuCustomBootPartition(VOID
)
110 CHAR SectionName
[100];
111 CHAR BootDriveString
[20];
112 CHAR BootPartitionString
[20];
114 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
116 RtlZeroMemory(SectionName
, sizeof(SectionName
));
117 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
118 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
120 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
125 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
130 // Generate a unique section name
131 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
132 sprintf(SectionName
, "CustomBootPartition%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
135 if (!IniAddSection(SectionName
, &SectionId
))
141 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Partition"))
147 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
152 // Add the BootPartition
153 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
158 UiMessageBox(CustomBootPrompt
);
160 LoadAndBootPartition(SectionName
);
163 VOID
OptionMenuCustomBootBootSectorFile(VOID
)
165 CHAR SectionName
[100];
166 CHAR BootDriveString
[20];
167 CHAR BootPartitionString
[20];
168 CHAR BootSectorFileString
[200];
170 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
172 RtlZeroMemory(SectionName
, sizeof(SectionName
));
173 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
174 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
175 RtlZeroMemory(BootSectorFileString
, sizeof(BootSectorFileString
));
177 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
182 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
187 if (!UiEditBox(BootSectorFilePrompt
, BootSectorFileString
, 200))
192 // Generate a unique section name
193 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
194 sprintf(SectionName
, "CustomBootSectorFile%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
197 if (!IniAddSection(SectionName
, &SectionId
))
203 if (!IniAddSettingValueToSection(SectionId
, "BootType", "BootSector"))
209 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
214 // Add the BootPartition
215 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
220 // Add the BootSectorFile
221 if (!IniAddSettingValueToSection(SectionId
, "BootSectorFile", BootSectorFileString
))
226 UiMessageBox(CustomBootPrompt
);
228 LoadAndBootBootSector(SectionName
);
231 VOID
OptionMenuCustomBootReactOS(VOID
)
233 CHAR SectionName
[100];
234 CHAR BootDriveString
[20];
235 CHAR BootPartitionString
[20];
236 CHAR ReactOSSystemPath
[200];
237 CHAR ReactOSARCPath
[200];
238 CHAR ReactOSOptions
[200];
240 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
242 RtlZeroMemory(SectionName
, sizeof(SectionName
));
243 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
244 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
245 RtlZeroMemory(ReactOSSystemPath
, sizeof(ReactOSSystemPath
));
246 RtlZeroMemory(ReactOSOptions
, sizeof(ReactOSOptions
));
248 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
253 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
258 if (!UiEditBox(ReactOSSystemPathPrompt
, ReactOSSystemPath
, 200))
263 if (!UiEditBox(ReactOSOptionsPrompt
, ReactOSOptions
, 200))
268 // Generate a unique section name
269 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
270 sprintf(SectionName
, "CustomReactOS%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
273 if (!IniAddSection(SectionName
, &SectionId
))
279 if (!IniAddSettingValueToSection(SectionId
, "BootType", "ReactOS"))
284 // Construct the ReactOS ARC system path
285 ConstructArcPath(ReactOSARCPath
, ReactOSSystemPath
, DriveMapGetBiosDriveNumber(BootDriveString
), atoi(BootPartitionString
));
287 // Add the system path
288 if (!IniAddSettingValueToSection(SectionId
, "SystemPath", ReactOSARCPath
))
293 // Add the CommandLine
294 if (!IniAddSettingValueToSection(SectionId
, "Options", ReactOSOptions
))
299 UiMessageBox(CustomBootPrompt
);
301 LoadAndBootReactOS(SectionName
);
304 VOID
OptionMenuCustomBootLinux(VOID
)
306 CHAR SectionName
[100];
307 CHAR BootDriveString
[20];
308 CHAR BootPartitionString
[20];
309 CHAR LinuxKernelString
[200];
310 CHAR LinuxInitrdString
[200];
311 CHAR LinuxCommandLineString
[200];
313 ULONG Year
, Month
, Day
, Hour
, Minute
, Second
;
315 RtlZeroMemory(SectionName
, sizeof(SectionName
));
316 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
317 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
318 RtlZeroMemory(LinuxKernelString
, sizeof(LinuxKernelString
));
319 RtlZeroMemory(LinuxInitrdString
, sizeof(LinuxInitrdString
));
320 RtlZeroMemory(LinuxCommandLineString
, sizeof(LinuxCommandLineString
));
322 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
327 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
332 if (!UiEditBox(LinuxKernelPrompt
, LinuxKernelString
, 200))
337 if (!UiEditBox(LinuxInitrdPrompt
, LinuxInitrdString
, 200))
342 if (!UiEditBox(LinuxCommandLinePrompt
, LinuxCommandLineString
, 200))
347 // Generate a unique section name
348 MachRTCGetCurrentDateTime(&Year
, &Month
, &Day
, &Hour
, &Minute
, &Second
);
349 sprintf(SectionName
, "CustomLinux%d%d%d%d%d%d", Year
, Day
, Month
, Hour
, Minute
, Second
);
352 if (!IniAddSection(SectionName
, &SectionId
))
358 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Linux"))
364 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
369 // Add the BootPartition
370 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
376 if (!IniAddSettingValueToSection(SectionId
, "Kernel", LinuxKernelString
))
382 if (strlen(LinuxInitrdString
) > 0)
384 if (!IniAddSettingValueToSection(SectionId
, "Initrd", LinuxInitrdString
))
390 // Add the CommandLine
391 if (!IniAddSettingValueToSection(SectionId
, "CommandLine", LinuxCommandLineString
))
396 UiMessageBox(CustomBootPrompt
);
398 LoadAndBootLinux(SectionName
, "Custom Linux Setup");