From cc3c8fe0a7bab653101244a661bb12636f4c54a1 Mon Sep 17 00:00:00 2001 From: jief666 Date: Fri, 23 Apr 2021 15:20:48 +0300 Subject: [PATCH] Fix bug : it was ignoring legacy with PBR, MBR and CD. Uncomment eComStation, BeOS, ZETA and Haiku legacy boot sector detection. Return unknown icon instead of dummy. Improve legacy entries title when _LoaderTitle is empty. Create log_technical_bug(). Temporary redirected to panic. Hardened egLoadFile(). Hardened SelfOem. Copy ctor in XStringArray. Improve qemu launch scripts. --- BaseTools/Conf/tools_def.template | 10 +- Qemu/gdb_launch | 31 +- Qemu/launch | 20 +- ebuild.sh | 2 +- rEFIt_UEFI/Platform/Nvram.cpp | 16 +- rEFIt_UEFI/Platform/SelfOem.cpp | 59 +-- rEFIt_UEFI/Platform/SelfOem.h | 2 + rEFIt_UEFI/Platform/Settings.cpp | 13 - rEFIt_UEFI/Platform/Settings.h | 6 - rEFIt_UEFI/Platform/Utils.cpp | 10 + rEFIt_UEFI/Platform/Utils.h | 6 + rEFIt_UEFI/Platform/cpu.cpp | 4 +- rEFIt_UEFI/Platform/cpu.h | 2 +- rEFIt_UEFI/Platform/platformdata.cpp | 2 +- rEFIt_UEFI/Platform/plist/TagKey.h | 6 +- rEFIt_UEFI/Platform/smbios.cpp | 4 +- rEFIt_UEFI/PlatformEFI/posix/abort.cpp | 24 + rEFIt_UEFI/PlatformEFI/posix/abort.h | 1 + rEFIt_UEFI/PlatformPOSIX/posix/abort.cpp | 23 + rEFIt_UEFI/PlatformPOSIX/posix/abort.h | 1 + rEFIt_UEFI/cpp_foundation/XStringArray.h | 62 ++- .../xml_lite-reapeatingdict-test.cpp | 160 ++++++ .../xml_lite-reapeatingdict-test.h | 1 + rEFIt_UEFI/entry_scan/legacy.cpp | 55 +- rEFIt_UEFI/generate_source_list.sh | 8 + rEFIt_UEFI/libeg/XTheme.cpp | 12 +- rEFIt_UEFI/libeg/image.cpp | 14 +- rEFIt_UEFI/refit.inf | 491 +++++++++--------- rEFIt_UEFI/refit/lib.cpp | 26 +- 29 files changed, 685 insertions(+), 386 deletions(-) create mode 100755 rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp create mode 100755 rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.h create mode 100755 rEFIt_UEFI/generate_source_list.sh diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 12b3e8901..39d06a36e 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2079,7 +2079,7 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) DEFINE GCC5_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -fno-lto DEFINE GCC53_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -DEFINE GCC53_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -fno-unwind-tables -Wno-incompatible-ms-struct -mms-bitfields -fno-ms-extensions -ffreestanding -fno-exceptions -nostdinc +DEFINE GCC53_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -fno-unwind-tables -Wno-incompatible-ms-struct -mms-bitfields -fno-ms-extensions -ffreestanding -fno-exceptions DEFINE GCC53_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections,-z,common-page-size=0x40,--defsym=PECOFF_HEADER_SIZE=0x240,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds DEFINE GCC53_IA32_X64_ASLDLINK_FLAGS = DEF(GCC53_IA32_X64_DLINK_COMMON),--entry,ReferenceAcpiTable,-u,ReferenceAcpiTable @@ -2593,12 +2593,12 @@ RELEASEMACOS_XCODE8_X64_DLINK_FLAGS = -arch x86_64 -nostdlib -Wl,-u,_$(IMAG - DEBUG_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" - DEBUGMACOS_XCODE8_X64_CC_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) + DEBUG_XCODE8_X64_CC_FLAGS = -g3 -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" + DEBUGMACOS_XCODE8_X64_CC_FLAGS = -g3 -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) RELEASE_XCODE8_X64_CC_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" -Werror RELEASEMACOS_XCODE8_X64_CC_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) - DEBUG_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" - DEBUGMACOS_XCODE8_X64_CXX_FLAGS = -g -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) + DEBUG_XCODE8_X64_CXX_FLAGS = -g3 -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" + DEBUGMACOS_XCODE8_X64_CXX_FLAGS = -g3 -gdwarf -O0 DEF(XCODE8_COMMON_FLAGS) RELEASE_XCODE8_X64_CXX_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) -target x86_64-pc-win32-macho "-DEFIAPI=__attribute__((ms_abi))" -Werror RELEASEMACOS_XCODE8_X64_CXX_FLAGS = -Os DEF(XCODE8_COMMON_FLAGS) diff --git a/Qemu/gdb_launch b/Qemu/gdb_launch index 48e23ef3b..0236125e0 100755 --- a/Qemu/gdb_launch +++ b/Qemu/gdb_launch @@ -1,18 +1,17 @@ #!/bin/bash SCRIPT_ABS_FILENAME=`LC_ALL=en_US.ISO8859-1 perl -e 'use Cwd "abs_path";print abs_path(shift)' "${BASH_SOURCE[0]}"` SCRIPT_DIR=`dirname "$SCRIPT_ABS_FILENAME"` -SHELL_PWD=$PWD -cd "$SCRIPT_DIR" +# we can't cd "$SCRIPT_DIR" because the 1st arg maybe a relative path to the current dir (and NOT relative to the SCRIPT_DIR) OSTYPE=`uname -s` #echo $OSTYPE if [ -z "$1" ] then - if [ -f ../Build/Clover/DEBUG_GCC53/X64/CLOVERX64.debug ] + if [ -f "$SCRIPT_DIR"/../Build/Clover/DEBUG_GCC53/X64/CLOVERX64.debug ] then - clover_debug_file=../Build/Clover/DEBUG_GCC53/X64/CLOVERX64.debug + clover_debug_file="$SCRIPT_DIR"/../Build/Clover/DEBUG_GCC53/X64/CLOVERX64.debug echo Using default file "$clover_debug_file" else echo "Usage: $SCRIPT_ABS_FILENAME [Clover debug file]" @@ -22,11 +21,6 @@ else clover_debug_file="${1%.*}".debug fi -if [[ "$clover_debug_file" != '/'* ]] -then - clover_debug_file="$SHELL_PWD"/"$clover_debug_file" -fi - if ! [ -f "$clover_debug_file" ] then echo Debug file "$clover_debug_file" doesn\'t exist @@ -43,8 +37,8 @@ fi echo clover_debug_file="$clover_debug_file" echo clover_efi_file="$clover_efi_file" -qemu_path=./qemu_portable-v4.2.0/qemu-system-x86_64 -qemu_path=./qemu_portable-v5.2.0/qemu-system-x86_64 +qemu_path="$SCRIPT_DIR"/qemu_portable-v4.2.0/qemu-system-x86_64 +qemu_path="$SCRIPT_DIR"/qemu_portable-v5.2.0/qemu-system-x86_64 #set -x if [ "$OSTYPE" = "Darwin" ] @@ -54,19 +48,19 @@ then echo "You must restore the folder \'"$(dirname "$qemu_path")"\'" exit 1 fi - if ! [ -f ./disk_image_gpt.img ] + if ! [ -f "$SCRIPT_DIR"/disk_image_gpt.img ] then - unzip -o ./disk_image_gpt.img.zip -d . - rm -rf ./__MACOSX + unzip -o "$SCRIPT_DIR"/disk_image_gpt.img.zip -d "$SCRIPT_DIR" + rm -rf "$SCRIPT_DIR"/__MACOSX fi if pgrep qemu then killall qemu-system-x86_64 fi - > ./serial0_qemu_out.log # empty file without erasing it. Useful for editor for refreshing and reloading. + > "$SCRIPT_DIR"/serial0_qemu_out.log # empty file without erasing it. Useful for editor for refreshing and reloading. - hdiutil attach ./disk_image_gpt.img || exit 1 + hdiutil attach "$SCRIPT_DIR"/disk_image_gpt.img || exit 1 shopt -s nocasematch @@ -87,7 +81,8 @@ then sleep 1 # not 100% sure it's needed set -m - cd . + cd "$SCRIPT_DIR" + bios_file=("$(dirname "$qemu_path")"/bios*) "$qemu_path" \ @@ -131,7 +126,7 @@ then fi adr="$(grep "$image_base_str" ./serial0_qemu_out.log | awk '{printf "0x%x",$NF}')" - echo adr="$adr" + echo adr="$adr" GDB=gdb if [ -f ../../../toolchain.gdb/gdb ] diff --git a/Qemu/launch b/Qemu/launch index 65421f731..39e083e9c 100755 --- a/Qemu/launch +++ b/Qemu/launch @@ -2,7 +2,7 @@ SCRIPT_ABS_FILENAME=`LC_ALL=en_US.ISO8859-1 perl -e 'use Cwd "abs_path";print abs_path(shift)' "${BASH_SOURCE[0]}"` SCRIPT_DIR=`dirname "$SCRIPT_ABS_FILENAME"` -cd "$SCRIPT_DIR" +# we can't cd "$SCRIPT_DIR" because the 1st arg maybe a relative path to the current dir (and NOT relative to the SCRIPT_DIR) OSTYPE=`uname -s` #echo $OSTYPE @@ -18,8 +18,8 @@ then echo clover_efi_file="$clover_efi_file" fi -qemu_path=./qemu_portable-v4.2.0/qemu-system-x86_64 -qemu_path=./qemu_portable-v5.2.0/qemu-system-x86_64 +qemu_path="$SCRIPT_DIR"/qemu_portable-v4.2.0/qemu-system-x86_64 +qemu_path="$SCRIPT_DIR"/qemu_portable-v5.2.0/qemu-system-x86_64 #set -x if [ "$OSTYPE" = "Darwin" ] @@ -29,22 +29,22 @@ then echo "You must restore the folder \'"$(dirname "$qemu_path")"\'" exit 1 fi - if ! [ -f ./disk_image_gpt.img ] + if ! [ -f "$SCRIPT_DIR"/disk_image_gpt.img ] then - unzip -o ./disk_image_gpt.img.zip - rm -rf ./__MACOSX + unzip -o "$SCRIPT_DIR"/disk_image_gpt.img.zip -d "$SCRIPT_DIR" + rm -rf "$SCRIPT_DIR"/__MACOSX fi if pgrep qemu then killall qemu-system-x86_64 fi - > ./serial0_qemu_out.log # empty file without erasing it. Useful for editor for refreshing and reloading. + > "$SCRIPT_DIR"/serial0_qemu_out.log # empty file without erasing it. Useful for editor for refreshing and reloading. if ! [ -z "$clover_efi_file" ] then - hdiutil attach ./disk_image_gpt.img || exit 1 + hdiutil attach "$SCRIPT_DIR"/disk_image_gpt.img || exit 1 shopt -s nocasematch @@ -64,7 +64,9 @@ then fi sleep 1 # not 100% sure it's needed - set -m + set -m + + cd "$SCRIPT_DIR" bios_file=("$(dirname "$qemu_path")"/bios*) diff --git a/ebuild.sh b/ebuild.sh index 611105c9a..08500e954 100755 --- a/ebuild.sh +++ b/ebuild.sh @@ -26,7 +26,7 @@ if [[ "$SYSNAME" == Linux ]]; then else declare -r NUMBER_OF_CPUS=$(sysctl -n hw.logicalcpu) fi -declare -a EDK2_BUILD_OPTIONS= +declare -a EDK2_BUILD_OPTIONS=--cmd-len=50000 print_option_help_wc= have_fmt= PLATFORMFILE= diff --git a/rEFIt_UEFI/Platform/Nvram.cpp b/rEFIt_UEFI/Platform/Nvram.cpp index e2b982806..4e1c9cf75 100755 --- a/rEFIt_UEFI/Platform/Nvram.cpp +++ b/rEFIt_UEFI/Platform/Nvram.cpp @@ -190,33 +190,34 @@ SetNvramVariable ( UINTN OldDataSize = 0; UINT32 OldAttributes = 0; -// DBG("SetNvramVariable (%ls, guid, 0x%X, %lld):", VariableName, Attributes, DataSize); + DBG("SetNvramVariable (%ls, guid, 0x%X, %lld):", VariableName, Attributes, DataSize); OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, &OldAttributes, &OldDataSize); if (OldData != NULL) { // var already exists - check if it equal to new value -// DBG(" exists(0x%X, %lld)", OldAttributes, OldDataSize); + DBG(" exists(0x%X, %lld)", OldAttributes, OldDataSize); if ((OldAttributes == Attributes) && (OldDataSize == DataSize) && (CompareMem (OldData, Data, DataSize) == 0)) { // it's the same - do nothing -// DBG(", equal -> not writing again.\n"); + DBG(", equal -> not writing again.\n"); FreePool(OldData); return EFI_SUCCESS; } -// DBG(", not equal\n"); FreePool(OldData); // not the same - delete previous one if attributes are different if (OldAttributes != Attributes) { Status = DeleteNvramVariable(VariableName, VendorGuid); -// DBG(", diff. attr: deleting old (%s)", efiStrError(Status)); + DBG(", diff. attr: deleting old (%s)", efiStrError(Status)); + }else{ + DBG(", not equal"); } } // DBG("\n"); // for debug without Status Status = gRT->SetVariable(VariableName, VendorGuid, Attributes, DataSize, (void*)Data); // CONST missing in EFI_SET_VARIABLE->SetVariable -// DBG(" -> writing new (%s)\n", efiStrError(Status)); + DBG(" -> writing new (%s)\n", efiStrError(Status)); return Status; } @@ -244,7 +245,7 @@ AddNvramVariable ( EFI_STATUS Status; void *OldData; - DBG("SetNvramVariable (%ls, guid, 0x%X, %lld):\n", VariableName, Attributes, DataSize); + DBG("AddNvramVariable (%ls, guid, 0x%X, %lld):", VariableName, Attributes, DataSize); OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, NULL, NULL); if (OldData == NULL) { // set new value @@ -252,6 +253,7 @@ AddNvramVariable ( DBG(" -> writing new (%s)\n", efiStrError(Status)); } else { FreePool(OldData); + DBG(" -> already exists, abort\n"); Status = EFI_ABORTED; } return Status; diff --git a/rEFIt_UEFI/Platform/SelfOem.cpp b/rEFIt_UEFI/Platform/SelfOem.cpp index 5e7cba395..4998faffb 100644 --- a/rEFIt_UEFI/Platform/SelfOem.cpp +++ b/rEFIt_UEFI/Platform/SelfOem.cpp @@ -114,7 +114,6 @@ bool SelfOem::_setOemPathRelToSelfDir(bool isFirmwareClover, const XString8& OEM EFI_STATUS SelfOem::_initialize() { -//DBG("%s : enter.\n", __FUNCTION__); EFI_STATUS Status; if ( oemDirExists() ) { @@ -134,11 +133,10 @@ EFI_STATUS SelfOem::_initialize() assert( m_OemFulPath.notEmpty() ); } -#ifdef DEBUG - if ( m_KextsDir != NULL ) panic("%s : Kexts dir != NULL.", __FUNCTION__); -#else - if ( m_KextsDir != NULL ) return EFI_SUCCESS; -#endif + if ( m_KextsDir != NULL ) { + log_technical_bug("%s : Kexts dir != NULL.", __PRETTY_FUNCTION__); + m_KextsDir = NULL; + } if ( oemDirExists() ) { Status = m_OemDir->Open(m_OemDir, &m_KextsDir, KEXTS_DIRNAME.wc_str(), EFI_FILE_MODE_READ, 0); if ( !EFI_ERROR(Status) ) { @@ -167,11 +165,11 @@ EFI_STATUS SelfOem::_initialize() }else{ } if ( m_KextsDir == NULL ) { - assert( m_KextsPathRelToSelfDir.isEmpty() ); - assert( m_KextsFullPath.isEmpty() ); + if ( m_KextsPathRelToSelfDir.notEmpty() ) log_technical_bug("%s : m_KextsPathRelToSelfDir.notEmpty()", __PRETTY_FUNCTION__); + if ( m_KextsFullPath.notEmpty() ) log_technical_bug("%s : m_KextsFullPath.notEmpty()", __PRETTY_FUNCTION__); }else{ - assert( m_KextsPathRelToSelfDir.notEmpty() ); - assert( m_KextsFullPath.notEmpty() ); + if ( m_KextsPathRelToSelfDir.isEmpty() ) log_technical_bug("%s : m_KextsPathRelToSelfDir.isEmpty()", __PRETTY_FUNCTION__); + if ( m_KextsFullPath.isEmpty() ) log_technical_bug("%s : m_KextsFullPath.isEmpty()", __PRETTY_FUNCTION__); } #ifdef JIEF_DEBUG if ( isKextsDirFound() ) { @@ -180,14 +178,21 @@ EFI_STATUS SelfOem::_initialize() DBG("Kexts dir = none\n"); } #endif -//DBG("%s : leave.\n", __FUNCTION__); return EFI_SUCCESS; } EFI_STATUS SelfOem::initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, UINTN nLanCards, UINT8 gLanMac[4][6]) { -//DBG("%s : enter.\n", __FUNCTION__); - if ( m_ConfName.notEmpty() ) panic("%s : cannot be called twice. Use reinitialize.", __FUNCTION__); + if ( m_ConfName.notEmpty() ) { + log_technical_bug("%s : cannot be called twice. Use reinitialize.", __PRETTY_FUNCTION__); + return EFI_SUCCESS; + } + // confName must not be empty as it serves as a flag to know if it's initialized or not. + // {confName}.plist will also be used to detect OEM dir. + if ( confName.isEmpty() ) { + log_technical_bug("%s : cannot be called with empty config name.", __PRETTY_FUNCTION__); + return EFI_SUCCESS; + } m_ConfName = confName; @@ -195,42 +200,38 @@ EFI_STATUS SelfOem::initialize(const XString8& confName, bool isFirmwareClover, _setOemPathRelToSelfDir(isFirmwareClover, OEMBoard, OEMProduct, frequency, nLanCards, gLanMac); EFI_STATUS Status = _initialize(); -//DBG("%s : leave. Status=%s.\n", __FUNCTION__, efiStrError(Status)); return Status; } void SelfOem::unInitialize() { -//DBG("%s : enter.\n", __FUNCTION__); -#ifdef DEBUG - if ( m_ConfName.isEmpty() ) panic("%s : Already uninitiialized.", __FUNCTION__); -#endif + if ( m_ConfName.isEmpty() ) { + log_technical_bug("%s : Already uninitialized.", __PRETTY_FUNCTION__); + return; + } + closeHandle(); m_ConfName.setEmpty(); -//DBG("%s : leave.\n", __FUNCTION__); } EFI_STATUS SelfOem::reInitialize() { -//DBG("%s : enter.\n", __FUNCTION__); -#ifdef DEBUG - if ( m_ConfName.isEmpty() ) panic("%s : initialize() must called once first", __FUNCTION__); -#endif + if ( m_ConfName.isEmpty() ) { + log_technical_bug("%s : initialize() must called once first", __PRETTY_FUNCTION__); + return EFI_LOAD_ERROR; + } + closeHandle(); // No need to call _setOemPathRelToSelfDir again, but need to open m_OemDir, if it exists if ( oemDirExists() ) { EFI_STATUS Status = self.getCloverDir().Open(&self.getCloverDir(), &m_OemDir, m_OemPathRelToSelfDir.wc_str(), EFI_FILE_MODE_READ, 0); if ( EFI_ERROR(Status) ) { -#ifdef DEBUG - panic("Impossible to reopen dir '%ls\\%ls', although it was opened the first time : %s", self.getCloverDirFullPath().wc_str(), m_OemPathRelToSelfDir.wc_str(), efiStrError(Status)); -#else - return Status; -#endif + log_technical_bug("Impossible to reopen dir '%ls\\%ls', although it was opened the first time : %s", self.getCloverDirFullPath().wc_str(), m_OemPathRelToSelfDir.wc_str(), efiStrError(Status)); + return Status; } } EFI_STATUS Status = _initialize(); -//DBG("%s : leave. Status=%s.\n", __FUNCTION__, efiStrError(Status)); return Status; } diff --git a/rEFIt_UEFI/Platform/SelfOem.h b/rEFIt_UEFI/Platform/SelfOem.h index 95e864d2e..873dd0e3c 100644 --- a/rEFIt_UEFI/Platform/SelfOem.h +++ b/rEFIt_UEFI/Platform/SelfOem.h @@ -45,6 +45,8 @@ public: EFI_STATUS reInitialize(); void closeHandle(); + bool isInitialized() const { return m_ConfName.notEmpty(); } + const XString8& getConfName() { return m_ConfName; } bool oemDirExists() { return m_OemPathRelToSelfDir.notEmpty(); } diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 04bbd72bc..bff663300 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -295,19 +295,6 @@ bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const { EFI_STATUS SaveSettings (); -UINT32 -GetCrc32 ( - UINT8 *Buffer, - UINTN Size - ) -{ - UINT32 x = 0; - UINT32 *Fake = (UINT32*)Buffer; - if (!Fake) return 0; - Size >>= 2; - while (Size--) x+= *Fake++; - return x; -} // //ACPI_NAME_LIST * //ParseACPIName(const XString8& String) diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 220431807..c4d7cf63c 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -2294,12 +2294,6 @@ MacOsVersion GetOSVersion(int LoaderType, const XStringW& APFSTargetUUID, const inline MacOsVersion GetOSVersion (IN LOADER_ENTRY *Entry) { return GetOSVersion(Entry->LoaderType, Entry->APFSTargetUUID, Entry->Volume, &Entry->BuildVersion); }; -UINT32 -GetCrc32 ( - UINT8 *Buffer, - UINTN Size - ); - void GetDevices(void); diff --git a/rEFIt_UEFI/Platform/Utils.cpp b/rEFIt_UEFI/Platform/Utils.cpp index 81ecbdf5b..8746a7fae 100644 --- a/rEFIt_UEFI/Platform/Utils.cpp +++ b/rEFIt_UEFI/Platform/Utils.cpp @@ -128,6 +128,16 @@ XString8 Bytes2HexStr(UINT8 *data, UINTN len) return result; } +UINT32 GetCrc32(UINT8 *Buffer, UINTN Size) +{ + UINT32 x = 0; + UINT32 *Fake = (UINT32*)Buffer; + if (!Fake) return 0; + Size >>= 2; + while (Size--) x+= *Fake++; + return x; +} + BOOLEAN haveError = FALSE; diff --git a/rEFIt_UEFI/Platform/Utils.h b/rEFIt_UEFI/Platform/Utils.h index 03adae508..cf44593ff 100644 --- a/rEFIt_UEFI/Platform/Utils.h +++ b/rEFIt_UEFI/Platform/Utils.h @@ -120,6 +120,12 @@ inline UINTN EFIAPI AsciiStrDecimalToUintn(const XString8& String) return AsciiStrDecimalToUintn(String.c_str()); } + +UINT32 GetCrc32(UINT8 *Buffer, UINTN Size); + + + + extern BOOLEAN haveError; diff --git a/rEFIt_UEFI/Platform/cpu.cpp b/rEFIt_UEFI/Platform/cpu.cpp index e0a5df010..e52cc281c 100644 --- a/rEFIt_UEFI/Platform/cpu.cpp +++ b/rEFIt_UEFI/Platform/cpu.cpp @@ -1434,14 +1434,14 @@ UINT16 GetAdvancedCpuType() return GetStandardCpuType(); } -MACHINE_TYPES GetDefaultModel() +MACHINE_TYPES GetDefaultModel(bool isMobile) { MACHINE_TYPES DefaultType = iMac132; if (gCPUStructure.Vendor != CPU_VENDOR_INTEL) { return MacPro61; } // TODO: Add more CPU models and configure the correct machines per CPU/GFX model - if(gMobile) { + if(isMobile) { switch (gCPUStructure.Model) { case CPU_MODEL_ATOM: diff --git a/rEFIt_UEFI/Platform/cpu.h b/rEFIt_UEFI/Platform/cpu.h index a828bf438..8f8176795 100644 --- a/rEFIt_UEFI/Platform/cpu.h +++ b/rEFIt_UEFI/Platform/cpu.h @@ -403,7 +403,7 @@ void GetCPUProperties (void); MACHINE_TYPES -GetDefaultModel (void); +GetDefaultModel (bool gMobile); UINT16 GetAdvancedCpuType (void); diff --git a/rEFIt_UEFI/Platform/platformdata.cpp b/rEFIt_UEFI/Platform/platformdata.cpp index 828fc05a6..892a1e27b 100644 --- a/rEFIt_UEFI/Platform/platformdata.cpp +++ b/rEFIt_UEFI/Platform/platformdata.cpp @@ -1308,7 +1308,7 @@ void GetDefaultCpuSettings(SETTINGS_DATA& gSettings) DbgHeader("GetDefaultCpuSettings"); MACHINE_TYPES Model; //UINT64 msr = 0; - Model = GetDefaultModel(); + Model = GetDefaultModel(gMobile); gSettings.CPU.CpuType = GetAdvancedCpuType(); SetDMISettingsForModel(gSettings, Model, TRUE); diff --git a/rEFIt_UEFI/Platform/plist/TagKey.h b/rEFIt_UEFI/Platform/plist/TagKey.h index 7144fa7b3..c10e29e6d 100644 --- a/rEFIt_UEFI/Platform/plist/TagKey.h +++ b/rEFIt_UEFI/Platform/plist/TagKey.h @@ -49,11 +49,7 @@ public: } void setKeyValue(const XString8& xstring) { -#ifdef DEBUG - if ( xstring.isEmpty() ) panic("TagKey::setKeyValue() : xstring.isEmpty() "); -#else - if ( xstring.isEmpty() ) return; //don't change -#endif + if ( xstring.isEmpty() ) log_technical_bug("TagKey::setKeyValue() : xstring.isEmpty() "); _string = xstring; } diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index d58cedc99..3fb6f7b77 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -552,7 +552,7 @@ DBG("%s : UpdateSmbiosString ProductName=%s\n", __PRETTY_FUNCTION__, gSettings.S gSettings.Smbios.SerialNr.trim(); if( gSettings.Smbios.SerialNr.notEmpty() ){ UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SerialNumber, gSettings.Smbios.SerialNr); -DBG("%s : UpdateSmbiosString SerialNr=%s\n", __PRETTY_FUNCTION__, gSettings.Smbios.SerialNr.c_str()); +//DBG("%s : UpdateSmbiosString SerialNr=%s\n", __PRETTY_FUNCTION__, gSettings.Smbios.SerialNr.c_str()); } gSettings.Smbios.BoardNumber.trim(); if( gSettings.Smbios.BoardNumber.notEmpty() ){ @@ -725,7 +725,7 @@ void PatchTableType3() gSettings.Smbios.SerialNr.trim(); if( gSettings.Smbios.SerialNr.notEmpty() ){ UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->SerialNumber, gSettings.Smbios.SerialNr); -DBG("%s : UpdateSmbiosString SerialNr=%s\n", __PRETTY_FUNCTION__, gSettings.Smbios.SerialNr.c_str()); +//DBG("%s : UpdateSmbiosString SerialNr=%s\n", __PRETTY_FUNCTION__, gSettings.Smbios.SerialNr.c_str()); } gSettings.Smbios.ChassisAssetTag.trim(); if( gSettings.Smbios.ChassisAssetTag.notEmpty() ){ diff --git a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp index ca2e54185..fc9ceec11 100644 --- a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp +++ b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp @@ -96,6 +96,30 @@ void panic_ask(const char* format, ...) } +/* + * Future version to log about pontential technical bugs + * It's not done yes. So far, it's just panic + * TODO: + */ +void log_technical_bug(const char* format, ...) +{ +#ifdef PANIC_CAN_RETURN + if ( stop_at_panic ) { + VA_LIST va; + VA_START(va, format); + panic_(format, va); // panic doesn't return +// VA_END(va); + }else{ + i_have_panicked = true; + } +#else + VA_LIST va; + VA_START(va, format); + panic_(format, va); // panic doesn't return +#endif +} + + void panic(void) { panic(nullptr); diff --git a/rEFIt_UEFI/PlatformEFI/posix/abort.h b/rEFIt_UEFI/PlatformEFI/posix/abort.h index 6274904f2..21701e480 100755 --- a/rEFIt_UEFI/PlatformEFI/posix/abort.h +++ b/rEFIt_UEFI/PlatformEFI/posix/abort.h @@ -34,6 +34,7 @@ void panic(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)) void panic_ask(const char* format, ...) __attribute__((__format__(__printf__, 1, 2))); +void log_technical_bug(const char* format, ...) __attribute__((__format__(__printf__, 1, 2))); #ifdef _MSC_VER diff --git a/rEFIt_UEFI/PlatformPOSIX/posix/abort.cpp b/rEFIt_UEFI/PlatformPOSIX/posix/abort.cpp index 7061d8200..3d9779063 100644 --- a/rEFIt_UEFI/PlatformPOSIX/posix/abort.cpp +++ b/rEFIt_UEFI/PlatformPOSIX/posix/abort.cpp @@ -79,6 +79,29 @@ void panic_ask(const char* format, ...) #endif } +/* + * Future version to log about pontential technical bugs + * It's not done yes. So far, it's just panic + * TODO: + */ +void log_technical_bug(const char* format, ...) +{ +#ifdef PANIC_CAN_RETURN + if ( stop_at_panic ) { + VA_LIST va; + VA_START(va, format); + panic_(format, va); // panic doesn't return +// VA_END(va); + }else{ + i_have_panicked = true; + } +#else + VA_LIST va; + VA_START(va, format); + panic_(format, va); // panic doesn't return +#endif +} + void panic(void) { diff --git a/rEFIt_UEFI/PlatformPOSIX/posix/abort.h b/rEFIt_UEFI/PlatformPOSIX/posix/abort.h index 3811d666b..b9f3d26fd 100755 --- a/rEFIt_UEFI/PlatformPOSIX/posix/abort.h +++ b/rEFIt_UEFI/PlatformPOSIX/posix/abort.h @@ -34,6 +34,7 @@ void panic(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)) ; void panic_ask(const char* format, ...) __attribute__((__format__(__printf__, 1, 2))); +void log_technical_bug(const char* format, ...) __attribute__((__format__(__printf__, 1, 2))); #endif diff --git a/rEFIt_UEFI/cpp_foundation/XStringArray.h b/rEFIt_UEFI/cpp_foundation/XStringArray.h index 673be7a03..2dc5cb0ee 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringArray.h +++ b/rEFIt_UEFI/cpp_foundation/XStringArray.h @@ -22,13 +22,26 @@ template class XStringArray_/* : public XStringArraySuper*/ { - protected: +protected: XObjArray array; - public: +public: typedef XStringClass_ XStringClass; XStringArray_() : array() {}; + + XStringArray_(const XStringArray_& other) : array() { + array = other.array; + } + template + XStringArray_(const XStringArray_& other) : array() { + for ( size_t idx = 0 ; idx < other.size() ; ++idx ) { + array.AddCopy(other[idx]); + } + } + +// template +// XStringArrayClass& operator =(const XStringArray_& other) { array = other.array; return *((XStringArrayClass*)this); } size_t size() const { return array.size(); } void setEmpty() { array.setEmpty(); } @@ -269,32 +282,77 @@ class XStringArray_/* : public XStringArraySuper*/ class XString8Array : public XStringArray_ { +public: + using super = XStringArray_; + + XString8Array() : super() {} + + template + XString8Array(const XStringArray_& other) : super(other) {} + +// template +// XStringArrayClass& operator =(const XStringArray_& other) { array = other.array; return *((XStringArrayClass*)this); } }; extern const XString8Array NullXString8Array; class XString16Array : public XStringArray_ { +public: + using super = XStringArray_; + + XString16Array() : super() {} + + template + XString16Array(const XStringArray_& other) : super(other) {} }; extern const XString16Array NullXString16Array; class XString32Array : public XStringArray_ { +public: + using super = XStringArray_; + + XString32Array() : super() {} + + template + XString32Array(const XStringArray_& other) : super(other) {} }; extern const XString32Array NullXString32Array; class XStringWArray : public XStringArray_ { +public: + using super = XStringArray_; + + XStringWArray() : super() {} + + template + XStringWArray(const XStringArray_& other) : super(other) {} }; extern const XStringWArray NullXStringWArray; class ConstXString8Array : public XStringArray_ { +public: + using super = XStringArray_; + + ConstXString8Array() : super() {} + + template + ConstXString8Array(const XStringArray_& other) : super(other) {} }; extern const ConstXString8Array NullConstXString8Array; class ConstXStringWArray : public XStringArray_ { +public: + using super = XStringArray_; + + ConstXStringWArray() : super() {} + + template + ConstXStringWArray(const XStringArray_& other) : super(other) {} }; extern const ConstXStringWArray NullConstXStringWArray; diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp new file mode 100755 index 000000000..0c142badc --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp @@ -0,0 +1,160 @@ +#include // Only use angled for Platform, else, xcode project won't compile +#include "../cpp_foundation/XString.h" +#include "../cpp_foundation/XStringArray.h" +//#include "../cpp_foundation/unicode_conversions.h" +//#include "../Platform/plist/plist.h" + +#include "../cpp_lib/XmlLiteSimpleTypes.h" +#include "../cpp_lib/XmlLiteCompositeTypes.h" +#include "../cpp_lib/XmlLiteDictTypes.h" +#include "../cpp_lib/XmlLiteParser.h" + + +static int breakpoint(int i) +{ + return i; +} + + +static XmlLiteParser gXmlLiteParser; + + +static int repeatingdict_test1() +{ + bool b; + + class DictClass : public XmlRepeatingDict> + { + public: + } dict; + + + const char* config_test = + "\r\n\ + key1.1\r\n\ + foo1.1\r\n\ + key1.2\r\n\ + foo1.2\r\n\ + key1.3\r\n\ + foo1.3\r\n\ + key1.4\r\n\ + foo1.4\r\n\ + \r\n\ + "; + + gXmlLiteParser.init(config_test); + b = dict.parseFromXmlLite(&gXmlLiteParser, "/"_XS8, true); +//gXmlLiteParser.printfErrorsAndWarnings(); +for ( size_t idx = 0 ; idx < dict.valueArray().size() ; idx++ ) { + printf("%s %s\n", dict.valueArray()[idx].key().value().c_str(), dict.valueArray()[idx].value().c_str()); +} + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); +// if ( mainDict.arrayValue()[0].key() != "key1.1"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[0].value() != "foo1.1"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[1].key() != "key1.2"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[1].value() != "foo1.2"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[2].key() != "key1.3"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[2].value() != "foo1.3"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[3].key() != "key1.4"_XS8 ) return breakpoint(14); +// if ( mainDict.arrayValue()[3].value() != "foo1.4"_XS8 ) return breakpoint(14); +// +// if ( !b ) return breakpoint(1); +// gXmlLiteParser.init(config_test); +// mainDict.validate(&gXmlLiteParser, "/"_XS8, XmlParserPosition(), true); +////gXmlLiteParser.printfErrorsAndWarnings(); +// if ( !b ) return breakpoint(1); +// if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); +// if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("ict1 tag") ) return breakpoint(14); + + return 0; +} + + +int repeatingdict_test2() +{ + bool b; + + class SubDictClass : public XmlAddKey + { + public: +// using ValueType = Main2Dict_Class; + + XmlBool xmlBool = XmlBool(); + XmlString8 xmlString = XmlString8(); + + XmlDictField m_fields[2] = { + {"keybool", xmlBool}, + {"keystring", xmlString}, + }; + + virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; + }; + + + class DictClass : public XmlRepeatingDict + { + public: + } dict; + + + const char* config_test = + "\r\n\ + array2.1\r\n\ + \r\n\ + keybool\r\n\ + \r\n\ + keystring\r\n\ + foo2.1\r\n\ + \r\n\ + array2.2\r\n\ + \r\n\ + keybool\r\n\ + \r\n\ + keystring\r\n\ + foo2.2\r\n\ + \r\n\ + \r\n\ + "; + + gXmlLiteParser.init(config_test); + b = dict.parseFromXmlLite(&gXmlLiteParser, "/"_XS8, true); +gXmlLiteParser.printfErrorsAndWarnings(); +for ( size_t idx = 0 ; idx < dict.valueArray().size() ; idx++ ) { + auto item = dict.valueArray()[idx]; + printf("%s %d %s\n", dict.valueArray()[idx].key().value().c_str(), dict.valueArray()[idx].xmlBool.value(), dict.valueArray()[idx].xmlString.value().c_str()); +} + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( dict.valueArray()[0].xmlBool.value() != true ) return breakpoint(14); + if ( dict.valueArray()[0].xmlString.value() != "foo2.1"_XS8 ) return breakpoint(14); + if ( dict.valueArray()[1].xmlBool.value() != false ) return breakpoint(14); + if ( dict.valueArray()[1].xmlString.value() != "foo2.2"_XS8 ) return breakpoint(14); + +// gXmlLiteParser.init(config_test); +// mainDict.validate(&gXmlLiteParser, "/"_XS8, XmlParserPosition(), true); +////gXmlLiteParser.printfErrorsAndWarnings(); +// if ( !b ) return breakpoint(1); +// if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); +// if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("dict2 tag") ) return breakpoint(14); + + return 0; +} + +int xml_lite_reapeatingdict_tests() +{ + + int ret; + + ret = repeatingdict_test1(); + if ( ret ) return ret; + + ret = repeatingdict_test2(); + if ( ret ) return ret; + +// ret = repeatingdict_test3(); +// if ( ret ) return ret; + + + return 0; +} diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.h b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.h new file mode 100755 index 000000000..974456311 --- /dev/null +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.h @@ -0,0 +1 @@ +int xml_lite_reapeatingdict_tests(); diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index f7b605427..110b03834 100755 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -57,7 +57,7 @@ //the function is not in the class and deals always with MainMenu //I made args as pointers to have an ability to call with NULL -BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry) +BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& _LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry) { LEGACY_ENTRY *Entry, *SubEntry; REFIT_MENU_SCREEN *SubScreen; @@ -65,20 +65,33 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi CHAR16 ShortcutLetter = 0; // INTN i; +DBG(" AddLegacyEntry:\n"); +DBG(" FullTitle=%ls\n", FullTitle.wc_str()); +DBG(" LoaderTitle=%ls\n", _LoaderTitle.wc_str()); +DBG(" Volume->LegacyOS->Name=%ls\n", Volume->LegacyOS->Name.wc_str()); + if (Volume == NULL) { return false; } // Ignore this loader if it's device path is already present in another loader - for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) { - REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i]; + for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) { + REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i]; // DBG("entry %lld\n", i); - // Only want legacy - if (MainEntry.getLEGACY_ENTRY()) { - if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.isEqualIC(Volume->DevicePathString) ) { - return true; - } + // Only want legacy + if (MainEntry.getLEGACY_ENTRY()) { + if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.isEqualIC(Volume->DevicePathString) ) { + return true; } } + } + + XStringW LoaderTitle; + if ( _LoaderTitle.isEmpty() ) { + LoaderTitle = Volume->LegacyOS->Name; + }else{ + LoaderTitle = _LoaderTitle; + } + XStringW LTitle; if (LoaderTitle.isEmpty()) { if (Volume->LegacyOS->Name.notEmpty()) { @@ -97,22 +110,21 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi // prepare the menu entry Entry = new LEGACY_ENTRY(); - if (!FullTitle.isEmpty()) { + if ( FullTitle.notEmpty() ) { Entry->Title = FullTitle; } else { if (ThemeX.BootCampStyle) { Entry->Title = LTitle; } else { - Entry->Title = L"Boot "_XSW + LoaderTitle + L" from "_XSW + VolDesc; -// Entry->Title.SWPrintf("Boot %ls from %ls", LoaderTitle->wc_str(), VolDesc); + Entry->Title.SWPrintf("Boot %ls from %ls", LoaderTitle.wc_str(), VolDesc.wc_str()); } } + DBG(" Entry->Title=%ls\n", Entry->Title.wc_str()); -// DBG("Title=%ls\n", Entry->Title); Entry->Row = 0; Entry->ShortcutLetter = (Hotkey == 0) ? ShortcutLetter : Hotkey; - if (Image) { + if ( Image && !Image->isEmpty() ) { Entry->Image = *Image; } else { Entry->Image = ThemeX.LoadOSIcon(Volume->LegacyOS->IconName); @@ -319,9 +331,9 @@ void AddCustomLegacy(void) continue; } } - if (/*(Volume->BootType != BOOTING_BY_PBR) && */ - (Volume->BootType >= BOOTING_BY_MBR) /*&& - (Volume->BootType != BOOTING_BY_CD)*/ ) { + if ((Volume->BootType != BOOTING_BY_PBR) && + (Volume->BootType != BOOTING_BY_MBR) && + (Volume->BootType != BOOTING_BY_CD)) { DBG("skipped because volume is not legacy bootable\n"); continue; } @@ -352,11 +364,15 @@ void AddCustomLegacy(void) } } - if (!ShowVolume || (Volume->Hidden)) { + if ( !ShowVolume ) { + DBG("skipped because volume ShowVolume==false\n"); + continue; + } + if ( Volume->Hidden ) { DBG("skipped because volume is hidden\n"); continue; } - + // Check for exact volume matches if (Custom.settings.Volume.notEmpty()) { if ((StrStr(Volume->DevicePathString.wc_str(), Custom.settings.Volume.wc_str()) == NULL) && @@ -385,9 +401,10 @@ void AddCustomLegacy(void) DriveIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.DriveImagePath); } // Create a legacy entry for this volume + DBG("\n"); if (AddLegacyEntry(Custom.settings.FullTitle, Custom.settings.Title, Volume, &MainIcon, &DriveIcon, Custom.settings.Hotkey, TRUE)) { - DBG("match!\n"); +// DBG("match!\n"); } } } diff --git a/rEFIt_UEFI/generate_source_list.sh b/rEFIt_UEFI/generate_source_list.sh new file mode 100755 index 000000000..db8d6e186 --- /dev/null +++ b/rEFIt_UEFI/generate_source_list.sh @@ -0,0 +1,8 @@ + +echo " ../Include/Library/printf_lite-conf.h" +echo " ../Include/Library/printf_lite.h" + +find . -not -path "./PlatformPOSIX/*" -and -not -path "./PlatformIA32/*" -and \( -name "*.h" -or -name "*.cpp" -or -name "*.c" \) -print0 | sort -fz | while read -d $'\0' file +do + echo -e " "$(echo "$file" | sed 's|./||') +done diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index e53881e74..51f346978 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -926,10 +926,14 @@ const XIcon& XTheme::LoadOSIcon(const XString8& Full) DBG(" Full=%s\n", Full.c_str()); if (!ReturnIcon->isEmpty()) return *ReturnIcon; } - // else something - if (DummyIcon.isEmpty()) { //initialize once per session - DummyIcon.Image.DummyImage(MainEntriesSize); - DummyIcon.setFilled(); + if ( Full !="unknown"_XS8 ) { + return LoadOSIcon("unknown"_XS8); + }else{ + // else something + if (DummyIcon.isEmpty()) { //initialize once per session + DummyIcon.Image.DummyImage(MainEntriesSize); + DummyIcon.setFilled(); + } } return DummyIcon; } diff --git a/rEFIt_UEFI/libeg/image.cpp b/rEFIt_UEFI/libeg/image.cpp index edc063e70..d5a36b496 100644 --- a/rEFIt_UEFI/libeg/image.cpp +++ b/rEFIt_UEFI/libeg/image.cpp @@ -79,11 +79,11 @@ EFI_STATUS egLoadFile(const EFI_FILE* BaseDir, IN CONST CHAR16 *FileName, FileInfo = EfiLibFileInfo(FileHandle); if (FileInfo == NULL) { FileHandle->Close(FileHandle); + Status = EFI_NOT_READY; goto Error; } ReadSize = FileInfo->FileSize; - if (ReadSize > MAX_FILE_SIZE) - ReadSize = MAX_FILE_SIZE; + if (ReadSize > MAX_FILE_SIZE) ReadSize = MAX_FILE_SIZE; FreePool(FileInfo); BufferSize = (UINTN)ReadSize; // was limited to 1 GB above, so this is safe @@ -107,6 +107,11 @@ EFI_STATUS egLoadFile(const EFI_FILE* BaseDir, IN CONST CHAR16 *FileName, if (FileDataLength) { *FileDataLength = BufferSize; } + // be 100% sure that we don't return EFI_SUCCESS with *FileData == NULL + if ( !EFI_ERROR(Status) && *FileData == NULL ) { + log_technical_bug("%s : EFI_ERROR(Status) && ConfigPtr", __PRETTY_FUNCTION__); + return EFI_COMPROMISED_DATA; + } return Status; Error: if (FileData) { @@ -115,6 +120,11 @@ Error: if (FileDataLength) { *FileDataLength = 0; } + // be 100% sure that we don't return EFI_SUCCESS with *FileData == NULL + if ( !EFI_ERROR(Status) && *FileData == NULL ) { + log_technical_bug("%s : EFI_ERROR(Status) && ConfigPtr", __PRETTY_FUNCTION__); + return EFI_COMPROMISED_DATA; + } return Status; } //Slice - this is gEfiPartTypeSystemPartGuid diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 951152900..cc0964807 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -31,34 +31,107 @@ # [Sources] -# EfiLib/GenericBdsLib.h -# EfiLib/BmLib.c -# Platform/DevicePath.c #included into GenericBdsLib - Platform/BdsConnect.cpp #included into GenericBdsLib ../Include/Library/printf_lite-conf.h ../Include/Library/printf_lite.h - PlatformEFI/include/printf_lite-test-cpp_conf.h - PlatformEFI/include/Platform.h - PlatformEFI/include/XToolsConf.h - PlatformEFI/posix/posix.h - PlatformEFI/posix/limits.h - PlatformEFI/posix/stdarg.h - PlatformEFI/posix/stddef.h - PlatformEFI/posix/stdint.h - PlatformEFI/posix/stdlib.h - PlatformEFI/posix/stdio.h - PlatformEFI/posix/stdio.cpp - PlatformEFI/posix/string.h - PlatformEFI/posix/string.cpp - PlatformEFI/posix/strings.h - PlatformEFI/posix/strings.cpp - PlatformEFI/posix/strlen.cpp - PlatformEFI/posix/wchar.h - PlatformEFI/posix/wchar.cpp - PlatformEFI/posix/abort.h - PlatformEFI/posix/abort.cpp - PlatformEFI/posix/posix_additions.h - PlatformEFI/posix/posix_additions.cpp + cpp_foundation/shared_ptr.cpp + cpp_foundation/shared_ptr.h + cpp_foundation/unicode_conversions.cpp + cpp_foundation/unicode_conversions.h + cpp_foundation/XArray.h + cpp_foundation/XBuffer.cpp + cpp_foundation/XBuffer.h + cpp_foundation/XObjArray.h + cpp_foundation/XRBuffer.cpp + cpp_foundation/XRBuffer.h + cpp_foundation/XString.cpp + cpp_foundation/XString.h + cpp_foundation/XStringAbstract.h + cpp_foundation/XStringArray.cpp + cpp_foundation/XStringArray.h + cpp_foundation/XToolsCommon.h + cpp_lib/undefinable.h + cpp_lib/XmlLiteArrayTypes.cpp + cpp_lib/XmlLiteArrayTypes.h + cpp_lib/XmlLiteCompositeTypes.cpp + cpp_lib/XmlLiteCompositeTypes.h + cpp_lib/XmlLiteDictTypes.cpp + cpp_lib/XmlLiteDictTypes.h + cpp_lib/XmlLiteParser.cpp + cpp_lib/XmlLiteParser.h + cpp_lib/XmlLiteSimpleTypes.cpp + cpp_lib/XmlLiteSimpleTypes.h + cpp_lib/XmlLiteUnionTypes.cpp + cpp_lib/XmlLiteUnionTypes.h + cpp_unit_test/all_tests.cpp + cpp_unit_test/all_tests.h + cpp_unit_test/find_replace_mask_Clover_tests.cpp + cpp_unit_test/find_replace_mask_Clover_tests.h + cpp_unit_test/find_replace_mask_OC_tests.cpp + cpp_unit_test/find_replace_mask_OC_tests.h + cpp_unit_test/global_test.cpp + cpp_unit_test/global_test.h + cpp_unit_test/LoadOptions_test.cpp + cpp_unit_test/LoadOptions_test.h + cpp_unit_test/MacOsVersion_test.cpp + cpp_unit_test/MacOsVersion_test.h + cpp_unit_test/plist_tests.cpp + cpp_unit_test/plist_tests.h + cpp_unit_test/printf_lite-test.cpp + cpp_unit_test/printf_lite-test.h + cpp_unit_test/printlib-test.cpp + cpp_unit_test/printlib-test.h + cpp_unit_test/strcasecmp_test.cpp + cpp_unit_test/strcasecmp_test.h + cpp_unit_test/strcmp_test.cpp + cpp_unit_test/strcmp_test.h + cpp_unit_test/strlen_test.cpp + cpp_unit_test/strlen_test.h + cpp_unit_test/strncmp_test.cpp + cpp_unit_test/strncmp_test.h + cpp_unit_test/XArray_tests.cpp + cpp_unit_test/XArray_tests.h + cpp_unit_test/XBuffer_tests.cpp + cpp_unit_test/XBuffer_tests.h + cpp_unit_test/XObjArray_tests.cpp + cpp_unit_test/XObjArray_tests.h + cpp_unit_test/XStringArray_test.cpp + cpp_unit_test/XStringArray_test.h + cpp_unit_test/XString_test.cpp + cpp_unit_test/XString_test.h + cpp_unit_test/XToolsCommon_test.cpp + cpp_unit_test/XToolsCommon_test.h + entry_scan/bootscreen.cpp + entry_scan/bootscreen.h + entry_scan/CanonicalDB.h + entry_scan/CloverDB.h + entry_scan/CloverKEK.h + entry_scan/common.cpp + entry_scan/common.h + entry_scan/entry_scan.h + entry_scan/legacy.cpp + entry_scan/loader.cpp + entry_scan/loader.h + entry_scan/lockedgraphics.cpp + entry_scan/MSKEK.h + entry_scan/MSPCADB.h + entry_scan/MSUEFICADB.h + entry_scan/secureboot.cpp + entry_scan/secureboot.h + entry_scan/securebootkeys.h + entry_scan/securehash.cpp + entry_scan/securemenu.cpp + entry_scan/securevars.cpp + entry_scan/tool.cpp + entry_scan/tool.h + gui/menu_items/menu_globals.h + gui/menu_items/menu_items.cpp + gui/menu_items/menu_items.h + gui/REFIT_MAINMENU_SCREEN.cpp + gui/REFIT_MAINMENU_SCREEN.h + gui/REFIT_MENU_SCREEN.cpp + gui/REFIT_MENU_SCREEN.h + gui/shared_with_menu.cpp + gui/shared_with_menu.h include/BootTypes.h include/Devices.h include/DsdtFixList.h @@ -72,220 +145,171 @@ include/Pci.h include/QuirksCodes.h include/remove_ref.h + include/rename_helper.h + include/syslinux_mbr.h include/TagTypes.h include/VolumeTypes.h - refit/main.cpp - refit/icns.cpp - refit/lib.cpp - refit/lib.h - refit/menu.cpp - refit/menu.h - refit/screen.cpp - refit/screen.h - entry_scan/common.cpp - entry_scan/common.h - entry_scan/legacy.cpp - entry_scan/loader.h - entry_scan/loader.cpp - entry_scan/tool.cpp - entry_scan/secureboot.h - entry_scan/secureboot.cpp - entry_scan/securehash.cpp - entry_scan/securemenu.cpp - entry_scan/securevars.cpp - entry_scan/bootscreen.cpp - entry_scan/bootscreen.h - entry_scan/lockedgraphics.cpp - entry_scan/CanonicalDB.h - entry_scan/CloverDB.h - entry_scan/CloverKEK.h - entry_scan/MSKEK.h - entry_scan/MSPCADB.h - entry_scan/MSUEFICADB.h - entry_scan/entry_scan.h - entry_scan/securebootkeys.h - gui/menu_items/menu_items.h - gui/menu_items/menu_items.cpp - gui/menu_items/menu_globals.h - gui/REFIT_MENU_SCREEN.cpp - gui/REFIT_MENU_SCREEN.h - gui/REFIT_MAINMENU_SCREEN.cpp - gui/REFIT_MAINMENU_SCREEN.h - gui/shared_with_menu.cpp - gui/shared_with_menu.h + libeg/BmLib.cpp + libeg/BmLib.h + libeg/EfiFileLib.h + libeg/egemb_font.cpp libeg/egemb_icons.cpp libeg/egemb_icons_dark.cpp - libeg/egemb_font.cpp - libeg/scroll_images.cpp - libeg/BmLib.h - libeg/BmLib.cpp - libeg/image.h - libeg/image.cpp -# libeg/load_bmp.cpp - libeg/load_icns.cpp - libeg/libscreen.cpp - libeg/lodepng.cpp - libeg/lodepng.h - libeg/text.cpp libeg/FloatLib.cpp libeg/FloatLib.h + libeg/image.cpp + libeg/image.h + libeg/libeg.h + libeg/libegint.h + libeg/libscreen.cpp + libeg/load_icns.cpp + libeg/lodepng.cpp + libeg/lodepng.h libeg/nanosvg.cpp libeg/nanosvg.h libeg/nanosvgrast.cpp - libeg/VectorGraphics.h + libeg/scroll_images.cpp + libeg/text.cpp libeg/VectorGraphics.cpp - libeg/libeg.h - libeg/libegint.h - libeg/XImage.cpp - libeg/XImage.h + libeg/VectorGraphics.h + libeg/XCinema.cpp + libeg/XCinema.h libeg/XIcon.cpp libeg/XIcon.h + libeg/XImage.cpp + libeg/XImage.h libeg/XPointer.cpp libeg/XPointer.h libeg/XTheme.cpp libeg/XTheme.h - libeg/XCinema.cpp - libeg/XCinema.h - Platform/AcpiPatcher.h Platform/AcpiPatcher.cpp - Platform/APFS.h - Platform/APFS.cpp - Platform/ati_reg.h - Platform/AmlGenerator.cpp - Platform/AmlGenerator.h - Platform/ati.cpp - Platform/ati.h - PlatformEFI/BasicIO.cpp - Platform/BasicIO.h -# Platform/BiosVideo.h -# Platform/Bmp.h - Platform/boot.h - PlatformEFI/BootLog.cpp - Platform/BootLog.h - Platform/BootOptions.h - Platform/BootOptions.cpp - Platform/card_vlist.h - Platform/card_vlist.cpp - Platform/Console.h - Platform/Console.cpp - Platform/cpu.h - Platform/cpu.cpp - Platform/DataHubCpu.h - Platform/DataHubCpu.cpp -# Platform/DataHubRecords.h - Platform/device_inject.cpp - Platform/device_inject.h -# Platform/device_tree.cpp -# Platform/device_tree.h - Platform/Edid.h - Platform/Edid.cpp - Platform/Events.cpp - Platform/Events.h - Platform/FixBiosDsdt.h - Platform/FixBiosDsdt.cpp - Platform/gma.h - Platform/gma.cpp - Platform/guid.h - Platform/guid.cpp - Platform/hda.h - Platform/hda.cpp - Platform/HdaCodecDump.h - Platform/HdaCodecDump.cpp - Platform/Injectors.h + Platform/AcpiPatcher.h + Platform/AmlGenerator.cpp + Platform/AmlGenerator.h + Platform/APFS.cpp + Platform/APFS.h + Platform/ati.cpp + Platform/ati.h + Platform/ati_reg.h + Platform/b64cdecode.cpp + Platform/b64cdecode.h + Platform/BasicIO.h + Platform/BdsConnect.cpp + Platform/boot.h + Platform/BootLog.h + Platform/BootOptions.cpp + Platform/BootOptions.h + Platform/card_vlist.cpp + Platform/card_vlist.h + Platform/Console.cpp + Platform/Console.h + Platform/cpu.cpp + Platform/cpu.h + Platform/DataHub.cpp + Platform/DataHub.h + Platform/DataHubCpu.cpp + Platform/DataHubCpu.h + Platform/DataHubExt.h + Platform/DevicePath.cpp + Platform/device_inject.cpp + Platform/device_inject.h + Platform/Edid.cpp + Platform/Edid.h + Platform/Events.cpp + Platform/Events.h + Platform/FixBiosDsdt.cpp + Platform/FixBiosDsdt.h + Platform/gma.cpp + Platform/gma.h + Platform/guid.cpp + Platform/guid.h + Platform/hda.cpp + Platform/hda.h + Platform/HdaCodecDump.cpp + Platform/HdaCodecDump.h + Platform/Hibernate.cpp + Platform/Hibernate.h Platform/Injectors.cpp - Platform/KERNEL_AND_KEXT_PATCHES.h + Platform/Injectors.h Platform/KERNEL_AND_KEXT_PATCHES.cpp - Platform/kernel_patcher.h + Platform/KERNEL_AND_KEXT_PATCHES.h Platform/kernel_patcher.cpp + Platform/kernel_patcher.h + Platform/KextList.cpp + Platform/KextList.h Platform/kext_inject.cpp Platform/kext_inject.h Platform/kext_patcher.cpp - Platform/KextList.h - Platform/KextList.cpp - Platform/LegacyBiosThunk.h - Platform/LegacyBiosThunk.cpp - Platform/LegacyBoot.h - Platform/LegacyBoot.cpp + Platform/LegacyBiosThunk.cpp + Platform/LegacyBiosThunk.h + Platform/LegacyBoot.cpp + Platform/LegacyBoot.h Platform/MacOsVersion.cpp Platform/MacOsVersion.h - Platform/MemoryOperation.h Platform/MemoryOperation.c + Platform/MemoryOperation.h Platform/memvendors.h - Platform/nvidia.h - Platform/nvidia.cpp - Platform/Net.h - Platform/Net.cpp - Platform/Nvram.h - Platform/Nvram.cpp - Platform/platformdata.h - Platform/platformdata.cpp - Platform/PlatformDriverOverride.h - Platform/PlatformDriverOverride.cpp - Platform/plist/base64.h + Platform/Net.cpp + Platform/Net.h + Platform/nvidia.cpp + Platform/nvidia.h + Platform/Nvram.cpp + Platform/Nvram.h + Platform/platformdata.cpp + Platform/platformdata.h + Platform/PlatformDriverOverride.cpp + Platform/PlatformDriverOverride.h Platform/plist/base64.cpp - Platform/plist/plist.h + Platform/plist/base64.h Platform/plist/plist.cpp - Platform/plist/TagArray.h + Platform/plist/plist.h Platform/plist/TagArray.cpp - Platform/plist/TagBool.h + Platform/plist/TagArray.h Platform/plist/TagBool.cpp - Platform/plist/TagData.h + Platform/plist/TagBool.h Platform/plist/TagData.cpp - Platform/plist/TagDate.h + Platform/plist/TagData.h Platform/plist/TagDate.cpp - Platform/plist/TagDict.h + Platform/plist/TagDate.h Platform/plist/TagDict.cpp - Platform/plist/TagFloat.h + Platform/plist/TagDict.h Platform/plist/TagFloat.cpp - Platform/plist/TagInt64.h + Platform/plist/TagFloat.h Platform/plist/TagInt64.cpp - Platform/plist/TagKey.h + Platform/plist/TagInt64.h Platform/plist/TagKey.cpp - Platform/plist/TagString8.h + Platform/plist/TagKey.h Platform/plist/TagString8.cpp - Platform/plist/xml.h + Platform/plist/TagString8.h Platform/plist/xml.cpp -# Platform/Pointer.cpp + Platform/plist/xml.h Platform/Self.cpp Platform/Self.h Platform/SelfOem.cpp Platform/SelfOem.h Platform/Settings.cpp Platform/Settings.h - Platform/smbios.h - Platform/smbios.cpp - Platform/spd.cpp - Platform/spd.h - Platform/StateGenerator.cpp - Platform/StateGenerator.h -# Platform/stringTable.cpp - Platform/usbfix.h - Platform/usbfix.cpp - Platform/Utils.cpp - Platform/Utils.h -# Platform/UsbMass.h -# Platform/UsbMassBoot.h -# Platform/UsbMassImpl.h -# Platform/VesaBiosExtensions.h - Platform/b64cdecode.h - Platform/b64cdecode.cpp -# Platform/MachO-loader.h -# Platform/LoaderUefi.h - Platform/Hibernate.cpp - Platform/Hibernate.h + Platform/smbios.cpp + Platform/smbios.h Platform/sound.cpp + Platform/spd.cpp + Platform/spd.h + Platform/sse3_5_patcher.h + Platform/sse3_patcher.h Platform/StartupSound.cpp Platform/StartupSound.h - # Platform/sse3_patcher.h - # Platform/sse3_5_patcher.h + Platform/StateGenerator.cpp + Platform/StateGenerator.h + Platform/usbfix.cpp + Platform/usbfix.h + Platform/Utils.cpp + Platform/Utils.h Platform/VersionString.cpp Platform/VersionString.h Platform/Volumes.cpp Platform/Volumes.h - Platform/DataHub.cpp - Platform/DataHub.h - Platform/DataHubExt.h - ../Version.h + PlatformEFI/BasicIO.cpp + PlatformEFI/BootLog.cpp PlatformEFI/cpp_util/globals_ctor.cpp PlatformEFI/cpp_util/globals_ctor.h PlatformEFI/cpp_util/globals_dtor.cpp @@ -293,65 +317,38 @@ PlatformEFI/cpp_util/operatorNewDelete.cpp PlatformEFI/cpp_util/operatorNewDelete.h PlatformEFI/cpp_util/pure_virtual.cpp - cpp_foundation/unicode_conversions.cpp - cpp_foundation/unicode_conversions.h - cpp_foundation/XArray.h - cpp_foundation/XBuffer.cpp - cpp_foundation/XBuffer.h - cpp_foundation/XRBuffer.cpp - cpp_foundation/XRBuffer.h - cpp_foundation/XObjArray.h - cpp_foundation/XStringAbstract.h - cpp_foundation/XString.cpp - cpp_foundation/XString.h - cpp_foundation/XStringArray.cpp - cpp_foundation/XStringArray.h - cpp_foundation/XStringArray.cpp - cpp_foundation/XToolsCommon.h -# cpp_foundation/XUINTN.cpp -# cpp_foundation/XUINTN.h - cpp_lib/undefinable.h - cpp_unit_test/all_tests.h - cpp_unit_test/all_tests.cpp -# cpp_unit_test/config-test.h -# cpp_unit_test/config-test.cpp - cpp_unit_test/find_replace_mask_Clover_tests.h - cpp_unit_test/find_replace_mask_Clover_tests.cpp - cpp_unit_test/find_replace_mask_OC_tests.h - cpp_unit_test/find_replace_mask_OC_tests.cpp - cpp_unit_test/global_test.h - cpp_unit_test/global_test.cpp - cpp_unit_test/LoadOptions_test.cpp - cpp_unit_test/LoadOptions_test.h - cpp_unit_test/MacOsVersion_test.cpp - cpp_unit_test/MacOsVersion_test.h - cpp_unit_test/printf_lite-test.cpp - cpp_unit_test/printf_lite-test.h - cpp_unit_test/printlib-test.h - cpp_unit_test/strlen_test.cpp - cpp_unit_test/strlen_test.h - cpp_unit_test/strcmp_test.cpp - cpp_unit_test/strcmp_test.h - cpp_unit_test/strncmp_test.cpp - cpp_unit_test/strncmp_test.h - cpp_unit_test/XArray_tests.cpp - cpp_unit_test/XArray_tests.h - cpp_unit_test/XBuffer_tests.cpp - cpp_unit_test/XBuffer_tests.h -# cpp_unit_test/xml_lite-test.cpp -# cpp_unit_test/xml_lite-test.h - cpp_unit_test/XObjArray_tests.cpp - cpp_unit_test/XObjArray_tests.h - cpp_unit_test/XString_test.cpp - cpp_unit_test/XString_test.h - cpp_unit_test/XStringArray_test.cpp - cpp_unit_test/XStringArray_test.h - cpp_unit_test/plist_tests.cpp - cpp_unit_test/plist_tests.h - cpp_unit_test/XToolsCommon_test.cpp - cpp_unit_test/XToolsCommon_test.h -# cpp_unit_test/XUINTN_test.cpp -# cpp_unit_test/XUINTN_test.h + PlatformEFI/include/Platform.h + PlatformEFI/include/printf_lite-test-cpp_conf.h + PlatformEFI/include/printlib-test-cpp_conf.h + PlatformEFI/include/XToolsConf.h + PlatformEFI/posix/abort.cpp + PlatformEFI/posix/abort.h + PlatformEFI/posix/limits.h + PlatformEFI/posix/posix.h + PlatformEFI/posix/posix_additions.cpp + PlatformEFI/posix/posix_additions.h + PlatformEFI/posix/stdarg.h + PlatformEFI/posix/stdbool.h + PlatformEFI/posix/stddef.h + PlatformEFI/posix/stdint.h + PlatformEFI/posix/stdio.cpp + PlatformEFI/posix/stdio.h + PlatformEFI/posix/stdlib.h + PlatformEFI/posix/string.cpp + PlatformEFI/posix/string.h + PlatformEFI/posix/strings.cpp + PlatformEFI/posix/strings.h + PlatformEFI/posix/strlen.cpp + PlatformEFI/posix/wchar.cpp + PlatformEFI/posix/wchar.h + refit/icns.cpp + refit/lib.cpp + refit/lib.h + refit/main.cpp + refit/menu.cpp + refit/menu.h + refit/screen.cpp + refit/screen.h [Sources.IA32] PlatformIA32/ftol.asm | MSFT diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index a4e81fe9e..59898acae 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -482,37 +482,37 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl Volume->LegacyOS->Name = L"FreeDOS"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; -/* + } else if (FindMem(SectorBuffer, 512, "OS2LDR", 6) >= 0 || FindMem(SectorBuffer, 512, "OS2BOOT", 7) >= 0) { Volume->HasBootCode = TRUE; - Volume->LegacyOS->IconName = L"ecomstation"; - Volume->LegacyOS->Name = L"eComStation"; + Volume->LegacyOS->IconName = L"ecomstation"_XSW; + Volume->LegacyOS->Name = L"eComStation"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "Be Boot Loader", 14) >= 0) { Volume->HasBootCode = TRUE; - Volume->LegacyOS->IconName = L"beos"; - Volume->LegacyOS->Name = L"BeOS"; + Volume->LegacyOS->IconName = L"beos"_XSW; + Volume->LegacyOS->Name = L"BeOS"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "yT Boot Loader", 14) >= 0) { Volume->HasBootCode = TRUE; - Volume->LegacyOS->IconName = L"zeta"; - Volume->LegacyOS->Name = L"ZETA"; + Volume->LegacyOS->IconName = L"zeta"_XSW; + Volume->LegacyOS->Name = L"ZETA"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "\x04" "beos\x06" "system\x05" "zbeos", 18) >= 0 || FindMem(SectorBuffer, 512, "haiku_loader", 12) >= 0) { Volume->HasBootCode = TRUE; - Volume->LegacyOS->IconName = L"haiku"; - Volume->LegacyOS->Name = L"Haiku"; + Volume->LegacyOS->IconName = L"haiku"_XSW; + Volume->LegacyOS->Name = L"Haiku"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; - */ + } } @@ -530,10 +530,10 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl Volume->HasBootCode = FALSE; #ifdef JIEF_DEBUG -//*Bootable = TRUE; +////*Bootable = TRUE; //Volume->HasBootCode = TRUE; -//Volume->LegacyOS->IconName = L"win"; -//Volume->LegacyOS->Name = L"Windows"; +//Volume->LegacyOS->IconName = L"win"_XSW; +//Volume->LegacyOS->Name = L"Windows"_XSW; //Volume->LegacyOS->Type = OSTYPE_WIN; //Volume->BootType = BOOTING_BY_PBR; #endif