diff --git a/reactos/boot/freeldr/freeldr/bootmgr.c b/reactos/boot/freeldr/freeldr/bootmgr.c index 758b952e68a..9fa910354cc 100644 --- a/reactos/boot/freeldr/freeldr/bootmgr.c +++ b/reactos/boot/freeldr/freeldr/bootmgr.c @@ -19,15 +19,95 @@ #include +ULONG GetDefaultOperatingSystem(OperatingSystemItem* OperatingSystemList, ULONG OperatingSystemCount) +{ + CHAR DefaultOSText[80]; + PCSTR DefaultOSName; + ULONG_PTR SectionId; + ULONG DefaultOS = 0; + ULONG Idx; + + if (!IniOpenSection("FreeLoader", &SectionId)) + { + return 0; + } + + DefaultOSName = CmdLineGetDefaultOS(); + if (NULL == DefaultOSName) + { + if (IniReadSettingByName(SectionId, "DefaultOS", DefaultOSText, sizeof(DefaultOSText))) + { + DefaultOSName = DefaultOSText; + } + } + + if (NULL != DefaultOSName) + { + for (Idx=0; Idx + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/* component.c */ +CONFIGURATION_COMPONENT* ArcGetChild(CONFIGURATION_COMPONENT *Current); +CONFIGURATION_COMPONENT* ArcGetParent(CONFIGURATION_COMPONENT *Current); +CONFIGURATION_COMPONENT* ArcGetPeer(CONFIGURATION_COMPONENT *Current); +CONFIGURATION_COMPONENT* +ArcAddChild( + CONFIGURATION_COMPONENT *Current, + CONFIGURATION_COMPONENT *Template, + VOID *ConfigurationData); +LONG +ArcDeleteComponent( + CONFIGURATION_COMPONENT *ComponentToDelete); +LONG +ArcGetConfigurationData( + VOID* ConfigurationData, + CONFIGURATION_COMPONENT* Component); + +/* mm.c */ +MEMORY_DESCRIPTOR* +ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current); + +/* time.c */ +TIMEINFO* ArcGetTime(VOID); +ULONG ArcGetRelativeTime(VOID); diff --git a/reactos/boot/freeldr/freeldr/include/bootmgr.h b/reactos/boot/freeldr/freeldr/include/bootmgr.h deleted file mode 100644 index f04a4b0e553..00000000000 --- a/reactos/boot/freeldr/freeldr/include/bootmgr.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __BOOTMGR_H -#define __BOOTMGR_H - - -ULONG GetDefaultOperatingSystem(PCSTR OperatingSystemList[], ULONG OperatingSystemCount); -LONG GetTimeOut(VOID); -BOOLEAN MainBootMenuKeyPressFilter(ULONG KeyPress); - - -#endif // #defined __BOOTMGR_H diff --git a/reactos/boot/freeldr/freeldr/include/freeldr.h b/reactos/boot/freeldr/freeldr/include/freeldr.h index 406e117876e..761af015769 100644 --- a/reactos/boot/freeldr/freeldr/include/freeldr.h +++ b/reactos/boot/freeldr/freeldr/include/freeldr.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -97,7 +98,6 @@ #include #include /* Needed by boot manager */ -#include #include #include #include diff --git a/reactos/boot/freeldr/freeldr/include/machine.h b/reactos/boot/freeldr/freeldr/include/machine.h index 0a138661f14..440755de6a7 100644 --- a/reactos/boot/freeldr/freeldr/include/machine.h +++ b/reactos/boot/freeldr/freeldr/include/machine.h @@ -100,9 +100,6 @@ BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size); BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber); -TIMEINFO* ArcGetTime(VOID); -ULONG ArcGetRelativeTime(VOID); -VOID MachHwDetect(VOID); VOID MachPrepareForReactOS(IN BOOLEAN Setup); #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) diff --git a/reactos/boot/freeldr/freeldr/include/oslist.h b/reactos/boot/freeldr/freeldr/include/oslist.h index 81f5ed5c963..0f3ab77faef 100644 --- a/reactos/boot/freeldr/freeldr/include/oslist.h +++ b/reactos/boot/freeldr/freeldr/include/oslist.h @@ -20,9 +20,13 @@ #ifndef __OSLIST_H #define __OSLIST_H -BOOLEAN InitOperatingSystemList(PCSTR **SectionNamesPointer, PCSTR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer); -ULONG CountOperatingSystems(ULONG SectionId); -BOOLEAN AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPointer, ULONG OperatingSystemCount); -BOOLEAN RemoveQuotes(PCHAR QuotedString); +typedef struct tagOperatingSystemItem +{ + PCSTR SystemPartition; + PCSTR LoadIdentifier; + PCSTR OsLoadOptions; +} OperatingSystemItem; + +OperatingSystemItem* InitOperatingSystemList(ULONG* OperatingSystemCountPointer); #endif // #defined __OSLIST_H diff --git a/reactos/boot/freeldr/freeldr/linuxboot.c b/reactos/boot/freeldr/freeldr/linuxboot.c index 0ca98fd728f..e3755c97046 100644 --- a/reactos/boot/freeldr/freeldr/linuxboot.c +++ b/reactos/boot/freeldr/freeldr/linuxboot.c @@ -41,6 +41,36 @@ PVOID LinuxInitrdLoadAddress = NULL; CHAR LinuxBootDescription[80]; CHAR LinuxBootPath[260] = ""; +BOOLEAN RemoveQuotes(PCHAR QuotedString) +{ + CHAR TempString[200]; + PCHAR p; + PSTR Start; + + // + // Skip spaces up to " + // + p = QuotedString; + while (*p == ' ' || *p == '"') + p++; + Start = p; + + // + // Go up to next " + // + while (*p != '"' && *p != ANSI_NULL) + p++; + *p = ANSI_NULL; + + // + // Copy result + // + strcpy(TempString, Start); + strcpy(QuotedString, TempString); + + return TRUE; +} + VOID LoadAndBootLinux(PCSTR OperatingSystemName, PCSTR Description) { PFILE LinuxKernel = 0; diff --git a/reactos/boot/freeldr/freeldr/machine.c b/reactos/boot/freeldr/freeldr/machine.c index b3159e538bf..9021a7c57a7 100644 --- a/reactos/boot/freeldr/freeldr/machine.c +++ b/reactos/boot/freeldr/freeldr/machine.c @@ -41,7 +41,6 @@ #undef MachDiskReadLogicalSectors #undef MachDiskGetDriveGeometry #undef MachDiskGetCacheableBlockCount -#undef MachHwDetect MACHVTBL MachVtbl; @@ -177,10 +176,4 @@ MachDiskGetCacheableBlockCount(ULONG DriveNumber) return MachVtbl.DiskGetCacheableBlockCount(DriveNumber); } -VOID -MachHwDetect(VOID) -{ - MachVtbl.HwDetect(); -} - /* EOF */ diff --git a/reactos/boot/freeldr/freeldr/oslist.c b/reactos/boot/freeldr/freeldr/oslist.c index d10debd817b..24313b157ba 100644 --- a/reactos/boot/freeldr/freeldr/oslist.c +++ b/reactos/boot/freeldr/freeldr/oslist.c @@ -19,179 +19,90 @@ #include -BOOLEAN InitOperatingSystemList(PCSTR **SectionNamesPointer, PCSTR **DisplayNamesPointer, ULONG* OperatingSystemCountPointer) +static PCSTR CopyString(PCSTR Source) { - ULONG Idx; - ULONG CurrentOperatingSystemIndex; - CHAR SettingName[260]; - CHAR SettingValue[260]; - ULONG OperatingSystemCount; - ULONG_PTR SectionId; - ULONG SectionSettingCount; - PCHAR *OperatingSystemSectionNames; - PCHAR *OperatingSystemDisplayNames; + PSTR Dest; + + if (!Source) + return NULL; + Dest = MmHeapAlloc(strlen(Source) + 1); + if (Dest) + { + strcpy(Dest, Source); + } + + return Dest; +} + +OperatingSystemItem* InitOperatingSystemList(ULONG* OperatingSystemCountPointer) +{ + ULONG Idx; + CHAR SettingName[260]; + CHAR SettingValue[260]; + ULONG_PTR SectionId; + PCHAR TitleStart, TitleEnd; + PCSTR OsLoadOptions; + ULONG Count; + OperatingSystemItem* Items; // // Open the [FreeLoader] section // if (!IniOpenSection("Operating Systems", &SectionId)) { - UiMessageBox("Section [Operating Systems] not found in freeldr.ini."); - return FALSE; + return NULL; } - SectionSettingCount = IniGetNumSectionItems(SectionId); - OperatingSystemCount = CountOperatingSystems(SectionId); + // + // Count number of operating systems in the section + // + Count = IniGetNumSectionItems(SectionId); // // Allocate memory to hold operating system lists // - if (!AllocateListMemory(&OperatingSystemSectionNames, &OperatingSystemDisplayNames, OperatingSystemCount)) + Items = MmHeapAlloc(Count * sizeof(OperatingSystemItem)); + if (!Items) { - return FALSE; + return NULL; } // // Now loop through and read the operating system section and display names // - CurrentOperatingSystemIndex = 0; - for (Idx=0; Idx