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.
34 UCHAR 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";
35 UCHAR BootPartitionPrompt
[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition.";
36 UCHAR BootSectorFilePrompt
[] = "Enter the boot sector file path.\n\nExamples:\n\\BOOTSECT.DOS\n/boot/bootsect.dos";
37 UCHAR LinuxKernelPrompt
[] = "Enter the Linux kernel image path.\n\nExamples:\n/vmlinuz\n/boot/vmlinuz-2.4.18";
38 UCHAR LinuxInitrdPrompt
[] = "Enter the initrd image path.\n\nExamples:\n/initrd.gz\n/boot/root.img.gz\n\nLeave blank for no initial ram disk.";
39 UCHAR LinuxCommandLinePrompt
[] = "Enter the Linux kernel command line.\n\nExamples:\nroot=/dev/hda1\nroot=/dev/fd0 read-only\nroot=/dev/sdb1 init=/sbin/init";
40 UCHAR ReactOSSystemPathPrompt
[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS";
41 UCHAR 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";
43 UCHAR CustomBootPrompt
[] = "Press ENTER to boot your custom boot setup.";
45 VOID
OptionMenuCustomBoot(VOID
)
47 PUCHAR CustomBootMenuList
[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
48 U32 CustomBootMenuCount
= sizeof(CustomBootMenuList
) / sizeof(CustomBootMenuList
[0]);
51 if (!UiDisplayMenu(CustomBootMenuList
, CustomBootMenuCount
, 0, -1, &SelectedMenuItem
, TRUE
, NULL
))
53 // The user pressed ESC
57 switch (SelectedMenuItem
)
60 OptionMenuCustomBootDisk();
63 OptionMenuCustomBootPartition();
65 case 2: // Boot Sector File
66 OptionMenuCustomBootBootSectorFile();
69 OptionMenuCustomBootReactOS();
72 OptionMenuCustomBootLinux();
77 VOID
OptionMenuCustomBootDisk(VOID
)
79 UCHAR SectionName
[100];
80 UCHAR BootDriveString
[20];
83 RtlZeroMemory(SectionName
, sizeof(SectionName
));
84 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
86 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
91 // Generate a unique section name
92 sprintf(SectionName
, "CustomBootDisk%d%d%d%d%d%d", getyear(), getday(), getmonth(), gethour(), getminute(), getsecond());
95 if (!IniAddSection(SectionName
, &SectionId
))
101 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Drive"))
107 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
112 UiMessageBox(CustomBootPrompt
);
114 LoadAndBootDrive(SectionName
);
117 VOID
OptionMenuCustomBootPartition(VOID
)
119 UCHAR SectionName
[100];
120 UCHAR BootDriveString
[20];
121 UCHAR BootPartitionString
[20];
124 RtlZeroMemory(SectionName
, sizeof(SectionName
));
125 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
126 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
128 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
133 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
138 // Generate a unique section name
139 sprintf(SectionName
, "CustomBootPartition%d%d%d%d%d%d", getyear(), getday(), getmonth(), gethour(), getminute(), getsecond());
142 if (!IniAddSection(SectionName
, &SectionId
))
148 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Partition"))
154 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
159 // Add the BootPartition
160 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
165 UiMessageBox(CustomBootPrompt
);
167 LoadAndBootPartition(SectionName
);
170 VOID
OptionMenuCustomBootBootSectorFile(VOID
)
172 UCHAR SectionName
[100];
173 UCHAR BootDriveString
[20];
174 UCHAR BootPartitionString
[20];
175 UCHAR BootSectorFileString
[200];
178 RtlZeroMemory(SectionName
, sizeof(SectionName
));
179 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
180 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
181 RtlZeroMemory(BootSectorFileString
, sizeof(BootSectorFileString
));
183 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
188 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
193 if (!UiEditBox(BootSectorFilePrompt
, BootSectorFileString
, 200))
198 // Generate a unique section name
199 sprintf(SectionName
, "CustomBootSectorFile%d%d%d%d%d%d", getyear(), getday(), getmonth(), gethour(), getminute(), getsecond());
202 if (!IniAddSection(SectionName
, &SectionId
))
208 if (!IniAddSettingValueToSection(SectionId
, "BootType", "BootSector"))
214 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
219 // Add the BootPartition
220 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
225 // Add the BootSectorFile
226 if (!IniAddSettingValueToSection(SectionId
, "BootSectorFile", BootSectorFileString
))
231 UiMessageBox(CustomBootPrompt
);
233 LoadAndBootBootSector(SectionName
);
236 VOID
OptionMenuCustomBootReactOS(VOID
)
238 UCHAR SectionName
[100];
239 UCHAR BootDriveString
[20];
240 UCHAR BootPartitionString
[20];
241 UCHAR ReactOSSystemPath
[200];
242 UCHAR ReactOSARCPath
[200];
243 UCHAR ReactOSOptions
[200];
246 RtlZeroMemory(SectionName
, sizeof(SectionName
));
247 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
248 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
249 RtlZeroMemory(ReactOSSystemPath
, sizeof(ReactOSSystemPath
));
250 RtlZeroMemory(ReactOSOptions
, sizeof(ReactOSOptions
));
252 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
257 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
262 if (!UiEditBox(ReactOSSystemPathPrompt
, ReactOSSystemPath
, 200))
267 if (!UiEditBox(ReactOSOptionsPrompt
, ReactOSOptions
, 200))
272 // Generate a unique section name
273 sprintf(SectionName
, "CustomReactOS%d%d%d%d%d%d", getyear(), getday(), getmonth(), gethour(), getminute(), getsecond());
276 if (!IniAddSection(SectionName
, &SectionId
))
282 if (!IniAddSettingValueToSection(SectionId
, "BootType", "ReactOS"))
287 // Construct the ReactOS ARC system path
288 ConstructArcPath(ReactOSARCPath
, ReactOSSystemPath
, DriveMapGetBiosDriveNumber(BootDriveString
), atoi(BootPartitionString
));
290 // Add the system path
291 if (!IniAddSettingValueToSection(SectionId
, "SystemPath", ReactOSARCPath
))
296 // Add the CommandLine
297 if (!IniAddSettingValueToSection(SectionId
, "Options", ReactOSOptions
))
302 UiMessageBox(CustomBootPrompt
);
304 LoadAndBootReactOS(SectionName
);
307 VOID
OptionMenuCustomBootLinux(VOID
)
309 UCHAR SectionName
[100];
310 UCHAR BootDriveString
[20];
311 UCHAR BootPartitionString
[20];
312 UCHAR LinuxKernelString
[200];
313 UCHAR LinuxInitrdString
[200];
314 UCHAR LinuxCommandLineString
[200];
317 RtlZeroMemory(SectionName
, sizeof(SectionName
));
318 RtlZeroMemory(BootDriveString
, sizeof(BootDriveString
));
319 RtlZeroMemory(BootPartitionString
, sizeof(BootPartitionString
));
320 RtlZeroMemory(LinuxKernelString
, sizeof(LinuxKernelString
));
321 RtlZeroMemory(LinuxInitrdString
, sizeof(LinuxInitrdString
));
322 RtlZeroMemory(LinuxCommandLineString
, sizeof(LinuxCommandLineString
));
324 if (!UiEditBox(BootDrivePrompt
, BootDriveString
, 20))
329 if (!UiEditBox(BootPartitionPrompt
, BootPartitionString
, 20))
334 if (!UiEditBox(LinuxKernelPrompt
, LinuxKernelString
, 200))
339 if (!UiEditBox(LinuxInitrdPrompt
, LinuxInitrdString
, 200))
344 if (!UiEditBox(LinuxCommandLinePrompt
, LinuxCommandLineString
, 200))
349 // Generate a unique section name
350 sprintf(SectionName
, "CustomLinux%d%d%d%d%d%d", getyear(), getday(), getmonth(), gethour(), getminute(), getsecond());
353 if (!IniAddSection(SectionName
, &SectionId
))
359 if (!IniAddSettingValueToSection(SectionId
, "BootType", "Linux"))
365 if (!IniAddSettingValueToSection(SectionId
, "BootDrive", BootDriveString
))
370 // Add the BootPartition
371 if (!IniAddSettingValueToSection(SectionId
, "BootPartition", BootPartitionString
))
377 if (!IniAddSettingValueToSection(SectionId
, "Kernel", LinuxKernelString
))
383 if (strlen(LinuxInitrdString
) > 0)
385 if (!IniAddSettingValueToSection(SectionId
, "Initrd", LinuxInitrdString
))
391 // Add the CommandLine
392 if (!IniAddSettingValueToSection(SectionId
, "CommandLine", LinuxCommandLineString
))
397 UiMessageBox(CustomBootPrompt
);
399 LoadAndBootLinux(SectionName
, "Custom Linux Setup");