X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=boot%2Ffreeldr%2Ffreeldr%2Foslist.c;h=967b4149fb285c5ad33068232d855b04e7f10602;hp=c51a86c72e7f50de91c1f0d800d1870e1ff95373;hb=950c86fb4cc00a5534aac9eeef2e2868cd19d2c3;hpb=8e37700e5c527418228fa2269adc06c7ebcebcb9;ds=sidebyside diff --git a/boot/freeldr/freeldr/oslist.c b/boot/freeldr/freeldr/oslist.c index c51a86c72e7..967b4149fb2 100644 --- a/boot/freeldr/freeldr/oslist.c +++ b/boot/freeldr/freeldr/oslist.c @@ -17,19 +17,25 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +/* INCLUDES *******************************************************************/ + #include +#define TAG_STRING ' rtS' +#define TAG_OS_ITEM 'tISO' + +/* FUNCTIONS ******************************************************************/ + static PCSTR CopyString(PCSTR Source) { PSTR Dest; if (!Source) return NULL; - Dest = MmHeapAlloc(strlen(Source) + 1); + + Dest = FrLdrHeapAlloc(strlen(Source) + 1, TAG_STRING); if (Dest) - { strcpy(Dest, Source); - } return Dest; } @@ -45,38 +51,24 @@ OperatingSystemItem* InitOperatingSystemList(ULONG* OperatingSystemCountPointer) ULONG Count; OperatingSystemItem* Items; - // - // Open the [FreeLoader] section - // + /* Open the [FreeLoader] section */ if (!IniOpenSection("Operating Systems", &SectionId)) - { return NULL; - } - // - // Count number of operating systems in the section - // + /* Count number of operating systems in the section */ Count = IniGetNumSectionItems(SectionId); - // - // Allocate memory to hold operating system lists - // - Items = MmHeapAlloc(Count * sizeof(OperatingSystemItem)); + /* Allocate memory to hold operating system lists */ + Items = FrLdrHeapAlloc(Count * sizeof(OperatingSystemItem), TAG_OS_ITEM); if (!Items) - { return NULL; - } - // - // Now loop through and read the operating system section and display names - // + /* Now loop through and read the operating system section and display names */ for (Idx = 0; Idx < Count; Idx++) { IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue)); - // - // Search start and end of the title - // + /* Search start and end of the title */ OsLoadOptions = NULL; TitleStart = SettingValue; while (*TitleStart == ' ' || *TitleStart == '"') @@ -92,17 +84,13 @@ OperatingSystemItem* InitOperatingSystemList(ULONG* OperatingSystemCountPointer) OsLoadOptions = TitleEnd + 1; } - // - // Copy the system partition, identifier and options - // + /* Copy the system partition, identifier and options */ Items[Idx].SystemPartition = CopyString(SettingName); Items[Idx].LoadIdentifier = CopyString(TitleStart); Items[Idx].OsLoadOptions = CopyString(OsLoadOptions); } - // - // Return success - // + /* Return success */ *OperatingSystemCountPointer = Count; return Items; }