* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <freeldr.h>
-#include <rtl.h>
-#include <fs.h>
-#include <reactos.h>
-#include <ui.h>
-#include <arch.h>
-#include <miscboot.h>
-#include <linux.h>
-#include <mm.h>
-#include <inifile.h>
-#include <debug.h>
-#include <options.h>
-#include <oslist.h>
-#include <video.h>
-#include <bootmgr.h>
-#include <drivemap.h>
-#include <keycodes.h>
-#include <cmdline.h>
-#include <machine.h>
VOID RunLoader(VOID)
{
- UCHAR SettingName[80];
- UCHAR SettingValue[80];
- U32 SectionId;
- U32 OperatingSystemCount;
- PUCHAR *OperatingSystemSectionNames;
- PUCHAR *OperatingSystemDisplayNames;
- U32 DefaultOperatingSystem;
- S32 TimeOut;
- U32 SelectedOperatingSystem;
+ CHAR SettingName[80];
+ CHAR SettingValue[80];
+ ULONG SectionId;
+ ULONG OperatingSystemCount;
+ PCSTR *OperatingSystemSectionNames;
+ PCSTR *OperatingSystemDisplayNames;
+ ULONG DefaultOperatingSystem;
+ LONG TimeOut;
+ ULONG SelectedOperatingSystem;
+
+ if (!FsOpenBootVolume())
+ {
+ printf("Error opening boot partition for file access.\n");
+ MachConsGetCh();
+ return;
+ }
if (!IniFileInitialize())
{
MachConsGetCh();
return;
}
-
+
if (!InitOperatingSystemList(&OperatingSystemSectionNames, &OperatingSystemDisplayNames, &OperatingSystemCount))
{
UiMessageBox("Press ENTER to reboot.\n");
goto reboot;
}
-
+
if (OperatingSystemCount == 0)
{
UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot.");
}
DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemSectionNames, OperatingSystemCount);
-
+
//
// Find all the message box settings and run them
//
for (;;)
{
-
+
/* If Timeout is 0, don't even bother loading any gui */
if (!UserInterfaceUp) {
+ SelectedOperatingSystem = DefaultOperatingSystem;
goto NoGui;
}
-
+
// Redraw the backdrop
UiDrawBackdrop();
UiMessageBox("Press ENTER to reboot.\n");
goto reboot;
}
-
+
NoGui:
TimeOut = -1;
- DefaultOperatingSystem = SelectedOperatingSystem;
// Try to open the operating system section in the .ini file
if (!IniOpenSection(OperatingSystemSectionNames[SelectedOperatingSystem], &SectionId))
// Install the drive mapper according to this sections drive mappings
DriveMapMapDrivesInSection(OperatingSystemSectionNames[SelectedOperatingSystem]);
- if (stricmp(SettingValue, "ReactOS") == 0)
+ if (_stricmp(SettingValue, "ReactOS") == 0)
{
LoadAndBootReactOS(OperatingSystemSectionNames[SelectedOperatingSystem]);
}
- else if (stricmp(SettingValue, "Linux") == 0)
+ else if (_stricmp(SettingValue, "Linux") == 0)
{
LoadAndBootLinux(OperatingSystemSectionNames[SelectedOperatingSystem], OperatingSystemDisplayNames[SelectedOperatingSystem]);
}
- else if (stricmp(SettingValue, "BootSector") == 0)
+ else if (_stricmp(SettingValue, "BootSector") == 0)
{
LoadAndBootBootSector(OperatingSystemSectionNames[SelectedOperatingSystem]);
}
- else if (stricmp(SettingValue, "Partition") == 0)
+ else if (_stricmp(SettingValue, "Partition") == 0)
{
LoadAndBootPartition(OperatingSystemSectionNames[SelectedOperatingSystem]);
}
- else if (stricmp(SettingValue, "Drive") == 0)
+ else if (_stricmp(SettingValue, "Drive") == 0)
{
LoadAndBootDrive(OperatingSystemSectionNames[SelectedOperatingSystem]);
}
}
-
+
reboot:
UiUnInitialize("Rebooting...");
return;
}
-U32 GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32 OperatingSystemCount)
+ULONG GetDefaultOperatingSystem(PCSTR OperatingSystemList[], ULONG OperatingSystemCount)
{
- UCHAR DefaultOSText[80];
- char* DefaultOSName;
- U32 SectionId;
- U32 DefaultOS = 0;
- U32 Idx;
+ CHAR DefaultOSText[80];
+ PCSTR DefaultOSName;
+ ULONG SectionId;
+ ULONG DefaultOS = 0;
+ ULONG Idx;
if (!IniOpenSection("FreeLoader", &SectionId))
{
{
for (Idx=0; Idx<OperatingSystemCount; Idx++)
{
- if (stricmp(DefaultOSName, OperatingSystemList[Idx]) == 0)
+ if (_stricmp(DefaultOSName, OperatingSystemList[Idx]) == 0)
{
DefaultOS = Idx;
break;
return DefaultOS;
}
-S32 GetTimeOut(VOID)
+LONG GetTimeOut(VOID)
{
- UCHAR TimeOutText[20];
- S32 TimeOut;
- U32 SectionId;
+ CHAR TimeOutText[20];
+ LONG TimeOut;
+ ULONG SectionId;
TimeOut = CmdLineGetTimeOut();
if (0 <= TimeOut)
return TimeOut;
}
-BOOL MainBootMenuKeyPressFilter(U32 KeyPress)
+BOOL MainBootMenuKeyPressFilter(ULONG KeyPress)
{
if (KeyPress == KEY_F8)
{