3 * Copyright (C) 1998-2002 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 // Variable BootDrive moved to asmcode.S
35 //ULONG BootDrive = 0; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
36 ULONG BootPartition
= 0; // Boot Partition, 1-4
38 ULONG
GetDefaultOperatingSystem(PUCHAR OperatingSystemList
[], ULONG OperatingSystemCount
);
39 LONG
GetTimeOut(VOID
);
44 UCHAR SettingName
[80];
45 UCHAR SettingValue
[80];
47 ULONG OperatingSystemCount
;
48 PUCHAR
*OperatingSystemSectionNames
;
49 PUCHAR
*OperatingSystemDisplayNames
;
50 ULONG DefaultOperatingSystem
;
52 ULONG SelectedOperatingSystem
;
60 InitMemoryManager( (PVOID
) 0x20000 /* BaseAddress */, 0x70000 /* Length */);
64 printf("Press any key to reboot.\n");
69 if (!OpenSection("FreeLoader", &SectionId
))
71 printf("Section [FreeLoader] not found in freeldr.ini.\n");
76 if (!InitUserInterface())
78 printf("Press any key to reboot.\n");
83 if (!InitOperatingSystemList(&OperatingSystemSectionNames
, &OperatingSystemDisplayNames
, &OperatingSystemCount
))
85 MessageBox("Press ENTER to reboot.\n");
89 if (OperatingSystemCount
== 0)
91 MessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot.");
95 DefaultOperatingSystem
= GetDefaultOperatingSystem(OperatingSystemSectionNames
, OperatingSystemCount
);
96 TimeOut
= GetTimeOut();
99 // Find all the message box settings and run them
101 ShowMessageBoxesInSection("FreeLoader");
105 if (!DisplayMenu(OperatingSystemDisplayNames
, OperatingSystemCount
, DefaultOperatingSystem
, TimeOut
, &SelectedOperatingSystem
))
107 MessageBox("Press ENTER to reboot.\n");
111 LoadAndBootReactOS(OperatingSystemSectionNames
[SelectedOperatingSystem
]);
113 /*switch (OSList[nOSToBoot].nOSType)
116 LoadAndBootReactOS(OSList[nOSToBoot].name);
119 MessageBox("Cannot boot this OS type yet!");
121 case OSTYPE_BOOTSECTOR:
122 LoadAndBootBootSector(nOSToBoot);
124 case OSTYPE_PARTITION:
125 LoadAndBootPartition(nOSToBoot);
128 LoadAndBootDrive(nOSToBoot);
140 ULONG
GetDefaultOperatingSystem(PUCHAR OperatingSystemList
[], ULONG OperatingSystemCount
)
142 UCHAR DefaultOSText
[80];
147 if (!OpenSection("FreeLoader", &SectionId
))
152 if (ReadSectionSettingByName(SectionId
, "DefaultOS", DefaultOSText
, 80))
154 for (Idx
=0; Idx
<OperatingSystemCount
; Idx
++)
156 if (stricmp(DefaultOSText
, OperatingSystemList
[Idx
]) == 0)
167 LONG
GetTimeOut(VOID
)
169 UCHAR TimeOutText
[20];
173 if (!OpenSection("FreeLoader", &SectionId
))
178 if (ReadSectionSettingByName(SectionId
, "TimeOut", TimeOutText
, 20))
180 TimeOut
= atoi(TimeOutText
);