Make the debugging functions slightly more portable.
[reactos.git] / reactos / boot / freeldr / freeldr / bootmgr.c
index d00d3c8..a191b18 100644 (file)
  */
 
 #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())
        {
@@ -131,23 +120,23 @@ NoGui:
 
                // 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]);
                }
@@ -159,13 +148,13 @@ reboot:
        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))
        {
@@ -185,7 +174,7 @@ U32  GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32     OperatingSyste
        {
                for (Idx=0; Idx<OperatingSystemCount; Idx++)
                {
-                       if (stricmp(DefaultOSName, OperatingSystemList[Idx]) == 0)
+                       if (_stricmp(DefaultOSName, OperatingSystemList[Idx]) == 0)
                        {
                                DefaultOS = Idx;
                                break;
@@ -196,11 +185,11 @@ U32        GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32     OperatingSyste
        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)
@@ -225,7 +214,7 @@ S32 GetTimeOut(VOID)
        return TimeOut;
 }
 
-BOOL MainBootMenuKeyPressFilter(U32 KeyPress)
+BOOL MainBootMenuKeyPressFilter(ULONG KeyPress)
 {
        if (KeyPress == KEY_F8)
        {