ReactOS 0.4.15-dev-8419-g7f0e8a3
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

static const PCSTR BootDrivePrompt
 
static const PCSTR BootPartitionPrompt
 
static const PCSTR ARCPathPrompt
 
static const PCSTR ReactOSSystemPathPrompt
 
static const PCSTR ReactOSOptionsPrompt
 
static const PCSTR ReactOSSetupOptionsPrompt
 
static const PCSTR CustomBootPrompt
 

Function Documentation

◆ EditCustomBootReactOS()

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

Definition at line 486 of file custom.c.

489{
490 TIMEINFO* TimeInfo;
491 ULONG_PTR SectionId = OperatingSystem->SectionId;
492 CHAR SectionName[100];
493 CHAR BootDriveString[20];
494 CHAR BootPartitionString[20];
495 CHAR ReactOSSystemPath[200];
496 CHAR ReactOSARCPath[200];
497 CHAR ReactOSOptions[200];
498
499 RtlZeroMemory(SectionName, sizeof(SectionName));
500 RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
501 RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString));
502 RtlZeroMemory(ReactOSSystemPath, sizeof(ReactOSSystemPath));
503 RtlZeroMemory(ReactOSARCPath, sizeof(ReactOSARCPath));
504 RtlZeroMemory(ReactOSOptions, sizeof(ReactOSOptions));
505
506 if (SectionId != 0)
507 {
508 /* Load the settings */
509 IniReadSettingByName(SectionId, "SystemPath", ReactOSARCPath, sizeof(ReactOSARCPath));
510 IniReadSettingByName(SectionId, "Options", ReactOSOptions, sizeof(ReactOSOptions));
511 }
512
513 if (SectionId == 0)
514 {
515 if (!UiEditBox(BootDrivePrompt, BootDriveString, sizeof(BootDriveString)))
516 return;
517
518 if (!UiEditBox(BootPartitionPrompt, BootPartitionString, sizeof(BootPartitionString)))
519 return;
520
521 if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSSystemPath, sizeof(ReactOSSystemPath)))
522 return;
523 }
524 else
525 {
526 if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSARCPath, sizeof(ReactOSARCPath)))
527 return;
528 }
529
530 if (!UiEditBox(IsSetup ? ReactOSSetupOptionsPrompt : ReactOSOptionsPrompt, ReactOSOptions, sizeof(ReactOSOptions)))
531 return;
532
533 /* Modify the settings values and return if we were in edit mode */
534 if (SectionId != 0)
535 {
536 IniModifySettingValue(SectionId, "SystemPath", ReactOSARCPath);
537 IniModifySettingValue(SectionId, "Options", ReactOSOptions);
538 return;
539 }
540
541 /* Generate a unique section name */
542 TimeInfo = ArcGetTime();
543 RtlStringCbPrintfA(SectionName, sizeof(SectionName),
544 "CustomReactOS%u%u%u%u%u%u",
545 TimeInfo->Year, TimeInfo->Day, TimeInfo->Month,
546 TimeInfo->Hour, TimeInfo->Minute, TimeInfo->Second);
547
548 /* Add the section */
549 if (!IniAddSection(SectionName, &SectionId))
550 return;
551
552 /* Add the BootType */
553 if (!IniAddSettingValueToSection(SectionId, "BootType", IsSetup ? "ReactOSSetup" : "Windows2003"))
554 return;
555
556 /* Construct the ReactOS ARC system path */
557 ConstructArcPath(ReactOSARCPath, ReactOSSystemPath,
558 DriveMapGetBiosDriveNumber(BootDriveString),
559 atoi(BootPartitionString));
560
561 /* Add the system path */
562 if (!IniAddSettingValueToSection(SectionId, "SystemPath", ReactOSARCPath))
563 return;
564
565 /* Add the CommandLine */
566 if (!IniAddSettingValueToSection(SectionId, "Options", ReactOSOptions))
567 return;
568
569 OperatingSystem->SectionId = SectionId;
570 OperatingSystem->LoadIdentifier = NULL;
571}
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
Definition: arcname.c:175
static const PCSTR BootPartitionPrompt
Definition: custom.c:69
static const PCSTR ReactOSSetupOptionsPrompt
Definition: custom.c:100
static const PCSTR ReactOSSystemPathPrompt
Definition: custom.c:86
static const PCSTR BootDrivePrompt
Definition: custom.c:56
static const PCSTR ReactOSOptionsPrompt
Definition: custom.c:92
#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)
PINI_SECTION IniAddSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
Definition: inicache.c:838
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 PCSTR ARCPathPrompt
static
Initial value:
=
"Enter the boot ARC path.\n"
"\n"
"Examples:\n"
"multi(0)disk(0)rdisk(0)partition(1)\n"
"multi(0)disk(0)fdisk(0)"

Definition at line 79 of file custom.c.

◆ BootDrivePrompt

const PCSTR BootDrivePrompt
static
Initial value:
=
"Enter the boot drive.\n"
"\n"
"Examples:\n"
"fd0 - first floppy drive\n"
"hd0 - first hard drive\n"
"hd1 - second hard drive\n"
"cd0 - first CD-ROM drive.\n"
"\n"
"BIOS drive numbers may also be used:\n"
"0 - first floppy drive\n"
"0x80 - first hard drive\n"
"0x81 - second hard drive"

Definition at line 56 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ BootPartitionPrompt

const PCSTR BootPartitionPrompt
static
Initial value:
=
"Enter the boot partition.\n"

Definition at line 69 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ CustomBootPrompt

const PCSTR CustomBootPrompt
static
Initial value:
=
"Press ENTER to boot your custom boot setup."

Definition at line 108 of file custom.c.

◆ ReactOSOptionsPrompt

const PCSTR ReactOSOptionsPrompt
static
Initial value:
=
"Enter the load options you want passed to the kernel.\n"
"\n"
"Examples:\n"
"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200\n"
"/FASTDETECT /SOS /NOGUIBOOT\n"
"/BASEVIDEO /MAXMEM=64\n"
"/KERNEL=NTKRNLMP.EXE /HAL=HALMPS.DLL"

Definition at line 92 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ ReactOSSetupOptionsPrompt

const PCSTR ReactOSSetupOptionsPrompt
static
Initial value:
=
"Enter additional load options you want passed to the ReactOS Setup.\n"
"These options will supplement those obtained from the TXTSETUP.SIF\n"
"file, unless you also specify the /SIFOPTIONSOVERRIDE option switch.\n"
"\n"
"Example:\n"
"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /NOGUIBOOT"

Definition at line 100 of file custom.c.

Referenced by EditCustomBootReactOS().

◆ ReactOSSystemPathPrompt

const PCSTR ReactOSSystemPathPrompt
static
Initial value:
=
"Enter the path to your ReactOS system directory.\n"
"\n"
"Examples:\n"
"\\REACTOS\n"
"\\ROS"

Definition at line 86 of file custom.c.

Referenced by EditCustomBootReactOS().