Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 106 of file bootmgr.c.
Referenced by BootMain().
{ CHAR SettingValue[80]; CHAR BootType[80]; ULONG_PTR SectionId; ULONG OperatingSystemCount; OperatingSystemItem* OperatingSystemList; PCSTR *OperatingSystemDisplayNames; PCSTR SectionName; ULONG i; ULONG DefaultOperatingSystem; LONG TimeOut; ULONG SelectedOperatingSystem; // FIXME: if possible, only detect and register ARC devices... if (!MachHwDetect()) { UiMessageBoxCritical("Error when detecting hardware"); return; } #ifdef _M_IX86 // Load additional SCSI driver (if any) if (LoadBootDeviceDriver() != ESUCCESS) { UiMessageBoxCritical("Unable to load additional boot device driver"); } #endif if (!IniFileInitialize()) { UiMessageBoxCritical("Error initializing .ini file"); return; } if (!IniOpenSection("FreeLoader", &SectionId)) { UiMessageBoxCritical("Section [FreeLoader] not found in freeldr.ini."); return; } TimeOut = GetTimeOut(); if (!UiInitialize(TRUE)) { UiMessageBoxCritical("Unable to initialize UI."); return; } OperatingSystemList = InitOperatingSystemList(&OperatingSystemCount); if (!OperatingSystemList) { UiMessageBox("Unable to read operating systems section in freeldr.ini.\nPress ENTER to reboot."); goto reboot; } if (OperatingSystemCount == 0) { UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot."); goto reboot; } DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemList, OperatingSystemCount); // // Create list of display names // OperatingSystemDisplayNames = MmHeapAlloc(sizeof(PCSTR) * OperatingSystemCount); if (!OperatingSystemDisplayNames) { goto reboot; } for (i = 0; i < OperatingSystemCount; i++) { OperatingSystemDisplayNames[i] = OperatingSystemList[i].LoadIdentifier; } // // Find all the message box settings and run them // UiShowMessageBoxesInSection("FreeLoader"); for (;;) { // Redraw the backdrop UiDrawBackdrop(); // Show the operating system list menu if (!UiDisplayMenu(OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, TimeOut, &SelectedOperatingSystem, FALSE, MainBootMenuKeyPressFilter)) { UiMessageBox("Press ENTER to reboot."); goto reboot; } TimeOut = -1; // Try to open the operating system section in the .ini file SettingValue[0] = ANSI_NULL; SectionName = OperatingSystemList[SelectedOperatingSystem].SystemPartition; if (IniOpenSection(SectionName, &SectionId)) { // Try to read the boot type IniReadSettingByName(SectionId, "BootType", BootType, sizeof(BootType)); } else BootType[0] = ANSI_NULL; if (BootType[0] == ANSI_NULL && SectionName[0] != ANSI_NULL) { // Try to infere boot type value #ifdef _M_IX86 ULONG FileId; if (ArcOpen((CHAR*)SectionName, OpenReadOnly, &FileId) == ESUCCESS) { ArcClose(FileId); strcpy(BootType, "BootSector"); } else #endif { strcpy(BootType, "Windows"); } } // Get OS setting value IniOpenSection("Operating Systems", &SectionId); IniReadSettingByName(SectionId, SectionName, SettingValue, sizeof(SettingValue)); // Install the drive mapper according to this sections drive mappings #if defined(_M_IX86) && !defined(_MSC_VER) DriveMapMapDrivesInSection(SectionName); #endif #ifdef FREELDR_REACTOS_SETUP // WinLdr-style boot LoadReactOSSetup(); #elif defined(_M_IX86) if (_stricmp(BootType, "Windows") == 0) { LoadAndBootWindows(SectionName, SettingValue, 0); } else if (_stricmp(BootType, "WindowsNT40") == 0) { LoadAndBootWindows(SectionName, SettingValue, _WIN32_WINNT_NT4); } else if (_stricmp(BootType, "Windows2003") == 0) { LoadAndBootWindows(SectionName, SettingValue, _WIN32_WINNT_WS03); } else if (_stricmp(BootType, "Linux") == 0) { LoadAndBootLinux(SectionName, OperatingSystemDisplayNames[SelectedOperatingSystem]); } else if (_stricmp(BootType, "BootSector") == 0) { LoadAndBootBootSector(SectionName); } else if (_stricmp(BootType, "Partition") == 0) { LoadAndBootPartition(SectionName); } else if (_stricmp(BootType, "Drive") == 0) { LoadAndBootDrive(SectionName); } #else LoadAndBootWindows(SectionName, SettingValue, _WIN32_WINNT_WS03); #endif } reboot: UiUnInitialize("Rebooting..."); return; }