diff --git a/rEFIt_UEFI/Platform/Nvram.cpp b/rEFIt_UEFI/Platform/Nvram.cpp index 82ffbe7ee..8e7857526 100644 --- a/rEFIt_UEFI/Platform/Nvram.cpp +++ b/rEFIt_UEFI/Platform/Nvram.cpp @@ -1142,7 +1142,7 @@ FindStartupDiskVolume ( // case insensitive cmp if (LoaderPath != NULL && StriCmp(gEfiBootLoaderPath, LoaderPath) == 0) { // that's the one - DBG (" - found entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title, Volume->VolName, LoaderPath); + DBG (" - found entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderPath); return Index; } } @@ -1165,7 +1165,7 @@ FindStartupDiskVolume ( // case insensitive cmp if (LoaderPath != NULL && StriCmp(gEfiBootLoaderPath, LoaderPath) == 0) { // that's the one - DBG (" - found entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title, Volume->VolName, LoaderPath); + DBG (" - found entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderPath); return Index; } } @@ -1188,7 +1188,7 @@ FindStartupDiskVolume ( Volume = MainMenu->Entries[Index].getLOADER_ENTRY()->Volume; } if (Volume != NULL && BootVolumeDevicePathEqual (gEfiBootVolume, Volume->DevicePath)) { - DBG (" - found entry %d. '%s', Volume '%s'\n", Index, MainMenu->Entries[Index].Title, Volume->VolName); + DBG (" - found entry %d. '%s', Volume '%s'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName); return Index; } } @@ -1205,7 +1205,7 @@ FindStartupDiskVolume ( Volume = MainMenu->Entries[Index].getLOADER_ENTRY()->Volume; } if (Volume != NULL && BootVolumeMediaDevicePathNodesEqual (gEfiBootVolume, Volume->DevicePath)) { - DBG (" - found entry %d. '%s', Volume '%s'\n", Index, MainMenu->Entries[Index].Title, Volume->VolName); + DBG (" - found entry %d. '%s', Volume '%s'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName); return Index; } } @@ -1251,7 +1251,7 @@ FindStartupDiskVolume ( //DBG (" OSType = %d\n", Volume->OSType); if (Volume->LegacyOS->Type == OSTYPE_WIN) { // that's the one - legacy win partition - DBG (" - found legacy entry %d. '%s', Volume '%s'\n", Index, LegacyEntry.Title, Volume->VolName); + DBG (" - found legacy entry %d. '%s', Volume '%s'\n", Index, LegacyEntry.Title.s(), Volume->VolName); return Index; } } @@ -1266,7 +1266,7 @@ FindStartupDiskVolume ( //DBG (" LoaderType = %d\n", LoaderEntry.LoaderType); if (LoaderEntry.LoaderType == OSTYPE_WINEFI) { // that's the one - win loader entry - DBG (" - found loader entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title, Volume->VolName, LoaderEntry.LoaderPath); + DBG (" - found loader entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderEntry.LoaderPath); return Index; } } @@ -1286,7 +1286,7 @@ FindStartupDiskVolume ( Volume = LegacyEntry.Volume; if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) { // that's the one - DBG (" - found legacy entry %d. '%s', Volume '%s'\n", Index, LegacyEntry.Title, Volume->VolName); + DBG (" - found legacy entry %d. '%s', Volume '%s'\n", Index, LegacyEntry.Title.s(), Volume->VolName); return Index; } @@ -1295,7 +1295,7 @@ FindStartupDiskVolume ( Volume = LoaderEntry.Volume; if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) { // that's the one - DBG (" - found loader entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title, Volume->VolName, LoaderEntry.LoaderPath); + DBG (" - found loader entry %d. '%s', Volume '%s', '%s'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderEntry.LoaderPath); return Index; } diff --git a/rEFIt_UEFI/cpp_foundation/XArray.h b/rEFIt_UEFI/cpp_foundation/XArray.h index 837d8449b..b64fbf72e 100755 --- a/rEFIt_UEFI/cpp_foundation/XArray.h +++ b/rEFIt_UEFI/cpp_foundation/XArray.h @@ -97,7 +97,7 @@ class XArray void RemoveAtIndex(int nIndex); void setEmpty(); - bool isEmpty() const { return size() == 0; } + bool isEmpty() const { return size() == 0; } xsize IdxOf(TYPE& e) const; bool ExistIn(TYPE& e) const { return IdxOf(e) != MAX_XSIZE; } diff --git a/rEFIt_UEFI/cpp_foundation/XStringW.cpp b/rEFIt_UEFI/cpp_foundation/XStringW.cpp index 244fa60fe..ebb171a53 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringW.cpp +++ b/rEFIt_UEFI/cpp_foundation/XStringW.cpp @@ -441,6 +441,10 @@ const XStringW &XStringW::operator =(const XStringW &aString) const XStringW &XStringW::operator =(const wchar_t *S) { //TRACE("Operator =const wchar_t *\n"); + if ( S == NULL ) { + DBG("operator =(const wchar_t *S) called with NULL\n"); + panic(); + } StrCpy(S); return *this; } diff --git a/rEFIt_UEFI/cpp_foundation/XStringW.h b/rEFIt_UEFI/cpp_foundation/XStringW.h index edc2452c7..5597a8906 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringW.h +++ b/rEFIt_UEFI/cpp_foundation/XStringW.h @@ -48,10 +48,13 @@ public: UINTN size() const { return m_len; } UINTN allocatedSize() const { return m_allocatedSize; } void SetLength(UINTN len); + const wchar_t* s() { return m_data; } /* IsNull ? */ - bool IsNull() const { return length() == 0 ; } - bool NotNull() const { return length() > 0 ; } + void setEmpty() { m_len = 0; } + bool isEmpty() const { return size() == 0; } +// bool IsNull() const { return size() == 0 ; } +// bool NotNull() const { return size() > 0 ; } /* Cast */ operator const wchar_t *() const { return data(); } diff --git a/rEFIt_UEFI/cpp_foundation/XStringWArray.h b/rEFIt_UEFI/cpp_foundation/XStringWArray.h index b1cc924b9..048280d1b 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringWArray.h +++ b/rEFIt_UEFI/cpp_foundation/XStringWArray.h @@ -37,7 +37,7 @@ class XStringWArray : public XStringWArraySuper // Add void AddStrings(const wchar_t *Val1, ...); - void AddNoNull(const XStringW &aString) { if ( aString.NotNull() ) AddCopy(aString); } + void AddNoNull(const XStringW &aString) { if ( !aString.isEmpty() ) AddCopy(aString); } void AddEvenNull(const XStringW &aString) { AddCopy(aString); } void Add(const XStringW &aString) { AddCopy(aString); } diff --git a/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp index 7836f38f3..cd38dc359 100755 --- a/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/XStringW_test.cpp @@ -24,7 +24,7 @@ int XStringW_tests() if ( str != L"12" ) return 4; XStringW str2; - if ( str2.NotNull() ) return 10; + if ( !str2.isEmpty() ) return 10; str2.StrnCpy(str.data(), 2); if ( str2 != L"12" ) return 11; str2.StrnCat(L"345", 2); diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index d5d9c825d..79e744441 100644 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -124,9 +124,9 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle, Entry->Title = EfiStrDuplicate(FullTitle); } else { if (GlobalConfig.BootCampStyle) { - Entry->Title = PoolPrint(L"%s", LoaderTitle); + Entry->Title.SPrintf("%ls", LoaderTitle); } else { - Entry->Title = PoolPrint(L"Boot %s from %s", LoaderTitle, VolDesc); + Entry->Title.SPrintf("Boot %ls from %ls", LoaderTitle, VolDesc); } } // DBG("Title=%s\n", Entry->Title); diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 94d77ce80..f71295db3 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -644,38 +644,37 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath, break; } - Entry->Title = NULL; - + if (FullTitle) { - Entry->Title = EfiStrDuplicate(FullTitle); + Entry->Title = FullTitle; } - if ( Entry->Title == NULL && Volume->VolLabel != NULL ) { + if ( Entry->Title.isEmpty() && Volume->VolLabel != NULL ) { if ( Volume->VolLabel[0] == L'#' ) { - Entry->Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel+1); + Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel+1); }else{ - Entry->Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel); + Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel); } } - if ( Entry->Title == NULL && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) { + if ( Entry->Title.isEmpty() && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) { //DBG("encounter Entry->VolName ==%s and StrLen(Entry->VolName) ==%d\n",Entry->VolName, StrLen(Entry->VolName)); if (GlobalConfig.BootCampStyle) { - Entry->Title = PoolPrint(L"%s", ((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString))); + Entry->Title.SPrintf("%ls", ((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString))); } else { - Entry->Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), + Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Basename(Volume->DevicePathString)); } } - if ( Entry->Title == NULL ) { + if ( Entry->Title.isEmpty() ) { //DBG("encounter LoaderTitle ==%s and Entry->VolName ==%s\n", LoaderTitle, Entry->VolName); if (GlobalConfig.BootCampStyle) { if ((StriCmp(LoaderTitle, L"macOS") == 0) || (StriCmp(LoaderTitle, L"Recovery") == 0)) { - Entry->Title = PoolPrint(L"%s", Entry->VolName); + Entry->Title.SPrintf("%ls", Entry->VolName); } else { - Entry->Title = PoolPrint(L"%s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath)); + Entry->Title.SPrintf("%ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath)); } } else { - Entry->Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), + Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Entry->VolName); } } @@ -683,7 +682,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath, // just an example that UI can show hibernated volume to the user // should be better to show it on entry image if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) { - Entry->Title = PoolPrint(L"%s (hibernated)", Entry->Title); + Entry->Title.SPrintf("%ls (hibernated)", Entry->Title.s()); } Entry->ShortcutLetter = (Hotkey == 0) ? ShortcutLetter : Hotkey; @@ -754,7 +753,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry) // create the submenu // SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); SubScreen = new REFIT_MENU_SCREEN; - SubScreen->Title = PoolPrint(L"Options for %s", Entry->Title, Entry->VolName); + SubScreen->Title = PoolPrint(L"Options for %s", Entry->Title.s(), Entry->VolName); SubScreen->TitleImage = Entry->Image; SubScreen->ID = Entry->LoaderType + 20; // DBG("get anime for os=%d\n", SubScreen->ID); @@ -885,10 +884,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry) if (SubEntry) { FreePool(SubEntry->LoadOptions); if (Quiet) { - SubEntry->Title = PoolPrint(L"%s verbose", Entry->Title); + SubEntry->Title = PoolPrint(L"%s verbose", Entry->Title.s()); SubEntry->LoadOptions = RemoveLoadOption(Entry->LoadOptions, L"quiet"); } else { - SubEntry->Title = PoolPrint(L"%s quiet", Entry->Title); + SubEntry->Title = PoolPrint(L"%s quiet", Entry->Title.s()); SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"quiet"); } } @@ -897,10 +896,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry) if (SubEntry) { FreePool(SubEntry->LoadOptions); if (WithSplash) { - SubEntry->Title = PoolPrint(L"%s without splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s without splash", Entry->Title.s()); SubEntry->LoadOptions = RemoveLoadOption(Entry->LoadOptions, L"splash"); } else { - SubEntry->Title = PoolPrint(L"%s with splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s with splash", Entry->Title.s()); SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"splash"); } } @@ -911,22 +910,22 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry) if (WithSplash) { if (Quiet) { TempOptions = RemoveLoadOption(Entry->LoadOptions, L"splash"); - SubEntry->Title = PoolPrint(L"%s verbose without splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s verbose without splash", Entry->Title.s()); SubEntry->LoadOptions = RemoveLoadOption(TempOptions, L"quiet"); FreePool(TempOptions); } else { TempOptions = RemoveLoadOption(Entry->LoadOptions, L"splash"); - SubEntry->Title = PoolPrint(L"%s quiet without splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s quiet without splash", Entry->Title.s()); SubEntry->LoadOptions = AddLoadOption(TempOptions, L"quiet"); FreePool(TempOptions); } } else if (Quiet) { TempOptions = RemoveLoadOption(Entry->LoadOptions, L"quiet"); - SubEntry->Title = PoolPrint(L"%s verbose with splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s verbose with splash", Entry->Title.s()); SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"splash"); FreePool(TempOptions); } else { - SubEntry->Title = PoolPrint(L"%s quiet with splash", Entry->Title); + SubEntry->Title = PoolPrint(L"%s quiet with splash", Entry->Title.s()); SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"quiet splash"); } } diff --git a/rEFIt_UEFI/entry_scan/securemenu.cpp b/rEFIt_UEFI/entry_scan/securemenu.cpp index f4f5e05be..74de98d7e 100644 --- a/rEFIt_UEFI/entry_scan/securemenu.cpp +++ b/rEFIt_UEFI/entry_scan/securemenu.cpp @@ -67,12 +67,12 @@ VOID AddSecureBootTool(VOID) // Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY)); if (gSettings.SecureBoot) { Entry = new REFIT_MENU_ENTRY_SECURE_BOOT(); - Entry->Title = PoolPrint(L"Clover Secure Boot Configuration"); + Entry->Title.SPrintf("Clover Secure Boot Configuration"); // Entry->Tag = TAG_SECURE_BOOT_CONFIG; Entry->Image = BuiltinIcon(BUILTIN_ICON_FUNC_SECURE_BOOT_CONFIG); } else { Entry = new REFIT_MENU_ENTRY_SECURE_BOOT_CONFIG(); - Entry->Title = PoolPrint(L"Enable Clover Secure Boot"); + Entry->Title.SPrintf("Enable Clover Secure Boot"); // Entry->Tag = TAG_SECURE_BOOT; Entry->Image = BuiltinIcon(BUILTIN_ICON_FUNC_SECURE_BOOT); } @@ -442,7 +442,7 @@ BOOLEAN ConfigureSecureBoot(VOID) EFI_DEVICE_PATH *DevicePath = NULL; // Add the entry for secure boot policy SecureBootPolicyEntry.Title = PoolPrint(L"Secure boot policy: %s", SecureBootPolicyToStr(gSettings.SecureBootPolicy)); - if (SecureBootPolicyEntry.Title == NULL) { + if (SecureBootPolicyEntry.Title.isEmpty()) { break; } SecureBootPolicyMenu.Title = SecureBootPolicyEntry.Title; diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 4672fe2df..12b3dde8e 100644 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -92,7 +92,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *FullTi if (FullTitle) { Entry->Title = EfiStrDuplicate(FullTitle); } else { - Entry->Title = PoolPrint(L"Start %s", LoaderTitle); + Entry->Title.SPrintf("Start %ls", LoaderTitle); } // Entry->Tag = TAG_TOOL; Entry->Row = 1; diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h index 41e01bd85..71d2084c9 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h @@ -91,7 +91,7 @@ public: : ID(0), Title(0), TitleImage(0), TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0), - Frames(0), FrameTime(0), FilmPlace({0,0,0,0}), + Frames(0), FrameTime(0), Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) {}; @@ -99,14 +99,14 @@ public: : ID(ID), Title(Title), TitleImage(0), TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0), - Frames(0), FrameTime(0), FilmPlace({0,0,0,0}), + Frames(0), FrameTime(0), Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) {}; REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2) : ID(ID), Title(Title), TitleImage(0), TimeoutSeconds(0), TimeoutText(TimeoutText), Theme(0), AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0), - Frames(0), FrameTime(0), FilmPlace({0,0,0,0}), + Frames(0), FrameTime(0), Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle) { Entries.AddReference(entry1, false); diff --git a/rEFIt_UEFI/gui/menu_items/menu_items.h b/rEFIt_UEFI/gui/menu_items/menu_items.h index 5e2d3063a..1ad15fac5 100644 --- a/rEFIt_UEFI/gui/menu_items/menu_items.h +++ b/rEFIt_UEFI/gui/menu_items/menu_items.h @@ -96,7 +96,7 @@ class XPointer; class REFIT_ABSTRACT_MENU_ENTRY { public: - CONST CHAR16 *Title; + XStringW Title; UINTN Row; CHAR16 ShortcutDigit; CHAR16 ShortcutLetter; @@ -131,9 +131,15 @@ class REFIT_ABSTRACT_MENU_ENTRY virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return nullptr; }; virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return nullptr; }; - REFIT_ABSTRACT_MENU_ENTRY() : Title(NULL), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {}; - REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {}; - REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {}; + REFIT_ABSTRACT_MENU_ENTRY() : Title(""), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) + {}; + REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) + {}; + REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) + {}; + REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) + : Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_), Image(NULL), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) + {}; REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, EG_IMAGE* Image_, EG_RECT Place_, ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, @@ -169,59 +175,39 @@ class REFIT_ABSTRACT_MENU_ENTRY class REFIT_MENU_ITEM_RETURN : public REFIT_ABSTRACT_MENU_ENTRY { public: + REFIT_MENU_ITEM_RETURN() : REFIT_ABSTRACT_MENU_ENTRY() {}; REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) - : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL) + : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_) {}; -// REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, -// EG_IMAGE* Image_, EG_RECT Place_, -// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, -// REFIT_MENU_SCREEN *SubScreen_) -// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_) -// {}; virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; }; }; class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_ABSTRACT_MENU_ENTRY { public: + REFIT_MENU_ITEM_SHUTDOWN() : REFIT_ABSTRACT_MENU_ENTRY() {}; REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) - : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL) + : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_) {}; -// REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, -// EG_IMAGE* Image_, EG_RECT Place_, -// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, -// REFIT_MENU_SCREEN *SubScreen_) -// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_) -// {}; virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return this; }; }; class REFIT_MENU_ITEM_RESET : public REFIT_ABSTRACT_MENU_ENTRY { public: + REFIT_MENU_ITEM_RESET() : REFIT_ABSTRACT_MENU_ENTRY() {}; REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) - : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL) + : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_) {}; -// REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, -// EG_IMAGE* Image_, EG_RECT Place_, -// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, -// REFIT_MENU_SCREEN *SubScreen_) -// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_) -// {}; virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return this; }; }; class REFIT_MENU_ITEM_ABOUT : public REFIT_ABSTRACT_MENU_ENTRY { public: + REFIT_MENU_ITEM_ABOUT() : REFIT_ABSTRACT_MENU_ENTRY() {}; REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) - : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL) + : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_) {}; -// REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, -// EG_IMAGE* Image_, EG_RECT Place_, -// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, -// REFIT_MENU_SCREEN *SubScreen_) -// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_) -// {}; virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return this; }; }; @@ -229,14 +215,8 @@ class REFIT_ABSTRACT_MENU_ENTRY public: REFIT_MENU_ITEM_OPTIONS() : REFIT_ABSTRACT_MENU_ENTRY() {}; REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_) - : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL) + : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_) {}; -// REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, -// EG_IMAGE* Image_, EG_RECT Place_, -// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_, -// REFIT_MENU_SCREEN *SubScreen_) -// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_) -// {}; virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; }; }; diff --git a/rEFIt_UEFI/libeg/XPointer.cpp b/rEFIt_UEFI/libeg/XPointer.cpp index f93f84c1b..ba363d1bb 100644 --- a/rEFIt_UEFI/libeg/XPointer.cpp +++ b/rEFIt_UEFI/libeg/XPointer.cpp @@ -104,10 +104,10 @@ EFI_STATUS XPointer::MouseBirth() VOID XPointer::Draw() { - + oldPlace = newPlace; +// CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ? // take background image for later to restore background oldImage.GetArea(newPlace); - CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ? PointerImage->Draw(newPlace.XPos, newPlace.YPos, 0.f); //zero means no scale } @@ -184,7 +184,7 @@ VOID XPointer::UpdatePointer() if (newPlace.YPos < 0) newPlace.YPos = 0; if (newPlace.YPos > UGAHeight - 1) newPlace.YPos = UGAHeight - 1; - if ( CompareMem(&oldPlace, &newPlace, sizeof(__typeof__(oldPlace))) != 0 ) { + if ( oldPlace != newPlace ) { Hide(); Draw(); } diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index 53f852342..37f38daba 100644 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -174,12 +174,19 @@ typedef struct { BOOLEAN HasAlpha; //moved here to avoid alignment issue } EG_IMAGE; -typedef struct { +class EG_RECT { +public: INTN XPos; INTN YPos; INTN Width; INTN Height; -} EG_RECT; + + EG_RECT() : XPos(0), YPos(0), Width(0), Height(0) {}; + EG_RECT(const EG_RECT& other) { XPos = other.XPos; YPos = other.YPos; Width = other.Width; Height = other.Height; } + const EG_RECT& operator = (const EG_RECT& other) { XPos = other.XPos; YPos = other.YPos; Width = other.Width; Height = other.Height; return *this; } + bool operator == (const EG_RECT& other) { return XPos == other.XPos && YPos == other.YPos && Width == other.Width && Height == other.Height; } + bool operator != (const EG_RECT& other) { return !(*this == other); } +}; #define TEXT_YMARGIN (2) diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 5a8c1658d..0b71ff0e8 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -1074,7 +1074,7 @@ static VOID StartTool(IN REFIT_MENU_ENTRY_LOADER_TOOL *Entry) DBG("Start Tool: %s\n", Entry->LoaderPath); egClearScreen(&DarkBackgroundPixel); // assumes "Start " as assigned below - BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS), Entry->Title + 6); + BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS), &Entry->Title[6]); // Shouldn't we check that length of Title is at least 6 ? StartEFIImage(Entry->DevicePath, Entry->LoadOptions, Basename(Entry->LoaderPath), Basename(Entry->LoaderPath), NULL, NULL); FinishExternalScreen(); //ReinitSelfLib(); @@ -1584,7 +1584,7 @@ INTN FindDefaultEntry(VOID) Index = FindStartupDiskVolume(&MainMenu); if (Index >= 0) { - DBG("Boot redirected to Entry %d. '%s'\n", Index, MainMenu.Entries[Index].Title); + DBG("Boot redirected to Entry %d. '%s'\n", Index, MainMenu.Entries[Index].Title.s()); // we got boot-device-data, no need to keep emulating anymore if (gEmuVariableControl != NULL) { gEmuVariableControl->UninstallEmulation(gEmuVariableControl); @@ -1625,7 +1625,7 @@ INTN FindDefaultEntry(VOID) continue; } - DBG(" - found entry %d. '%s', Volume '%s', DevicePath '%s'\n", Index, Entry.Title, Volume->VolName, Entry.DevicePathString); + DBG(" - found entry %d. '%s', Volume '%s', DevicePath '%s'\n", Index, Entry.Title.s(), Volume->VolName, Entry.DevicePathString); // if first method failed and second succeeded - uninstall emulation if (gEmuVariableControl != NULL) { gEmuVariableControl->UninstallEmulation(gEmuVariableControl); diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index d5f36c0b0..b542a6de5 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -1344,7 +1344,7 @@ VOID REFIT_MENU_SCREEN::AddMenuInfo(CONST CHAR16 *Line) // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INFO_DIALOG; - InputBootArgs->Title = PoolPrint(L"%s", Line); + InputBootArgs->Title.SPrintf("%ls", Line); // InputBootArgs->Tag = TAG_INFO; // InputBootArgs->Item = NULL; InputBootArgs->AtClick = ActionLight; @@ -1404,7 +1404,7 @@ VOID AboutRefit(VOID) EntryCount instead of InfoLineCount. Lastline == return/back. Is necessary recheck screen res here? */ FreePool(AboutMenu.Entries[AboutMenu.Entries.size()-2].Title); - AboutMenu.Entries[AboutMenu.Entries.size()-2].Title = PoolPrint(L" Screen Output: %s", egScreenDescription()); + AboutMenu.Entries[AboutMenu.Entries.size()-2].Title.SPrintf(" Screen Output: %ls", egScreenDescription()); } AboutMenu.RunMenu(NULL); @@ -4353,11 +4353,11 @@ UINTN REFIT_MENU_SCREEN::RunMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title) { - if (Title) { - Entry->Title = PoolPrint(L"%a", Title); - } else { - Entry->Title = (__typeof__(Entry->Title))AllocateZeroPool(128); - } + Entry->Title.SPrintf("%s", Title); +// if (Title) { +// } else { +// Entry->Title = (__typeof__(Entry->Title))AllocateZeroPool(128); +// } Entry->Image = OptionMenu.TitleImage; Entry->AtClick = AtClick; @@ -4395,7 +4395,7 @@ VOID REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum) // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_MENU_CHECKBIT; - InputBootArgs->Title = PoolPrint(L"%a", Text); + InputBootArgs->Title.SPrintf("%s", Text); // InputBootArgs->Tag = TAG_CHECKBIT_OLD; InputBootArgs->Row = Bit; InputBootArgs->Item = &InputItems[ItemNum]; @@ -4407,11 +4407,13 @@ VOID REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum) VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) { if (ChosenEntry->SubScreen->ID == SCREEN_DSDT) { - UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix +// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix + ChosenEntry->Title.SPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix //MsgLog("@ESC: %s\n", (*ChosenEntry)->Title); } else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) { // CSR - UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix +// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix + ChosenEntry->Title.SPrintf("System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix // check for the right booter flag to allow the application // of the new System Integrity Protection configuration. if (gSettings.CsrActiveConfig != 0 && gSettings.BooterConfig == 0) { @@ -4419,15 +4421,17 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) } } else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) { - UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix +// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix + ChosenEntry->Title.SPrintf("boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix } else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) { - UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix +// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix + ChosenEntry->Title.SPrintf("Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix } } VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor) { - InputBootArgs->Title = PoolPrint(L"%a", Line); + InputBootArgs->Title.SPrintf("%s", Line); if (Inx == 3 || Inx == 116) { InputBootArgs->Row = 0; } else { @@ -4641,7 +4645,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextPatches() for (Index = 0; Index < NrKexts; Index++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"%30a", KextPatchesMenu[Index].Label); + InputBootArgs->Title.SPrintf("%30s", KextPatchesMenu[Index].Label); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(KextPatchesMenu[Index].MenuItem); @@ -4682,7 +4686,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer) } // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"%s, v.%s", Kext->FileName, Kext->Version); + InputBootArgs->Title.SPrintf("%ls, v.%ls", Kext->FileName, Kext->Version); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(Kext->MenuItem); @@ -4694,7 +4698,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer) while (plugInKext) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L" |-- %s, v.%s", plugInKext->FileName, plugInKext->Version); + InputBootArgs->Title.SPrintf(" |-- %ls, v.%ls", plugInKext->FileName, plugInKext->Version); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(plugInKext->MenuItem); @@ -4848,7 +4852,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKernelPatches() for (Index = 0; Index < NrKernels; Index++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"%30a", KernelPatchesMenu[Index].Label); + InputBootArgs->Title.SPrintf("%30s", KernelPatchesMenu[Index].Label); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(KernelPatchesMenu[Index].MenuItem); @@ -4875,7 +4879,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBootPatches() for (Index = 0; Index < NrBoots; Index++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"%30a", BootPatchesMenu[Index].Label); + InputBootArgs->Title.SPrintf("%30s", BootPatchesMenu[Index].Label); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(BootPatchesMenu[Index].MenuItem); @@ -4948,7 +4952,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables() // DropTable->Length, DropTable->Length); // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"Drop \"%4.4a\" \"%8.8a\" %d", sign, OTID, DropTable->Length); + InputBootArgs->Title.SPrintf("Drop \"%4.4s\" \"%8.8s\" %d", sign, OTID, DropTable->Length); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(DropTable->MenuItem); @@ -4969,7 +4973,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables() while (ACPIPatchedAMLTmp) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"Drop \"%s\"", ACPIPatchedAMLTmp->FileName); + InputBootArgs->Title.SPrintf("Drop \"%ls\"", ACPIPatchedAMLTmp->FileName); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &(ACPIPatchedAMLTmp->MenuItem); @@ -5022,7 +5026,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM() // create the entry in the main menu Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSM, NULL); - // Entry->Title = PoolPrint(L"Drop OEM _DSM [0x%04x]->", gSettings.DropOEM_DSM); + // Entry->Title.SPrintf("Drop OEM _DSM [0x%04x]->", gSettings.DropOEM_DSM); // submenu description SubScreen->AddMenuInfoLine(PoolPrint(L"Choose devices to drop OEM _DSM methods from DSDT")); @@ -5055,7 +5059,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix() // REFIT_INPUT_DIALOG *InputBootArgs; Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NULL); - // Entry->Title = PoolPrint(L"DSDT fix mask [0x%08x]->", gSettings.FixDsdt); + // Entry->Title.SPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt); SubScreen->AddMenuCheck("Add DTGP", FIX_DTGP, 67); SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67); @@ -5111,7 +5115,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() //yyyy for (Index = 0; Index < PatchDsdtNum; Index++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L"%a", gSettings.PatchDsdtLabel[Index]); + InputBootArgs->Title.SPrintf("%s", gSettings.PatchDsdtLabel[Index]); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Item = &DSDTPatchesMenu[Index]; @@ -5139,7 +5143,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts() for (i = 0; i < DsdtsNum; i++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_MENU_SWITCH; - InputBootArgs->Title = PoolPrint(L"%s", DsdtsList[i]); + InputBootArgs->Title.SPrintf("%ls", DsdtsList[i]); // InputBootArgs->Tag = TAG_SWITCH_OLD; InputBootArgs->Row = i + 1; InputBootArgs->Item = &InputItems[116]; @@ -5192,7 +5196,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort() for (i = 0; i < AudioNum; i++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_MENU_SWITCH; - InputBootArgs->Title = PoolPrint(L"%s_%a", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]); + InputBootArgs->Title.SPrintf("%ls_%s", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]); // InputBootArgs->Tag = TAG_SWITCH_OLD; InputBootArgs->Row = i; InputBootArgs->Item = &InputItems[119]; @@ -5211,7 +5215,7 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop) // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title = PoolPrint(L" key: %a", Prop->Key); + InputBootArgs->Title.SPrintf(" key: %s", Prop->Key); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor // InputBootArgs->Item = ADDRESS_OF(DEV_PROPERTY, Prop, INPUT_ITEM, MenuItem); @@ -5324,7 +5328,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes() for (i = 0; i < ThemesNum; i++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_MENU_SWITCH; - InputBootArgs->Title = PoolPrint(L"%s", ThemesList[i]); + InputBootArgs->Title.SPrintf("%ls", ThemesList[i]); // InputBootArgs->Tag = TAG_SWITCH_OLD; InputBootArgs->Row = i + 1; InputBootArgs->Item = &InputItems[3]; @@ -5403,7 +5407,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC() // create the entry in the main menu Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BLC, NULL); -// Entry->Title = PoolPrint(L"boot_args->flags [0x%02x]->", gSettings.BooterConfig); +// Entry->Title.SPrintf("boot_args->flags [0x%02x]->", gSettings.BooterConfig); // submenu description SubScreen->AddMenuInfoLine(PoolPrint(L"Modify flags for boot.efi")); @@ -5460,7 +5464,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs() for (i = 0; i < ConfigsNum; i++) { // InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG)); InputBootArgs = new REFIT_MENU_SWITCH; - InputBootArgs->Title = PoolPrint(L"%s", ConfigsList[i]); + InputBootArgs->Title.SPrintf("%ls", ConfigsList[i]); // InputBootArgs->Tag = TAG_SWITCH_OLD; InputBootArgs->Row = i; InputBootArgs->Item = &InputItems[90]; diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index efa3b3d60..c825ea049 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -77,7 +77,7 @@ INTN UGAWidth; INTN UGAHeight; BOOLEAN AllowGraphicsMode; -EG_RECT BannerPlace = {0, 0, 0, 0}; +EG_RECT BannerPlace; // default ctor called, so it's zero EG_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff}; EG_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00};