X-Git-Url: https://code.delx.au/refind/blobdiff_plain/58b80c84377dfbef8b113754f90cbbb45b57b69f..7c898f4a26b66344e4cc8ed5c2e272d5ea0a71dc:/refind/main.c diff --git a/refind/main.c b/refind/main.c index 9558655..8f4cf39 100644 --- a/refind/main.c +++ b/refind/main.c @@ -110,7 +110,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.3.1"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.5"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); @@ -118,7 +118,7 @@ static VOID AboutrEFInd(VOID) AddMenuInfoLine(&AboutMenu, L"Distributed under the terms of the GNU GPLv3 license"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Running on:"); - TempStr = AllocateZeroPool(255 * sizeof(CHAR16)); + TempStr = AllocateZeroPool(256 * sizeof(CHAR16)); SPrint(TempStr, 255, L" EFI Revision %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & ((1 << 16) - 1)); AddMenuInfoLine(&AboutMenu, TempStr); #if defined(EFI32) @@ -128,11 +128,11 @@ static VOID AboutrEFInd(VOID) #else AddMenuInfoLine(&AboutMenu, L" Platform: unknown"); #endif - TempStr = AllocateZeroPool(255 * sizeof(CHAR16)); + TempStr = AllocateZeroPool(256 * sizeof(CHAR16)); SPrint(TempStr, 255, L" Firmware: %s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & ((1 << 16) - 1)); AddMenuInfoLine(&AboutMenu, TempStr); - TempStr = AllocateZeroPool(255 * sizeof(CHAR16)); + TempStr = AllocateZeroPool(256 * sizeof(CHAR16)); SPrint(TempStr, 255, L" Screen Output: %s", egScreenDescription()); AddMenuInfoLine(&AboutMenu, TempStr); AddMenuInfoLine(&AboutMenu, L""); @@ -198,7 +198,9 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, MergeStrings(&FullLoadOptions, L" ", 0); // NOTE: That last space is also added by the EFI shell and seems to be significant // when passing options to Apple's boot.efi... - } + } else { + MergeStrings(&FullLoadOptions, LoadOptions, 0); + } // if/else // NOTE: We also include the terminating null in the length for safety. ChildLoadedImage->LoadOptions = (VOID *)FullLoadOptions; ChildLoadedImage->LoadOptionsSize = ((UINT32)StrLen(FullLoadOptions) + 1) * sizeof(CHAR16); @@ -411,7 +413,7 @@ LOADER_ENTRY *InitializeLoaderEntry(IN LOADER_ENTRY *Entry) { // Returns a pointer to the new subscreen data structure, or NULL if there // were problems allocating memory. REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry) { - CHAR16 *FileName, *Temp = NULL, *TitleStr; + CHAR16 *FileName, *Temp = NULL; REFIT_MENU_SCREEN *SubScreen = NULL; LOADER_ENTRY *SubEntry; @@ -419,9 +421,9 @@ REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry) { if (Entry->me.SubScreen == NULL) { // No subscreen yet; initialize default entry.... SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); if (SubScreen != NULL) { - TitleStr = AllocateZeroPool(sizeof(CHAR16) * 256); - SPrint(TitleStr, 255, L"Boot Options for %s on %s", (Entry->Title != NULL) ? Entry->Title : FileName, Entry->VolName); - SubScreen->Title = TitleStr; + SubScreen->Title = AllocateZeroPool(sizeof(CHAR16) * 256); + SPrint(SubScreen->Title, 255, L"Boot Options for %s on %s", + (Entry->Title != NULL) ? Entry->Title : FileName, Entry->VolName); SubScreen->TitleImage = Entry->me.Image; // default entry SubEntry = InitializeLoaderEntry(Entry); @@ -734,15 +736,13 @@ VOID SetLoaderDefaults(LOADER_ENTRY *Entry, CHAR16 *LoaderPath, IN REFIT_VOLUME // for icons, options, etc. LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume) { LOADER_ENTRY *Entry; - CHAR16 *PoolStr; CleanUpPathNameSlashes(LoaderPath); Entry = InitializeLoaderEntry(NULL); if (Entry != NULL) { Entry->Title = StrDuplicate((LoaderTitle != NULL) ? LoaderTitle : LoaderPath); - PoolStr = AllocateZeroPool(sizeof(CHAR16) * 256); - SPrint(PoolStr, 255, L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName); - Entry->me.Title = PoolStr; + Entry->me.Title = AllocateZeroPool(sizeof(CHAR16) * 256); + SPrint(Entry->me.Title, 255, L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName); Entry->me.Row = 0; Entry->me.BadgeImage = Volume->VolBadgeImage; if ((LoaderPath != NULL) && (LoaderPath[0] != L'\\')) { @@ -1139,8 +1139,9 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry) (UGAHeight - BootLogoImage->Height) >> 1, &StdBackgroundPixel); - if (Entry->Volume->IsMbrPartition) + if (Entry->Volume->IsMbrPartition) { ActivateMbrPartition(Entry->Volume->WholeDiskBlockIO, Entry->Volume->MbrPartitionIndex); + } ExtractLegacyLoaderPaths(DiscoveredPathList, MAX_DISCOVERED_PATHS, LegacyLoaderList); @@ -1162,7 +1163,6 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Vo REFIT_MENU_SCREEN *SubScreen; CHAR16 *VolDesc; CHAR16 ShortcutLetter = 0; - CHAR16 *PoolStr; if (LoaderTitle == NULL) { if (Volume->OSName != NULL) { @@ -1179,9 +1179,8 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Vo // prepare the menu entry Entry = AllocateZeroPool(sizeof(LEGACY_ENTRY)); - PoolStr = AllocateZeroPool(256 * sizeof(CHAR16)); - SPrint(PoolStr, 255, L"Boot %s from %s", LoaderTitle, VolDesc); - Entry->me.Title = PoolStr; + Entry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16)); + SPrint(Entry->me.Title, 255, L"Boot %s from %s", LoaderTitle, VolDesc); Entry->me.Tag = TAG_LEGACY; Entry->me.Row = 0; Entry->me.ShortcutLetter = ShortcutLetter; @@ -1194,16 +1193,14 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Vo // create the submenu SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); - PoolStr = AllocateZeroPool(256 * sizeof(CHAR16)); - SPrint(PoolStr, 255, L"Boot Options for %s on %s", LoaderTitle, VolDesc); - SubScreen->Title = PoolStr; + SubScreen->Title = AllocateZeroPool(256 * sizeof(CHAR16)); + SPrint(SubScreen->Title, 255, L"Boot Options for %s on %s", LoaderTitle, VolDesc); SubScreen->TitleImage = Entry->me.Image; // default entry SubEntry = AllocateZeroPool(sizeof(LEGACY_ENTRY)); - PoolStr = AllocateZeroPool(256 * sizeof(CHAR16)); - SPrint(PoolStr, 255, L"Boot %s", LoaderTitle); - SubEntry->me.Title = PoolStr; + SubEntry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16)); + SPrint(SubEntry->me.Title, 255, L"Boot %s", LoaderTitle); SubEntry->me.Tag = TAG_LEGACY; SubEntry->Volume = Entry->Volume; SubEntry->LoadOptions = Entry->LoadOptions;