ReactOS 0.4.15-dev-7834-g00c4b3d
custom.c File Reference
#include <freeldr.h>
Include dependency graph for custom.c:

Go to the source code of this file.

Functions

VOID EditCustomBootReactOS (IN OUT OperatingSystemItem *OperatingSystem, IN BOOLEAN IsSetup)
 

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 ARCPathPrompt [] = "Enter the boot ARC path.\n\nExamples:\nmulti(0)disk(0)rdisk(0)partition(1)\nmulti(0)disk(0)fdisk(0)"
 
const CHAR ReactOSSystemPathPrompt [] = "Enter the path to your ReactOS system directory.\n\nExamples:\n\\REACTOS\n\\ROS"
 
const CHAR ReactOSOptionsPrompt [] = "Enter the load 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 ReactOSSetupOptionsPrompt [] = "Enter additional load options you want passed to the ReactOS Setup.\nThese options will supplement those obtained from the TXTSETUP.SIF\nfile, unless you also specify the /SIFOPTIONSOVERRIDE option switch.\n\nExample:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /NOGUIBOOT"
 
const CHAR CustomBootPrompt [] = "Press ENTER to boot your custom boot setup."
 

Function Documentation

◆ EditCustomBootReactOS()

VOID EditCustomBootReactOS ( IN OUT OperatingSystemItem OperatingSystem,
IN BOOLEAN  IsSetup 
)

Definition at line 619 of file custom.c.

622{
623 TIMEINFO* TimeInfo;
624 ULONG_PTR SectionId = OperatingSystem->SectionId;
625 CHAR SectionName[100];
626 CHAR BootDriveString[20];
627 CHAR BootPartitionString[20];
628 CHAR ReactOSSystemPath[200];
629 CHAR ReactOSARCPath[200];
630 CHAR ReactOSOptions[200];
631
632 RtlZeroMemory(SectionName, sizeof(SectionName));
633 RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
634 RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString));
635 RtlZeroMemory(ReactOSSystemPath, sizeof(ReactOSSystemPath));
636 RtlZeroMemory(ReactOSARCPath, sizeof(ReactOSARCPath));
637 RtlZeroMemory(ReactOSOptions, sizeof(ReactOSOptions));
638
639 if (SectionId != 0)
640 {
641 /* Load the settings */
642 IniReadSettingByName(SectionId, "SystemPath", ReactOSARCPath, sizeof(ReactOSARCPath));
643 IniReadSettingByName(SectionId, "Options", ReactOSOptions, sizeof(ReactOSOptions));
644 }
645
646 if (SectionId == 0)
647 {
648 if (!UiEditBox(BootDrivePrompt, BootDriveString, sizeof(BootDriveString)))
649 return;
650
651 if (!UiEditBox(BootPartitionPrompt, BootPartitionString, sizeof(BootPartitionString)))
652 return;
653
654 if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSSystemPath, sizeof(ReactOSSystemPath)))
655 return;
656 }
657 else
658 {
659 if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSARCPath, sizeof(ReactOSARCPath)))
660 return;
661 }
662
663 if (!UiEditBox(IsSetup ? ReactOSSetupOptionsPrompt : ReactOSOptionsPrompt, ReactOSOptions, sizeof(ReactOSOptions)))
664 return;
665
666 /* Modify the settings values and return if we were in edit mode */
667 if (SectionId != 0)
668 {
669 IniModifySettingValue(SectionId, "SystemPath", ReactOSARCPath);
670 IniModifySettingValue(SectionId, "Options", ReactOSOptions);
671 return;
672 }
673
674 /* Generate a unique section name */
675 TimeInfo = ArcGetTime();
676 RtlStringCbPrintfA(SectionName, sizeof(SectionName),
677 "CustomReactOS%u%u%u%u%u%u",
678 TimeInfo->Year, TimeInfo->Day, TimeInfo->Month,
679 TimeInfo->Hour, TimeInfo->Minute, TimeInfo->Second);
680
681 /* Add the section */
682 if (!IniAddSection(SectionName, &SectionId))
683 return;
684
685 /* Add the BootType */
686 if (!IniAddSettingValueToSection(SectionId, "BootType", IsSetup ? "ReactOSSetup" : "Windows2003"))
687 return;
688
689 /* Construct the ReactOS ARC system path */
690 ConstructArcPath(ReactOSARCPath, ReactOSSystemPath,
691 DriveMapGetBiosDriveNumber(BootDriveString),
692 atoi(BootPartitionString));
693
694 /* Add the system path */
695 if (!IniAddSettingValueToSection(SectionId, "SystemPath", ReactOSARCPath))
696 return;
697
698 /* Add the CommandLine */
699 if (!IniAddSettingValueToSection(SectionId, "Options", ReactOSOptions))
700 return;
701
702 OperatingSystem->SectionId = SectionId;
703 OperatingSystem->LoadIdentifier = NULL;
704}
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
Definition: arcname.c:175
const CHAR ReactOSSystemPathPrompt[]
Definition: custom.c:38
const CHAR BootDrivePrompt[]
Definition: custom.c:35
const CHAR ReactOSOptionsPrompt[]
Definition: custom.c:39
const CHAR ReactOSSetupOptionsPrompt[]
Definition: custom.c:40
const CHAR BootPartitionPrompt[]
Definition: custom.c:36
#define DriveMapGetBiosDriveNumber(DeviceName)
Definition: hardware.h:35
BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.c:634
#define NULL
Definition: types.h:112
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:182
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:255
BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:296
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:149
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
Definition: fw.h:10
USHORT Month
Definition: fw.h:12
USHORT Day
Definition: fw.h:13
USHORT Minute
Definition: fw.h:15
USHORT Hour
Definition: fw.h:14
USHORT Second
Definition: fw.h:16
USHORT Year
Definition: fw.h:11
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
char CHAR
Definition: xmlstorage.h:175

Referenced by EditCustomBootNTOS(), and EditCustomBootReactOSSetup().

Variable Documentation

◆ ARCPathPrompt

const CHAR ARCPathPrompt[] = "Enter the boot ARC path.\n\nExamples:\nmulti(0)disk(0)rdisk(0)partition(1)\nmulti(0)disk(0)fdisk(0)"

Definition at line 37 of file custom.c.

◆ 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 EditCustomBootReactOS().

◆ 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 EditCustomBootReactOS().

◆ CustomBootPrompt

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

Definition at line 41 of file custom.c.

◆ ReactOSOptionsPrompt

const CHAR ReactOSOptionsPrompt[] = "Enter the load 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 39 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ ReactOSSetupOptionsPrompt

const CHAR ReactOSSetupOptionsPrompt[] = "Enter additional load options you want passed to the ReactOS Setup.\nThese options will supplement those obtained from the TXTSETUP.SIF\nfile, unless you also specify the /SIFOPTIONSOVERRIDE option switch.\n\nExample:\n/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /NOGUIBOOT"

Definition at line 40 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ ReactOSSystemPathPrompt

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

Definition at line 38 of file custom.c.

Referenced by EditCustomBootReactOS().