ReactOS  0.4.13-dev-257-gfabbd7c
custom.c File Reference
#include <freeldr.h>
Include dependency graph for custom.c:

Go to the source code of this file.

Functions

VOID OptionMenuCustomBoot (VOID)
 
VOID OptionMenuCustomBootReactOS (VOID)
 
VOID OptionMenuReboot (VOID)
 

Variables

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"
 
const CHAR BootPartitionPrompt [] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition."
 
const CHAR ReactOSSystemPathPrompt [] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS"
 
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"
 
const CHAR CustomBootPrompt [] = "Press ENTER to boot your custom boot setup."
 

Function Documentation

◆ OptionMenuCustomBoot()

VOID OptionMenuCustomBoot ( VOID  )

Definition at line 43 of file custom.c.

44 {
45  PCSTR CustomBootMenuList[] = {
46 #ifdef _M_IX86
47  "Disk",
48  "Partition",
49  "Boot Sector File",
50  "Linux",
51 #endif
52  "ReactOS"
53  };
54  ULONG SelectedMenuItem;
55 
56  if (!UiDisplayMenu("Please choose a boot method:", "",
57  FALSE,
58  CustomBootMenuList,
59  sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]),
60  0, -1,
61  &SelectedMenuItem,
62  TRUE,
63  NULL))
64  {
65  /* The user pressed ESC */
66  return;
67  }
68 
69  switch (SelectedMenuItem)
70  {
71 #ifdef _M_IX86
72  case 0: // Disk
73  OptionMenuCustomBootDisk();
74  break;
75  case 1: // Partition
76  OptionMenuCustomBootPartition();
77  break;
78  case 2: // Boot Sector File
79  OptionMenuCustomBootBootSectorFile();
80  break;
81  case 3: // Linux
82  OptionMenuCustomBootLinux();
83  break;
84  case 4: // ReactOS
85 #else
86  case 0:
87 #endif
89  break;
90  }
91 }
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG *SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
Definition: ui.c:459
VOID OptionMenuCustomBootReactOS(VOID)
Definition: custom.c:323
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:51

Referenced by DoOptionsMenu().

◆ OptionMenuCustomBootReactOS()

VOID OptionMenuCustomBootReactOS ( VOID  )

Definition at line 323 of file custom.c.

324 {
325  ULONG_PTR SectionId;
326  CHAR SectionName[100];
327  CHAR BootDriveString[20];
328  CHAR BootPartitionString[20];
329  CHAR ReactOSSystemPath[200];
330  CHAR ReactOSARCPath[200];
331  CHAR ReactOSOptions[200];
332  TIMEINFO* TimeInfo;
333  OperatingSystemItem OperatingSystem;
334 
335  RtlZeroMemory(SectionName, sizeof(SectionName));
336  RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
337  RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString));
338  RtlZeroMemory(ReactOSSystemPath, sizeof(ReactOSSystemPath));
339  RtlZeroMemory(ReactOSOptions, sizeof(ReactOSOptions));
340 
341  if (!UiEditBox(BootDrivePrompt, BootDriveString, 20))
342  return;
343 
344  if (!UiEditBox(BootPartitionPrompt, BootPartitionString, 20))
345  return;
346 
347  if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSSystemPath, 200))
348  return;
349 
350  if (!UiEditBox(ReactOSOptionsPrompt, ReactOSOptions, 200))
351  return;
352 
353  /* Generate a unique section name */
354  TimeInfo = ArcGetTime();
355  sprintf(SectionName, "CustomReactOS%u%u%u%u%u%u", TimeInfo->Year, TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute, TimeInfo->Second);
356 
357  /* Add the section */
358  if (!IniAddSection(SectionName, &SectionId))
359  return;
360 
361  /* Add the BootType */
362  if (!IniAddSettingValueToSection(SectionId, "BootType", "Windows2003"))
363  return;
364 
365  /* Construct the ReactOS ARC system path */
366  ConstructArcPath(ReactOSARCPath, ReactOSSystemPath, DriveMapGetBiosDriveNumber(BootDriveString), atoi(BootPartitionString));
367 
368  /* Add the system path */
369  if (!IniAddSettingValueToSection(SectionId, "SystemPath", ReactOSARCPath))
370  return;
371 
372  /* Add the CommandLine */
373  if (!IniAddSettingValueToSection(SectionId, "Options", ReactOSOptions))
374  return;
375 
377 
378  OperatingSystem.SystemPartition = SectionName;
379  OperatingSystem.LoadIdentifier = NULL;
380  OperatingSystem.OsLoadOptions = NULL; // ReactOSOptions
381 
382  // LoadAndBootWindows(&OperatingSystem, _WIN32_WINNT_WS03);
383  LoadOperatingSystem(&OperatingSystem);
384 }
char CHAR
Definition: xmlstorage.h:175
const CHAR BootDrivePrompt[]
Definition: custom.c:35
USHORT Second
Definition: fw.h:16
USHORT Month
Definition: fw.h:12
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define sprintf(buf, format,...)
Definition: sprintf.c:55
USHORT Minute
Definition: fw.h:15
Definition: fw.h:9
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:347
smooth NULL
Definition: ftsmooth.c:416
const CHAR ReactOSSystemPathPrompt[]
Definition: custom.c:37
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
Definition: arcname.c:157
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:252
USHORT Year
Definition: fw.h:11
TIMEINFO * ArcGetTime(VOID)
Definition: machine.c:27
const CHAR CustomBootPrompt[]
Definition: custom.c:39
USHORT Hour
Definition: fw.h:14
#define DriveMapGetBiosDriveNumber(DeviceName)
Definition: hardware.h:35
BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.c:474
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID LoadOperatingSystem(IN OperatingSystemItem *OperatingSystem)
Definition: bootmgr.c:56
USHORT Day
Definition: fw.h:13
const CHAR BootPartitionPrompt[]
Definition: custom.c:36
const CHAR ReactOSOptionsPrompt[]
Definition: custom.c:38
BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:179

Referenced by OptionMenuCustomBoot().

◆ OptionMenuReboot()

VOID OptionMenuReboot ( VOID  )

Definition at line 386 of file custom.c.

387 {
388  UiMessageBox("The system will now reboot.");
389 
390 #if defined(__i386__) || defined(_M_AMD64)
392 #endif
393  Reboot();
394 }
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:347
Definition: bl.h:892
VOID DiskStopFloppyMotor(VOID)
Definition: macharm.c:62

Referenced by DoOptionsMenu().

Variable Documentation

◆ BootDrivePrompt

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"

Definition at line 35 of file custom.c.

Referenced by OptionMenuCustomBootReactOS().

◆ BootPartitionPrompt

const CHAR BootPartitionPrompt[] = "Enter the boot partition.\n\nEnter 0 for the active (bootable) partition."

Definition at line 36 of file custom.c.

Referenced by OptionMenuCustomBootReactOS().

◆ CustomBootPrompt

const CHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup."

Definition at line 39 of file custom.c.

Referenced by OptionMenuCustomBootReactOS().

◆ ReactOSOptionsPrompt

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"

Definition at line 38 of file custom.c.

Referenced by OptionMenuCustomBootReactOS().

◆ ReactOSSystemPathPrompt

const CHAR ReactOSSystemPathPrompt[] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS"

Definition at line 37 of file custom.c.

Referenced by OptionMenuCustomBootReactOS().