Remove the last PoolPrints.

This commit is contained in:
jief666 2020-08-09 18:55:30 +03:00
parent d42ba26027
commit 4555bb9e9f
88 changed files with 1720 additions and 4756 deletions

View File

@ -35,7 +35,7 @@ typedef FSI_STRING_LIST_ENTRY FSI_STRING_LIST;
* @param ForceLoadKexts list of kexts (paths to their Info.plists, like L"\\ATI5000Controller.kext\\Contents\\Info.plist")
* that we'll force to be loaded by boot.efi by changing OSBundleRequired to Root
*/
typedef EFI_STATUS (EFIAPI * FSINJECTION_INSTALL)(IN EFI_HANDLE TgtHandle, IN JCONST CHAR16 *TgtDir, IN EFI_HANDLE SrcHandle, IN CHAR16 *SrcDir, IN FSI_STRING_LIST *Blacklist, IN FSI_STRING_LIST *ForceLoadKexts);
typedef EFI_STATUS (EFIAPI * FSINJECTION_INSTALL)(IN EFI_HANDLE TgtHandle, IN JCONST CHAR16 *TgtDir, IN EFI_HANDLE SrcHandle, IN JCONST CHAR16 *SrcDir, IN FSI_STRING_LIST *Blacklist, IN FSI_STRING_LIST *ForceLoadKexts);
/**
* FSINJECTION_PROTOCOL.CreateStringList() type definition

View File

@ -10,7 +10,7 @@
//
// Base UEFI types
//
#include <Include/Base.h>
#include <Base.h>
//
// From xnu/EXTERNAL_HEADERS/stdint.h:

View File

@ -138,6 +138,8 @@
9A9EA807245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9A9EA808245AD9B40076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9A9EA80A245AD9E50076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9AC269A824E0514100254048 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC269A624E0514000254048 /* Utils.cpp */; };
9AC269A924E0514100254048 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC269A724E0514000254048 /* Utils.h */; };
9AC77FB924176C04005CDD5C /* XStringArray_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECC24176C04005CDD5C /* XStringArray_test.h */; };
9AC77FBA24176C04005CDD5C /* XArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECD24176C04005CDD5C /* XArray_tests.h */; };
9AC77FBB24176C04005CDD5C /* XStringArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ECE24176C04005CDD5C /* XStringArray_test.cpp */; };
@ -268,10 +270,6 @@
9AC7807724176C04005CDD5C /* screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9424176C04005CDD5C /* screen.cpp */; };
9AC7807924176C04005CDD5C /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; };
9AC7807A24176C04005CDD5C /* lib.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9724176C04005CDD5C /* lib.h */; };
9AC7807B24176C04005CDD5C /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
9AC7807C24176C04005CDD5C /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9924176C04005CDD5C /* IO.cpp */; };
9AC7807D24176C04005CDD5C /* IO.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9A24176C04005CDD5C /* IO.h */; };
9AC7807E24176C04005CDD5C /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9B24176C04005CDD5C /* list.cpp */; };
9AC7807F24176C04005CDD5C /* menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9C24176C04005CDD5C /* menu.h */; };
9AC7808024176C04005CDD5C /* screen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9D24176C04005CDD5C /* screen.h */; };
9AC7808124176C04005CDD5C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9E24176C04005CDD5C /* main.cpp */; };
@ -309,7 +307,6 @@
9ACFE66024309AF80071CC93 /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
9ACFE66124309AF80071CC93 /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
9ACFE66424309AF80071CC93 /* BootLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4173C242F15CB00D2644C /* BootLog.h */; };
9ACFE66724309AF80071CC93 /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
9ACFE66924309AF80071CC93 /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
9ACFE66A24309AF80071CC93 /* Events.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3424176C04005CDD5C /* Events.h */; };
9ACFE66B24309AF80071CC93 /* printlib-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */; };
@ -335,7 +332,6 @@
9ACFE68024309AF80071CC93 /* XObjArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FB724176C04005CDD5C /* XObjArray.h */; };
9ACFE68224309AF80071CC93 /* sse3_5_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2A24176C04005CDD5C /* sse3_5_patcher.h */; };
9ACFE68324309AF80071CC93 /* spd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5524176C04005CDD5C /* spd.h */; };
9ACFE68424309AF80071CC93 /* IO.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9A24176C04005CDD5C /* IO.h */; };
9ACFE68524309AF80071CC93 /* device_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2E24176C04005CDD5C /* device_inject.h */; };
9ACFE68624309AF80071CC93 /* entry_scan.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8024176C04005CDD5C /* entry_scan.h */; };
9ACFE68724309AF80071CC93 /* LoaderUefi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2924176C04005CDD5C /* LoaderUefi.h */; };
@ -362,7 +358,6 @@
9ACFE6A124309AF80071CC93 /* HdaCodecDump.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4124176C04005CDD5C /* HdaCodecDump.h */; };
9ACFE6A224309AF80071CC93 /* kext_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4924176C04005CDD5C /* kext_inject.h */; };
9ACFE6A324309AF80071CC93 /* Nvram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2624176C04005CDD5C /* Nvram.h */; };
9ACFE6A424309AF80071CC93 /* poolprint-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */; };
9ACFE6A524309AF80071CC93 /* gma.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1724176C04005CDD5C /* gma.h */; };
9ACFE6A624309AF80071CC93 /* sse3_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3B24176C04005CDD5C /* sse3_patcher.h */; };
9ACFE6A724309AF80071CC93 /* Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1224176C04005CDD5C /* Version.h */; };
@ -371,7 +366,6 @@
9ACFE6AB24309AF80071CC93 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5824176C04005CDD5C /* Platform.h */; };
9ACFE6AC24309AF80071CC93 /* XImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7124176C04005CDD5C /* XImage.h */; };
9ACFE6AD24309AF80071CC93 /* globals_ctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA424176C04005CDD5C /* globals_ctor.h */; };
9ACFE6AE24309AF80071CC93 /* poolprint-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155B242B8FA300D2644C /* poolprint-test.h */; };
9ACFE6B024309AF80071CC93 /* securebootkeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8124176C04005CDD5C /* securebootkeys.h */; };
9ACFE6B224309AF80071CC93 /* XString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC92241AB33700F3D247 /* XString.h */; };
9ACFE6B324309AF80071CC93 /* FloatLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7324176C04005CDD5C /* FloatLib.h */; };
@ -404,8 +398,6 @@
9ACFE6D524309AF80071CC93 /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4224176C04005CDD5C /* platformdata.cpp */; };
9ACFE6D724309AF80071CC93 /* XPointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7024176C04005CDD5C /* XPointer.cpp */; };
9ACFE6D824309AF80071CC93 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2E241BC0DF00F3D247 /* strncmp_test.cpp */; };
9ACFE6D924309AF80071CC93 /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9B24176C04005CDD5C /* list.cpp */; };
9ACFE6DA24309AF80071CC93 /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9924176C04005CDD5C /* IO.cpp */; };
9ACFE6DB24309AF80071CC93 /* sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4A24176C04005CDD5C /* sound.cpp */; };
9ACFE6DC24309AF80071CC93 /* usbfix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5624176C04005CDD5C /* usbfix.cpp */; };
9ACFE6DD24309AF80071CC93 /* BmLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5F24176C04005CDD5C /* BmLib.cpp */; };
@ -433,7 +425,6 @@
9ACFE6F724309AF80071CC93 /* legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7924176C04005CDD5C /* legacy.cpp */; };
9ACFE6F824309AF80071CC93 /* AcpiPatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */; };
9ACFE6F924309AF80071CC93 /* BdsConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2424176C04005CDD5C /* BdsConnect.cpp */; };
9ACFE6FA24309AF80071CC93 /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4155C242B8FA300D2644C /* poolprint-test.cpp */; };
9ACFE6FB24309AF80071CC93 /* spd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4024176C04005CDD5C /* spd.cpp */; };
9ACFE6FC24309AF80071CC93 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
9ACFE6FD24309AF80071CC93 /* kext_patcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1B24176C04005CDD5C /* kext_patcher.cpp */; };
@ -476,12 +467,9 @@
9AD469562452B63800D6D0DB /* XToolsConf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD469542452B63300D6D0DB /* XToolsConf.h */; };
9AD469572452B63800D6D0DB /* XToolsConf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD469542452B63300D6D0DB /* XToolsConf.h */; };
9AD469582452B63900D6D0DB /* XToolsConf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD469542452B63300D6D0DB /* XToolsConf.h */; };
9AF4155D242B8FA400D2644C /* poolprint-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155B242B8FA300D2644C /* poolprint-test.h */; };
9AF4155E242B8FA400D2644C /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4155C242B8FA300D2644C /* poolprint-test.cpp */; };
9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */; };
9AF41563242BABC700D2644C /* printlib-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41560242BABC700D2644C /* printlib-test.h */; };
9AF41566242BAD5600D2644C /* printf_lite-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41565242BAD5600D2644C /* printf_lite-test-cpp_conf.h */; };
9AF41568242BAD7D00D2644C /* poolprint-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */; };
9AF41584242CD75C00D2644C /* abort.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA924176C04005CDD5C /* abort.h */; };
9AF41585242CD75C00D2644C /* MSKEK.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8524176C04005CDD5C /* MSKEK.h */; };
9AF41586242CD75C00D2644C /* menu_items.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8E24176C04005CDD5C /* menu_items.h */; };
@ -497,7 +485,6 @@
9AF41594242CD75C00D2644C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
9AF41596242CD75C00D2644C /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
9AF41597242CD75C00D2644C /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
9AF4159C242CD75C00D2644C /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
9AF4159E242CD75C00D2644C /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
9AF4159F242CD75C00D2644C /* Events.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3424176C04005CDD5C /* Events.h */; };
9AF415A0242CD75C00D2644C /* printlib-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */; };
@ -523,7 +510,6 @@
9AF415B5242CD75C00D2644C /* XObjArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FB724176C04005CDD5C /* XObjArray.h */; };
9AF415B8242CD75C00D2644C /* sse3_5_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2A24176C04005CDD5C /* sse3_5_patcher.h */; };
9AF415B9242CD75C00D2644C /* spd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5524176C04005CDD5C /* spd.h */; };
9AF415BA242CD75C00D2644C /* IO.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9A24176C04005CDD5C /* IO.h */; };
9AF415BB242CD75C00D2644C /* device_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2E24176C04005CDD5C /* device_inject.h */; };
9AF415BC242CD75C00D2644C /* entry_scan.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8024176C04005CDD5C /* entry_scan.h */; };
9AF415BD242CD75C00D2644C /* LoaderUefi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2924176C04005CDD5C /* LoaderUefi.h */; };
@ -550,7 +536,6 @@
9AF415D7242CD75C00D2644C /* HdaCodecDump.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4124176C04005CDD5C /* HdaCodecDump.h */; };
9AF415D8242CD75C00D2644C /* kext_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4924176C04005CDD5C /* kext_inject.h */; };
9AF415D9242CD75C00D2644C /* Nvram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2624176C04005CDD5C /* Nvram.h */; };
9AF415DA242CD75C00D2644C /* poolprint-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */; };
9AF415DB242CD75C00D2644C /* gma.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1724176C04005CDD5C /* gma.h */; };
9AF415DC242CD75C00D2644C /* sse3_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3B24176C04005CDD5C /* sse3_patcher.h */; };
9AF415DD242CD75C00D2644C /* Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1224176C04005CDD5C /* Version.h */; };
@ -559,7 +544,6 @@
9AF415E1242CD75C00D2644C /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5824176C04005CDD5C /* Platform.h */; };
9AF415E2242CD75C00D2644C /* XImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7124176C04005CDD5C /* XImage.h */; };
9AF415E3242CD75C00D2644C /* globals_ctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA424176C04005CDD5C /* globals_ctor.h */; };
9AF415E4242CD75C00D2644C /* poolprint-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155B242B8FA300D2644C /* poolprint-test.h */; };
9AF415E6242CD75C00D2644C /* securebootkeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8124176C04005CDD5C /* securebootkeys.h */; };
9AF415E8242CD75C00D2644C /* XString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC92241AB33700F3D247 /* XString.h */; };
9AF415E9242CD75C00D2644C /* FloatLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7324176C04005CDD5C /* FloatLib.h */; };
@ -591,8 +575,6 @@
9AF4160A242CD75C00D2644C /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4224176C04005CDD5C /* platformdata.cpp */; };
9AF4160C242CD75C00D2644C /* XPointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7024176C04005CDD5C /* XPointer.cpp */; };
9AF4160D242CD75C00D2644C /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2E241BC0DF00F3D247 /* strncmp_test.cpp */; };
9AF4160E242CD75C00D2644C /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9B24176C04005CDD5C /* list.cpp */; };
9AF4160F242CD75C00D2644C /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9924176C04005CDD5C /* IO.cpp */; };
9AF41610242CD75C00D2644C /* sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4A24176C04005CDD5C /* sound.cpp */; };
9AF41611242CD75C00D2644C /* usbfix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5624176C04005CDD5C /* usbfix.cpp */; };
9AF41612242CD75C00D2644C /* BmLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5F24176C04005CDD5C /* BmLib.cpp */; };
@ -619,7 +601,6 @@
9AF4162D242CD75C00D2644C /* legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7924176C04005CDD5C /* legacy.cpp */; };
9AF4162E242CD75C00D2644C /* AcpiPatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */; };
9AF4162F242CD75C00D2644C /* BdsConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2424176C04005CDD5C /* BdsConnect.cpp */; };
9AF41630242CD75C00D2644C /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4155C242B8FA300D2644C /* poolprint-test.cpp */; };
9AF41631242CD75C00D2644C /* spd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4024176C04005CDD5C /* spd.cpp */; };
9AF41632242CD75C00D2644C /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
9AF41633242CD75C00D2644C /* kext_patcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1B24176C04005CDD5C /* kext_patcher.cpp */; };
@ -669,7 +650,6 @@
9AF41671242CDA5800D2644C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
9AF41673242CDA5800D2644C /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
9AF41674242CDA5800D2644C /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
9AF41679242CDA5800D2644C /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
9AF4167B242CDA5800D2644C /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
9AF4167C242CDA5800D2644C /* Events.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3424176C04005CDD5C /* Events.h */; };
9AF4167D242CDA5800D2644C /* printlib-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */; };
@ -695,7 +675,6 @@
9AF41692242CDA5800D2644C /* XObjArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FB724176C04005CDD5C /* XObjArray.h */; };
9AF41695242CDA5800D2644C /* sse3_5_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2A24176C04005CDD5C /* sse3_5_patcher.h */; };
9AF41696242CDA5800D2644C /* spd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5524176C04005CDD5C /* spd.h */; };
9AF41697242CDA5800D2644C /* IO.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9A24176C04005CDD5C /* IO.h */; };
9AF41698242CDA5800D2644C /* device_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2E24176C04005CDD5C /* device_inject.h */; };
9AF41699242CDA5800D2644C /* entry_scan.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8024176C04005CDD5C /* entry_scan.h */; };
9AF4169A242CDA5800D2644C /* LoaderUefi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2924176C04005CDD5C /* LoaderUefi.h */; };
@ -722,7 +701,6 @@
9AF416B4242CDA5800D2644C /* HdaCodecDump.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4124176C04005CDD5C /* HdaCodecDump.h */; };
9AF416B5242CDA5800D2644C /* kext_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4924176C04005CDD5C /* kext_inject.h */; };
9AF416B6242CDA5800D2644C /* Nvram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2624176C04005CDD5C /* Nvram.h */; };
9AF416B7242CDA5800D2644C /* poolprint-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */; };
9AF416B8242CDA5800D2644C /* gma.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1724176C04005CDD5C /* gma.h */; };
9AF416B9242CDA5800D2644C /* sse3_patcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3B24176C04005CDD5C /* sse3_patcher.h */; };
9AF416BA242CDA5800D2644C /* Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1224176C04005CDD5C /* Version.h */; };
@ -731,7 +709,6 @@
9AF416BE242CDA5800D2644C /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F5824176C04005CDD5C /* Platform.h */; };
9AF416BF242CDA5800D2644C /* XImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7124176C04005CDD5C /* XImage.h */; };
9AF416C0242CDA5800D2644C /* globals_ctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA424176C04005CDD5C /* globals_ctor.h */; };
9AF416C1242CDA5800D2644C /* poolprint-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155B242B8FA300D2644C /* poolprint-test.h */; };
9AF416C3242CDA5800D2644C /* securebootkeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8124176C04005CDD5C /* securebootkeys.h */; };
9AF416C5242CDA5800D2644C /* XString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC92241AB33700F3D247 /* XString.h */; };
9AF416C6242CDA5800D2644C /* FloatLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F7324176C04005CDD5C /* FloatLib.h */; };
@ -763,8 +740,6 @@
9AF416E7242CDA5800D2644C /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4224176C04005CDD5C /* platformdata.cpp */; };
9AF416E9242CDA5800D2644C /* XPointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7024176C04005CDD5C /* XPointer.cpp */; };
9AF416EA242CDA5800D2644C /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2E241BC0DF00F3D247 /* strncmp_test.cpp */; };
9AF416EB242CDA5800D2644C /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9B24176C04005CDD5C /* list.cpp */; };
9AF416EC242CDA5800D2644C /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9924176C04005CDD5C /* IO.cpp */; };
9AF416ED242CDA5800D2644C /* sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4A24176C04005CDD5C /* sound.cpp */; };
9AF416EE242CDA5800D2644C /* usbfix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5624176C04005CDD5C /* usbfix.cpp */; };
9AF416EF242CDA5800D2644C /* BmLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5F24176C04005CDD5C /* BmLib.cpp */; };
@ -791,7 +766,6 @@
9AF4170A242CDA5800D2644C /* legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7924176C04005CDD5C /* legacy.cpp */; };
9AF4170B242CDA5800D2644C /* AcpiPatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */; };
9AF4170C242CDA5800D2644C /* BdsConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F2424176C04005CDD5C /* BdsConnect.cpp */; };
9AF4170D242CDA5800D2644C /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4155C242B8FA300D2644C /* poolprint-test.cpp */; };
9AF4170E242CDA5800D2644C /* spd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4024176C04005CDD5C /* spd.cpp */; };
9AF4170F242CDA5800D2644C /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
9AF41710242CDA5800D2644C /* kext_patcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1B24176C04005CDD5C /* kext_patcher.cpp */; };
@ -900,6 +874,8 @@
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printf_lite-test.cpp"; sourceTree = "<group>"; };
9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon_test.h; sourceTree = "<group>"; };
9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon_test.cpp; sourceTree = "<group>"; };
9AC269A624E0514000254048 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = "<group>"; };
9AC269A724E0514000254048 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
9AC77EC424176BF2005CDD5C /* libCloverX64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCloverX64.a; sourceTree = BUILT_PRODUCTS_DIR; };
9AC77ECC24176C04005CDD5C /* XStringArray_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray_test.h; sourceTree = "<group>"; };
9AC77ECD24176C04005CDD5C /* XArray_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XArray_tests.h; sourceTree = "<group>"; };
@ -1031,10 +1007,6 @@
9AC77F9424176C04005CDD5C /* screen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen.cpp; sourceTree = "<group>"; };
9AC77F9624176C04005CDD5C /* lib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lib.cpp; sourceTree = "<group>"; };
9AC77F9724176C04005CDD5C /* lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lib.h; sourceTree = "<group>"; };
9AC77F9824176C04005CDD5C /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = "<group>"; };
9AC77F9924176C04005CDD5C /* IO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IO.cpp; sourceTree = "<group>"; };
9AC77F9A24176C04005CDD5C /* IO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO.h; sourceTree = "<group>"; };
9AC77F9B24176C04005CDD5C /* list.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = list.cpp; sourceTree = "<group>"; };
9AC77F9C24176C04005CDD5C /* menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = menu.h; sourceTree = "<group>"; };
9AC77F9D24176C04005CDD5C /* screen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = screen.h; sourceTree = "<group>"; };
9AC77F9E24176C04005CDD5C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
@ -1062,13 +1034,10 @@
9AD4694E2452B5A600D6D0DB /* Pci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pci.h; sourceTree = "<group>"; };
9AD4694F2452B5A600D6D0DB /* OneLinerMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OneLinerMacros.h; sourceTree = "<group>"; };
9AD469542452B63300D6D0DB /* XToolsConf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsConf.h; sourceTree = "<group>"; };
9AF4155B242B8FA300D2644C /* poolprint-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test.h"; sourceTree = "<group>"; };
9AF4155C242B8FA300D2644C /* poolprint-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "poolprint-test.cpp"; sourceTree = "<group>"; };
9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41560242BABC700D2644C /* printlib-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test.h"; sourceTree = "<group>"; };
9AF41561242BABC700D2644C /* printlib-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printlib-test.cpp"; sourceTree = "<group>"; };
9AF41565242BAD5600D2644C /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF4165E242CD75C00D2644C /* libCloverX64 DEBUG_ALL=1.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCloverX64 DEBUG_ALL=1.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9AF4173B242CDA5800D2644C /* libCloverX64 DEBUG_ALL=2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCloverX64 DEBUG_ALL=2.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9AF4173C242F15CB00D2644C /* BootLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BootLog.h; sourceTree = "<group>"; };
@ -1189,9 +1158,6 @@
9AC780B42417EE53005CDD5C /* global_test.h */,
9A4185B52439F29D00BEAFB8 /* LoadOptions_test.cpp */,
9A4185B42439F29D00BEAFB8 /* LoadOptions_test.h */,
9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */,
9AF4155C242B8FA300D2644C /* poolprint-test.cpp */,
9AF4155B242B8FA300D2644C /* poolprint-test.h */,
9AF41565242BAD5600D2644C /* printf_lite-test-cpp_conf.h */,
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */,
9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */,
@ -1232,9 +1198,6 @@
9AC77F1624176C04005CDD5C /* Platform */ = {
isa = PBXGroup;
children = (
9A105B4724483AE30006DE06 /* Posix */,
9A105B80244852D70006DE06 /* VersionString.cpp */,
9A105B7F244852D70006DE06 /* VersionString.h */,
9AC77F2024176C04005CDD5C /* AcpiPatcher.cpp */,
9A105B4424483AE20006DE06 /* AcpiPatcher.h */,
9AC77F2324176C04005CDD5C /* AmlGenerator.cpp */,
@ -1309,6 +1272,7 @@
9A105B5924483AE30006DE06 /* PlatformDriverOverride.h */,
9AC77F4424176C04005CDD5C /* plist.cpp */,
9A105B4124483AE00006DE06 /* plist.h */,
9A105B4724483AE30006DE06 /* Posix */,
9AC77F5924176C04005CDD5C /* Settings.cpp */,
9AC77F2524176C04005CDD5C /* Settings.h */,
9AC77F5124176C04005CDD5C /* smbios.cpp */,
@ -1324,6 +1288,10 @@
9AC77F1C24176C04005CDD5C /* StateGenerator.h */,
9AC77F5624176C04005CDD5C /* usbfix.cpp */,
9A105B5624483AE30006DE06 /* usbfix.h */,
9AC269A624E0514000254048 /* Utils.cpp */,
9AC269A724E0514000254048 /* Utils.h */,
9A105B80244852D70006DE06 /* VersionString.cpp */,
9A105B7F244852D70006DE06 /* VersionString.h */,
);
path = Platform;
sourceTree = "<group>";
@ -1421,12 +1389,8 @@
isa = PBXGroup;
children = (
9AC77F9324176C04005CDD5C /* icns.cpp */,
9AC77F9924176C04005CDD5C /* IO.cpp */,
9AC77F9A24176C04005CDD5C /* IO.h */,
9AC77F9624176C04005CDD5C /* lib.cpp */,
9AC77F9724176C04005CDD5C /* lib.h */,
9AC77F9B24176C04005CDD5C /* list.cpp */,
9AC77F9824176C04005CDD5C /* list.h */,
9AC77F9E24176C04005CDD5C /* main.cpp */,
9AC77F9C24176C04005CDD5C /* menu.h */,
9A09863024389A6A00826276 /* menu.cpp */,
@ -1497,7 +1461,6 @@
9AC7800724176C04005CDD5C /* AmlGenerator.h in Headers */,
9A105B2D24464A830006DE06 /* BmLib.h in Headers */,
9AF4173F242F15CC00D2644C /* BootLog.h in Headers */,
9AC7807B24176C04005CDD5C /* list.h in Headers */,
9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */,
9AC7801D24176C04005CDD5C /* Events.h in Headers */,
9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */,
@ -1537,7 +1500,6 @@
9AC7801324176C04005CDD5C /* sse3_5_patcher.h in Headers */,
9AC7803E24176C04005CDD5C /* spd.h in Headers */,
9A105B7524483AE40006DE06 /* stdarg.h in Headers */,
9AC7807D24176C04005CDD5C /* IO.h in Headers */,
9A105B6424483AE40006DE06 /* plist.h in Headers */,
9AD469502452B5A600D6D0DB /* Efi.h in Headers */,
9AC7801724176C04005CDD5C /* device_inject.h in Headers */,
@ -1579,7 +1541,6 @@
9AC7803224176C04005CDD5C /* kext_inject.h in Headers */,
9AC7800F24176C04005CDD5C /* Nvram.h in Headers */,
9A9AEB97243F7B5600FBD7D8 /* unicode_conversions.h in Headers */,
9AF41568242BAD7D00D2644C /* poolprint-test-cpp_conf.h in Headers */,
9A105B7724483AE40006DE06 /* string.h in Headers */,
9AC7800024176C04005CDD5C /* gma.h in Headers */,
9A105B7E24483AE40006DE06 /* smbios.h in Headers */,
@ -1598,7 +1559,7 @@
9AC7804124176C04005CDD5C /* Platform.h in Headers */,
9AC7805824176C04005CDD5C /* XImage.h in Headers */,
9AC7808624176C04005CDD5C /* globals_ctor.h in Headers */,
9AF4155D242B8FA400D2644C /* poolprint-test.h in Headers */,
9AC269A924E0514100254048 /* Utils.h in Headers */,
9A4185B62439F29D00BEAFB8 /* LoadOptions_test.h in Headers */,
9AC7806724176C04005CDD5C /* securebootkeys.h in Headers */,
9A105B6324483AE40006DE06 /* card_vlist.h in Headers */,
@ -1631,7 +1592,6 @@
9ACFE66024309AF80071CC93 /* loader.h in Headers */,
9ACFE66124309AF80071CC93 /* AmlGenerator.h in Headers */,
9ACFE66424309AF80071CC93 /* BootLog.h in Headers */,
9ACFE66724309AF80071CC93 /* list.h in Headers */,
9ACFE66924309AF80071CC93 /* XObjArray_tests.h in Headers */,
9ACFE66A24309AF80071CC93 /* Events.h in Headers */,
9ACFE66B24309AF80071CC93 /* printlib-test-cpp_conf.h in Headers */,
@ -1658,7 +1618,6 @@
9ACFE68024309AF80071CC93 /* XObjArray.h in Headers */,
9ACFE68224309AF80071CC93 /* sse3_5_patcher.h in Headers */,
9ACFE68324309AF80071CC93 /* spd.h in Headers */,
9ACFE68424309AF80071CC93 /* IO.h in Headers */,
9ACFE68524309AF80071CC93 /* device_inject.h in Headers */,
9ACFE68624309AF80071CC93 /* entry_scan.h in Headers */,
9ACFE68724309AF80071CC93 /* LoaderUefi.h in Headers */,
@ -1689,7 +1648,6 @@
9ACFE6A224309AF80071CC93 /* kext_inject.h in Headers */,
9ACFE6A324309AF80071CC93 /* Nvram.h in Headers */,
9AD469582452B63900D6D0DB /* XToolsConf.h in Headers */,
9ACFE6A424309AF80071CC93 /* poolprint-test-cpp_conf.h in Headers */,
9ACFE6A524309AF80071CC93 /* gma.h in Headers */,
9ACFE6A624309AF80071CC93 /* sse3_patcher.h in Headers */,
9ACFE6A724309AF80071CC93 /* Version.h in Headers */,
@ -1698,7 +1656,6 @@
9ACFE6AB24309AF80071CC93 /* Platform.h in Headers */,
9ACFE6AC24309AF80071CC93 /* XImage.h in Headers */,
9ACFE6AD24309AF80071CC93 /* globals_ctor.h in Headers */,
9ACFE6AE24309AF80071CC93 /* poolprint-test.h in Headers */,
9A4185B92439F29D00BEAFB8 /* LoadOptions_test.h in Headers */,
9ACFE6B024309AF80071CC93 /* securebootkeys.h in Headers */,
9ACFE6B224309AF80071CC93 /* XString.h in Headers */,
@ -1726,7 +1683,6 @@
9AF41594242CD75C00D2644C /* remove_ref.h in Headers */,
9AF41596242CD75C00D2644C /* loader.h in Headers */,
9AF41597242CD75C00D2644C /* AmlGenerator.h in Headers */,
9AF4159C242CD75C00D2644C /* list.h in Headers */,
9AF4159E242CD75C00D2644C /* XObjArray_tests.h in Headers */,
9AF4159F242CD75C00D2644C /* Events.h in Headers */,
9AF415A0242CD75C00D2644C /* printlib-test-cpp_conf.h in Headers */,
@ -1756,7 +1712,6 @@
9AF415B5242CD75C00D2644C /* XObjArray.h in Headers */,
9AF415B8242CD75C00D2644C /* sse3_5_patcher.h in Headers */,
9AF415B9242CD75C00D2644C /* spd.h in Headers */,
9AF415BA242CD75C00D2644C /* IO.h in Headers */,
9AF415BB242CD75C00D2644C /* device_inject.h in Headers */,
9AF415BC242CD75C00D2644C /* entry_scan.h in Headers */,
9AF415BD242CD75C00D2644C /* LoaderUefi.h in Headers */,
@ -1785,7 +1740,6 @@
9AF415D8242CD75C00D2644C /* kext_inject.h in Headers */,
9AF415D9242CD75C00D2644C /* Nvram.h in Headers */,
9A105B2E24464A830006DE06 /* BmLib.h in Headers */,
9AF415DA242CD75C00D2644C /* poolprint-test-cpp_conf.h in Headers */,
9AF415DB242CD75C00D2644C /* gma.h in Headers */,
9AF415DC242CD75C00D2644C /* sse3_patcher.h in Headers */,
9AF415DD242CD75C00D2644C /* Version.h in Headers */,
@ -1795,7 +1749,6 @@
9AF415E1242CD75C00D2644C /* Platform.h in Headers */,
9AF415E2242CD75C00D2644C /* XImage.h in Headers */,
9AF415E3242CD75C00D2644C /* globals_ctor.h in Headers */,
9AF415E4242CD75C00D2644C /* poolprint-test.h in Headers */,
9AF415E6242CD75C00D2644C /* securebootkeys.h in Headers */,
9AF415E8242CD75C00D2644C /* XString.h in Headers */,
9AF415E9242CD75C00D2644C /* FloatLib.h in Headers */,
@ -1822,7 +1775,6 @@
9AF41671242CDA5800D2644C /* remove_ref.h in Headers */,
9AF41673242CDA5800D2644C /* loader.h in Headers */,
9AF41674242CDA5800D2644C /* AmlGenerator.h in Headers */,
9AF41679242CDA5800D2644C /* list.h in Headers */,
9AF4167B242CDA5800D2644C /* XObjArray_tests.h in Headers */,
9AF4167C242CDA5800D2644C /* Events.h in Headers */,
9AF4167D242CDA5800D2644C /* printlib-test-cpp_conf.h in Headers */,
@ -1852,7 +1804,6 @@
9AF41692242CDA5800D2644C /* XObjArray.h in Headers */,
9AF41695242CDA5800D2644C /* sse3_5_patcher.h in Headers */,
9AF41696242CDA5800D2644C /* spd.h in Headers */,
9AF41697242CDA5800D2644C /* IO.h in Headers */,
9AF41698242CDA5800D2644C /* device_inject.h in Headers */,
9AF41699242CDA5800D2644C /* entry_scan.h in Headers */,
9AF4169A242CDA5800D2644C /* LoaderUefi.h in Headers */,
@ -1881,7 +1832,6 @@
9AF416B5242CDA5800D2644C /* kext_inject.h in Headers */,
9AF416B6242CDA5800D2644C /* Nvram.h in Headers */,
9A105B2F24464A830006DE06 /* BmLib.h in Headers */,
9AF416B7242CDA5800D2644C /* poolprint-test-cpp_conf.h in Headers */,
9AF416B8242CDA5800D2644C /* gma.h in Headers */,
9AF416B9242CDA5800D2644C /* sse3_patcher.h in Headers */,
9AF416BA242CDA5800D2644C /* Version.h in Headers */,
@ -1891,7 +1841,6 @@
9AF416BE242CDA5800D2644C /* Platform.h in Headers */,
9AF416BF242CDA5800D2644C /* XImage.h in Headers */,
9AF416C0242CDA5800D2644C /* globals_ctor.h in Headers */,
9AF416C1242CDA5800D2644C /* poolprint-test.h in Headers */,
9AF416C3242CDA5800D2644C /* securebootkeys.h in Headers */,
9AF416C5242CDA5800D2644C /* XString.h in Headers */,
9AF416C6242CDA5800D2644C /* FloatLib.h in Headers */,
@ -1979,7 +1928,7 @@
9AC77EB924176B08005CDD5C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1120;
TargetAttributes = {
9AC77EC324176BF2005CDD5C = {
CreatedOnToolsVersion = 10.1;
@ -1992,6 +1941,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 9AC77EB824176B08005CDD5C;
productRefGroup = 9AC77EC524176BF2005CDD5C /* Products */;
@ -2117,8 +2067,6 @@
9AC7802B24176C04005CDD5C /* platformdata.cpp in Sources */,
9AC7805724176C04005CDD5C /* XPointer.cpp in Sources */,
9A28CD34241BC0DF00F3D247 /* strncmp_test.cpp in Sources */,
9AC7807E24176C04005CDD5C /* list.cpp in Sources */,
9AC7807C24176C04005CDD5C /* IO.cpp in Sources */,
9AC7803324176C04005CDD5C /* sound.cpp in Sources */,
9AC7803F24176C04005CDD5C /* usbfix.cpp in Sources */,
9AC7804624176C04005CDD5C /* BmLib.cpp in Sources */,
@ -2142,6 +2090,7 @@
9A09863124389A6A00826276 /* menu.cpp in Sources */,
9AC7806924176C04005CDD5C /* lockedgraphics.cpp in Sources */,
9A28CC97241AB34800F3D247 /* XString_test.cpp in Sources */,
9AC269A824E0514100254048 /* Utils.cpp in Sources */,
9A4185BA2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */,
9AC7803724176C04005CDD5C /* device_inject.cpp in Sources */,
9AC7804224176C04005CDD5C /* Settings.cpp in Sources */,
@ -2150,7 +2099,6 @@
9AC7805F24176C04005CDD5C /* legacy.cpp in Sources */,
9AC7800924176C04005CDD5C /* AcpiPatcher.cpp in Sources */,
9AC7800D24176C04005CDD5C /* BdsConnect.cpp in Sources */,
9AF4155E242B8FA400D2644C /* poolprint-test.cpp in Sources */,
9AC7802924176C04005CDD5C /* spd.cpp in Sources */,
9A105B85244852D70006DE06 /* VersionString.cpp in Sources */,
9A9D3B2324221563006D8CD9 /* printf_lite-test.cpp in Sources */,
@ -2229,8 +2177,6 @@
9A01499C244091B300B37399 /* printlib-test.cpp in Sources */,
9ACFE6D724309AF80071CC93 /* XPointer.cpp in Sources */,
9ACFE6D824309AF80071CC93 /* strncmp_test.cpp in Sources */,
9ACFE6D924309AF80071CC93 /* list.cpp in Sources */,
9ACFE6DA24309AF80071CC93 /* IO.cpp in Sources */,
9A4F68552449D4AB004B2F7E /* strcmp.cpp in Sources */,
9ACFE6DB24309AF80071CC93 /* sound.cpp in Sources */,
9ACFE6DC24309AF80071CC93 /* usbfix.cpp in Sources */,
@ -2264,7 +2210,6 @@
9ACFE6F724309AF80071CC93 /* legacy.cpp in Sources */,
9ACFE6F824309AF80071CC93 /* AcpiPatcher.cpp in Sources */,
9ACFE6F924309AF80071CC93 /* BdsConnect.cpp in Sources */,
9ACFE6FA24309AF80071CC93 /* poolprint-test.cpp in Sources */,
9ACFE6FB24309AF80071CC93 /* spd.cpp in Sources */,
9ACFE6FC24309AF80071CC93 /* printf_lite-test.cpp in Sources */,
9ACFE6FD24309AF80071CC93 /* kext_patcher.cpp in Sources */,
@ -2343,8 +2288,6 @@
9A01499A244091B200B37399 /* printlib-test.cpp in Sources */,
9AF4160C242CD75C00D2644C /* XPointer.cpp in Sources */,
9AF4160D242CD75C00D2644C /* strncmp_test.cpp in Sources */,
9AF4160E242CD75C00D2644C /* list.cpp in Sources */,
9AF4160F242CD75C00D2644C /* IO.cpp in Sources */,
9A4F68532449D4AB004B2F7E /* strcmp.cpp in Sources */,
9AF41610242CD75C00D2644C /* sound.cpp in Sources */,
9AF41611242CD75C00D2644C /* usbfix.cpp in Sources */,
@ -2377,7 +2320,6 @@
9AF4162D242CD75C00D2644C /* legacy.cpp in Sources */,
9AF4162E242CD75C00D2644C /* AcpiPatcher.cpp in Sources */,
9AF4162F242CD75C00D2644C /* BdsConnect.cpp in Sources */,
9AF41630242CD75C00D2644C /* poolprint-test.cpp in Sources */,
9AF41631242CD75C00D2644C /* spd.cpp in Sources */,
9AF41632242CD75C00D2644C /* printf_lite-test.cpp in Sources */,
9AF41633242CD75C00D2644C /* kext_patcher.cpp in Sources */,
@ -2457,8 +2399,6 @@
9A01499B244091B300B37399 /* printlib-test.cpp in Sources */,
9AF416E9242CDA5800D2644C /* XPointer.cpp in Sources */,
9AF416EA242CDA5800D2644C /* strncmp_test.cpp in Sources */,
9AF416EB242CDA5800D2644C /* list.cpp in Sources */,
9AF416EC242CDA5800D2644C /* IO.cpp in Sources */,
9A4F68542449D4AB004B2F7E /* strcmp.cpp in Sources */,
9AF416ED242CDA5800D2644C /* sound.cpp in Sources */,
9AF416EE242CDA5800D2644C /* usbfix.cpp in Sources */,
@ -2491,7 +2431,6 @@
9AF4170A242CDA5800D2644C /* legacy.cpp in Sources */,
9AF4170B242CDA5800D2644C /* AcpiPatcher.cpp in Sources */,
9AF4170C242CDA5800D2644C /* BdsConnect.cpp in Sources */,
9AF4170D242CDA5800D2644C /* poolprint-test.cpp in Sources */,
9AF4170E242CDA5800D2644C /* spd.cpp in Sources */,
9AF4170F242CDA5800D2644C /* printf_lite-test.cpp in Sources */,
9AF41710242CDA5800D2644C /* kext_patcher.cpp in Sources */,
@ -2540,12 +2479,30 @@
9AC77EBD24176B08005CDD5C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_FLOAT_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"STRING_ARRAY_NAME=CLOVERStrings",
"EFIAPI=__attribute__((ms_abi))",
@ -2559,8 +2516,14 @@
NO_MSABI_VA_FUNCS,
DISABLE_PRINTLIB,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
$PROJECT_DIR/../../rEFIt_UEFI/include,
@ -2596,6 +2559,8 @@
"-Wno-incompatible-ms-struct",
"-Wreorder",
"-Wchar-subscripts",
"-Wmismatched-tags",
"-Wimplicit-function-declaration",
);
SUPPORTED_PLATFORMS = macosx;
USE_HEADERMAP = NO;
@ -2606,15 +2571,38 @@
9AC77EBE24176B08005CDD5C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_FLOAT_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
$PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG,
$PROJECT_DIR/../../rEFIt_UEFI/include,
@ -2650,6 +2638,8 @@
"-Wno-incompatible-ms-struct",
"-Wreorder",
"-Wchar-subscripts",
"-Wmismatched-tags",
"-Wimplicit-function-declaration",
);
SUPPORTED_PLATFORMS = macosx;
USE_HEADERMAP = NO;
@ -2666,7 +2656,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -2726,7 +2716,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -2779,7 +2769,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -2840,7 +2830,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -2893,7 +2883,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -2954,7 +2944,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -3007,7 +2997,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
@ -3067,7 +3057,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_WEAK = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;

View File

@ -470,7 +470,7 @@
9A9223252402FD1000483CBA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = "JF Knudsen";
TargetAttributes = {
9A92232C2402FD1000483CBA = {
@ -484,6 +484,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 9A9223242402FD1000483CBA;
productRefGroup = 9A92232E2402FD1000483CBA /* Products */;
@ -621,6 +622,7 @@
9A0B08842403B08400E2B470 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -630,6 +632,7 @@
9A0B08852403B08400E2B470 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -639,6 +642,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -649,6 +653,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -657,6 +662,7 @@
9A57C22D2418B9A00029A39F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
@ -671,6 +677,7 @@
9A57C22E2418B9A00029A39F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
OTHER_CFLAGS = (
@ -857,6 +864,7 @@
9A9223352402FD1000483CBA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
OTHER_CFLAGS = (
@ -870,6 +878,7 @@
9A9223362402FD1000483CBA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
OTHER_CFLAGS = (
"$(inherited)",

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@ -38,8 +36,8 @@
ReferencedContainer = "container:cpp_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -43,12 +43,12 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
disableMainThreadChecker = "YES"
enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
stopOnEveryMainThreadCheckerIssue = "YES"
migratedStopOnEveryIssue = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
@ -62,6 +62,28 @@
ReferencedContainer = "container:cpp_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "DYLD_INSERT_LIBRARIES"
value = "/usr/lib/libgmalloc.dylib"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "MallocGuardEdges"
value = ""
isEnabled = "YES">
</AdditionalOption>
<AdditionalOption
key = "MallocScribble"
value = ""
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -238,7 +238,7 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index)
CopyMem(&OTID[0], &Table->OemTableId, 8);
//DBG(" Found table: %s %s len=%d\n", sign, OTID, (INT32)Table->Length);
DBG(" - [%02d]: %s %s len=%d\n", Index, sign, OTID, (INT32)Table->Length);
ACPI_DROP_TABLE* DropTable = (__typeof__(DropTable))AllocateZeroPool(sizeof(ACPI_DROP_TABLE));
ACPI_DROP_TABLE* DropTable = new ACPI_DROP_TABLE;
DropTable->Signature = Table->Signature;
DropTable->TableId = Table->OemTableId;
DropTable->Length = Table->Length;
@ -531,14 +531,14 @@ EFI_STATUS InsertTable(VOID* TableEntry, UINTN Length)
return Status;
}
UINTN IndexFromFileName(CHAR16* FileName)
UINTN IndexFromFileName(CONST CHAR16* FileName)
{
// FileName must be as "XXXX-number-..." or "XXXX-number.aml", such as "SSDT-9.aml", or "SSDT-11-SaSsdt.aml"
// But just checking for '-' or '.' following the number.
// search for '-'
UINTN Result = IGNORE_INDEX;
CHAR16* temp = FileName;
CONST CHAR16* temp = FileName;
for (; *temp != 0 && *temp != '-'; temp++);
if ('-' == *temp && 4 == temp-FileName) {
++temp;
@ -754,16 +754,12 @@ EFI_STATUS SaveBufferToDisk(VOID *Buffer, UINTN Length, CONST CHAR16 *DirName, C
return EFI_INVALID_PARAMETER;
}
FileName = PoolPrint(L"%s\\%s", DirName, FileName);
if (FileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
XStringW PathName = SWPrintf("%ls\\%ls", DirName, FileName);
EFI_STATUS Status = egSaveFile(SelfRootDir, FileName, Buffer, Length);
EFI_STATUS Status = egSaveFile(SelfRootDir, PathName.wc_str(), Buffer, Length);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, FileName, Buffer, Length);
Status = egSaveFile(NULL, PathName.wc_str(), Buffer, Length);
}
FreePool(FileName);
return Status;
}
@ -800,7 +796,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
//DBG(" Allocaing mSavedTables");
mSavedTablesEntries = SAVED_TABLES_ALLOC_ENTRIES;
mSavedTablesNum = 0;
mSavedTables = (__typeof__(mSavedTables))AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
mSavedTables = (__typeof__(mSavedTables))BllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
if (mSavedTables == NULL) {
return;
}
@ -856,12 +852,12 @@ STATIC UINT8 NameCSDT2[] = {0x80, 0x43, 0x53, 0x44, 0x54};
//UINT32 get_size(UINT8 * An, UINT32 ); // Let borrow from FixBiosDsdt.
static CHAR16* GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount, UINTN ChildCount, CHAR8 OemTableId[9])
static XStringW GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount, UINTN ChildCount, CHAR8 OemTableId[9])
// ChildCount == IGNORE_INDEX indicates normal SSDT
// SsdtCount == IGNORE_INDEX indicates dynamic SSDT in DSDT
// otherwise is child SSDT from normal SSDT
{
CHAR16* FileName;
XStringW FileName;
CHAR8 Suffix[10]; // "-" + OemTableId + NUL
if (gSettings.NoOemTableId || 0 == OemTableId[0]) {
Suffix[0] = 0;
@ -871,15 +867,14 @@ static CHAR16* GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount, U
}
if (IGNORE_INDEX == ChildCount) {
// normal SSDT
FileName = PoolPrint(L"%sSSDT-%d%a.aml", FileNamePrefix, SsdtCount, Suffix);
FileName = SWPrintf("%lsSSDT-%llu%s.aml", FileNamePrefix, SsdtCount, Suffix);
} else if (IGNORE_INDEX == SsdtCount) {
// dynamic SSDT in DSDT
FileName = PoolPrint(L"%sSSDT-xDSDT_%d%a.aml", FileNamePrefix, ChildCount, Suffix);
FileName = SWPrintf("%lsSSDT-xDSDT_%llu%s.aml", FileNamePrefix, ChildCount, Suffix);
} else {
// dynamic SSDT in static SSDT
FileName = PoolPrint(L"%sSSDT-x%d_%d%a.aml", FileNamePrefix, SsdtCount, ChildCount, Suffix);
FileName = SWPrintf("%lsSSDT-x%llu_%llu%s.aml", FileNamePrefix, SsdtCount, ChildCount, Suffix);
}
// caller must free PoolPrint return value with FreePool
return FileName;
}
@ -887,7 +882,6 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
{
EFI_STATUS Status = EFI_SUCCESS;
INTN j, k, pacLen, pacCount;
CHAR16 *FileName;
CHAR8 Signature[5];
CHAR8 OemTableId[9];
UINTN adr, len;
@ -944,18 +938,17 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
DBG("%02hhX ", ((UINT8*)adr)[k]);
}
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((VOID*)adr)) {
FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
XStringW FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
len = ((UINT16*)adr)[2];
DBG("Internal length = %llu", len);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName);
DBG("Internal length = %llu", len);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName.wc_str());
if (!EFI_ERROR(Status)) {
DBG(" -> %ls", FileName);
DBG(" -> %ls", FileName.wc_str());
MarkTableAsSaved((VOID*)adr);
ChildCount++;
} else {
DBG(" -> %s", strerror(Status));
}
FreePool(FileName);
}
DBG("\n");
}
@ -990,16 +983,15 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
DBG("%02hhX ", ((UINT8*)adr)[k]);
}
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((VOID*)adr)) {
FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName);
XStringW FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName.wc_str());
if (!EFI_ERROR(Status)) {
DBG(" -> %ls", FileName);
DBG(" -> %ls", FileName.wc_str());
MarkTableAsSaved((VOID*)adr);
ChildCount++;
} else {
DBG(" -> %s", strerror(Status));
}
FreePool(FileName);
}
DBG("\n");
}
@ -1013,12 +1005,11 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
/** Saves Table to disk as DirName\\FileName (DirName != NULL)
* or just prints basic table data to log (DirName == NULL).
*/
EFI_STATUS DumpTable(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR8 *CheckSignature, CONST CHAR16 *DirName, CONST CHAR16 *FileName, CONST CHAR16 *FileNamePrefix, INTN *SsdtCount)
EFI_STATUS DumpTable(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR8 *CheckSignature, CONST CHAR16 *DirName, const XStringW& FileName, CONST CHAR16 *FileNamePrefix, INTN *SsdtCount)
{
EFI_STATUS Status;
CHAR8 Signature[5];
CHAR8 OemTableId[9];
BOOLEAN ReleaseFileName = FALSE;
// Take Signature and OemId for printing
CopyMem(&Signature[0], &TableEntry->Signature, 4);
@ -1081,23 +1072,19 @@ EFI_STATUS DumpTable(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR8 *Check
FileNamePrefix = L"";
}
if (FileName == NULL) {
XStringW ReleaseFileName = FileName;
if (ReleaseFileName.isEmpty()) {
// take the name from the signature
if (TableEntry->Signature == EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE && SsdtCount != NULL) {
FileName = GenerateFileName(FileNamePrefix, *SsdtCount, IGNORE_INDEX, OemTableId);
ReleaseFileName = GenerateFileName(FileNamePrefix, *SsdtCount, IGNORE_INDEX, OemTableId);
} else {
FileName = PoolPrint(L"%s%a.aml", FileNamePrefix, Signature);
ReleaseFileName = SWPrintf("%ls%s.aml", FileNamePrefix, Signature);
}
if (FileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
ReleaseFileName = TRUE;
}
DBG(" -> %ls", FileName);
DBG(" -> %ls", ReleaseFileName.wc_str());
// Save it
Status = SaveBufferToDisk(TableEntry, TableEntry->Length, DirName, FileName);
Status = SaveBufferToDisk(TableEntry, TableEntry->Length, DirName, ReleaseFileName.wc_str());
MarkTableAsSaved(TableEntry);
if (TableEntry->Signature == EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE && SsdtCount != NULL) {
@ -1105,10 +1092,6 @@ EFI_STATUS DumpTable(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR8 *Check
*SsdtCount += 1;
}
if (ReleaseFileName) {
FreePool(FileName);
}
return Status;
}
@ -1121,7 +1104,6 @@ EFI_STATUS DumpFadtTables(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt, CONST
UINT64 DsdtAdr;
UINT64 FacsAdr;
CHAR8 Signature[5];
CHAR16 *FileName;
//
// if Fadt->Revision < 3 (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION), then it is Acpi 1.0
@ -1151,7 +1133,7 @@ EFI_STATUS DumpFadtTables(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt, CONST
if (DsdtAdr != 0) {
DBG(" ");
TableEntry = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)DsdtAdr;
Status = DumpTable(TableEntry, "DSDT", DirName, NULL, FileNamePrefix, NULL);
Status = DumpTable(TableEntry, "DSDT", DirName, L""_XSW, FileNamePrefix, NULL);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return Status;
@ -1181,11 +1163,10 @@ EFI_STATUS DumpFadtTables(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt, CONST
}
if (DirName != NULL && !IsTableSaved(Facs)) {
FileName = PoolPrint(L"%sFACS.aml", FileNamePrefix);
DBG(" -> %ls", FileName);
Status = SaveBufferToDisk(Facs, Facs->Length, DirName, FileName);
XStringW FileName = SWPrintf("%lsFACS.aml", FileNamePrefix);
DBG(" -> %ls", FileName.wc_str());
Status = SaveBufferToDisk(Facs, Facs->Length, DirName, FileName.wc_str());
MarkTableAsSaved(Facs);
FreePool(FileName);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return Status;
@ -1256,7 +1237,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
* ACPI tables given by RsdPtr.
* Takes tables from Xsdt if present or from Rsdt if Xsdt is not present.
*/
VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
VOID DumpTables(VOID *RsdPtrVoid, CONST CHAR16 *DirName)
{
EFI_STATUS Status;
UINTN Length;
@ -1337,7 +1318,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
//
if (Xsdt != NULL) {
DBG(" ");
Status = DumpTable((EFI_ACPI_DESCRIPTION_HEADER *)Xsdt, "XSDT", DirName, L"XSDT.aml", FileNamePrefix, NULL);
Status = DumpTable((EFI_ACPI_DESCRIPTION_HEADER *)Xsdt, "XSDT", DirName, L"XSDT.aml"_XSW, FileNamePrefix, NULL);
if (EFI_ERROR(Status)) {
DBG(" - %s", strerror(Status));
Xsdt = NULL;
@ -1349,7 +1330,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
//
if (Rsdt != NULL) {
DBG(" ");
Status = DumpTable((EFI_ACPI_DESCRIPTION_HEADER *)Rsdt, "RSDT", DirName, L"RSDT.aml", FileNamePrefix, NULL);
Status = DumpTable((EFI_ACPI_DESCRIPTION_HEADER *)Rsdt, "RSDT", DirName, L"RSDT.aml"_XSW, FileNamePrefix, NULL);
if (EFI_ERROR(Status)) {
DBG(" - %s", strerror(Status));
Rsdt = NULL;
@ -1382,7 +1363,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
}
if (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE == Table->Signature) {
// Fadt - save Dsdt and Facs
Status = DumpTable(Table, NULL, DirName, NULL, FileNamePrefix, &SsdtCount);
Status = DumpTable(Table, NULL, DirName, L""_XSW, FileNamePrefix, &SsdtCount);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return;
@ -1394,7 +1375,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
return;
}
} else {
Status = DumpTable(Table, NULL, DirName, NULL, FileNamePrefix, &SsdtCount);
Status = DumpTable(Table, NULL, DirName, L""_XSW, FileNamePrefix, &SsdtCount);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return;
@ -1425,7 +1406,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
}
if (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE == Table->Signature) {
// Fadt - save Dsdt and Facs
Status = DumpTable(Table, NULL, DirName, NULL, FileNamePrefix, &SsdtCount);
Status = DumpTable(Table, NULL, DirName, L""_XSW, FileNamePrefix, &SsdtCount);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return;
@ -1437,7 +1418,7 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
return;
}
} else {
Status = DumpTable(Table, NULL, DirName, NULL, FileNamePrefix, &SsdtCount);
Status = DumpTable(Table, NULL, DirName, L""_XSW, FileNamePrefix, &SsdtCount);
if (EFI_ERROR(Status)) {
DBG(" - %s\n", strerror(Status));
return;
@ -1460,10 +1441,10 @@ VOID DumpTables(VOID *RsdPtrVoid, CHAR16 *DirName)
VOID SaveOemTables()
{
// EFI_STATUS Status;
VOID *RsdPtr;
CHAR16 *AcpiOriginPath = PoolPrint(L"%s\\ACPI\\origin", OEMPath);
VOID *RsdPtr;
XStringW AcpiOriginPath = SWPrintf("%ls\\ACPI\\origin", OEMPath.wc_str());
BOOLEAN Saved = FALSE;
CHAR8 *MemLogStart;
CHAR8 *MemLogStart;
UINTN MemLogStartLen;
MemLogStartLen = GetMemLogLen();
@ -1479,7 +1460,7 @@ VOID SaveOemTables()
DBG("Found BIOS RSDP at %p\n", RsdPtr);
if (gFirmwareClover) {
// Save it
DumpTables(RsdPtr, AcpiOriginPath);
DumpTables(RsdPtr, AcpiOriginPath.wc_str());
Saved = TRUE;
} else {
// just print to log
@ -1494,7 +1475,7 @@ VOID SaveOemTables()
if (RsdPtr != NULL) { //it may be EFI_SUCCESS but null pointer
DBG("Found UEFI Acpi 2.0 RSDP at %p\n", RsdPtr);
// if tables already saved, then just print to log
DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath);
DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str());
Saved = TRUE;
}
//
@ -1505,12 +1486,11 @@ VOID SaveOemTables()
if (RsdPtr != NULL) {
DBG("Found UEFI Acpi 1.0 RSDP at %p\n", RsdPtr);
// if tables already saved, then just print to log
DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath);
DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str());
// Saved = TRUE;
}
SaveBufferToDisk(MemLogStart, GetMemLogLen() - MemLogStartLen, AcpiOriginPath, L"DumpLog.txt");
SaveBufferToDisk(MemLogStart, GetMemLogLen() - MemLogStartLen, AcpiOriginPath.wc_str(), L"DumpLog.txt");
FreePool(mSavedTables);
FreePool(AcpiOriginPath);
}
VOID SaveOemDsdt(BOOLEAN FullPatch)
@ -1519,27 +1499,25 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer = NULL;
EFI_PHYSICAL_ADDRESS dsdt = EFI_SYSTEM_TABLE_MAX_ADDRESS;
UINTN Pages;
UINT8 *buffer = NULL;
UINTN DsdtLen = 0;
CHAR16* OriginDsdt = PoolPrint(L"%s\\ACPI\\origin\\DSDT.aml", OEMPath);
CHAR16* OriginDsdtFixed = PoolPrint(L"%s\\ACPI\\origin\\DSDT-%x.aml", OEMPath, gSettings.FixDsdt);
CONST CHAR16* PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
CHAR16* PathDsdt; // = L"\\DSDT.aml";
CHAR16* AcpiOemPath = PoolPrint(L"%s\\ACPI\\patched", OEMPath);
UINTN Pages;
UINT8 *buffer = NULL;
UINTN DsdtLen = 0;
XStringW OriginDsdt = SWPrintf("%ls\\ACPI\\origin\\DSDT.aml", OEMPath.wc_str());
XStringW OriginDsdtFixed = SWPrintf("%ls\\ACPI\\origin\\DSDT-%x.aml", OEMPath.wc_str(), gSettings.FixDsdt);
constexpr LStringW PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
XStringW PathDsdt;
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
PathDsdt = PoolPrint(L"\\%s", gSettings.DsdtName);
PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName);
if (FileExists(SelfRootDir, PoolPrint(L"%s%s", AcpiOemPath, PathDsdt))) {
DBG("DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath, PathDsdt);
Status = egLoadFile(SelfRootDir, PoolPrint(L"%s%s", AcpiOemPath, PathDsdt), &buffer, &DsdtLen);
//REVIEW: memory leak...buffer
if (FileExists(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &DsdtLen);
}
if (EFI_ERROR(Status) && FileExists(SelfRootDir, PoolPrint(L"%s%s", PathPatched, PathDsdt))) {
DBG("DSDT found in Clover volume common folder: %ls%ls\n", PathPatched, PathDsdt);
Status = egLoadFile(SelfRootDir, PoolPrint(L"%s%s", PathPatched, PathDsdt), &buffer, &DsdtLen);
//REVIEW: memory leak...buffer
if (EFI_ERROR(Status) && FileExists(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume common folder: %ls%ls\n", PathPatched.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &DsdtLen);
}
if (EFI_ERROR(Status)) {
@ -1577,27 +1555,22 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
if (FullPatch) {
FixBiosDsdt(buffer, FadtPointer, NULL);
DsdtLen = ((EFI_ACPI_DESCRIPTION_HEADER*)buffer)->Length;
FreePool(OriginDsdt); //avoid memory leak
OriginDsdt = OriginDsdtFixed;
OriginDsdtFixed = NULL; //to not free twice
}
Status = egSaveFile(SelfRootDir, OriginDsdt, buffer, DsdtLen);
Status = egSaveFile(SelfRootDir, OriginDsdt.wc_str(), buffer, DsdtLen);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, OriginDsdt, buffer, DsdtLen);
Status = egSaveFile(NULL, OriginDsdt.wc_str(), buffer, DsdtLen);
}
if (!EFI_ERROR(Status)) {
MsgLog("DSDT saved to %ls\n", OriginDsdt);
MsgLog("DSDT saved to %ls\n", OriginDsdt.wc_str());
} else {
MsgLog("Saving DSDT to %ls failed - %s\n", OriginDsdt, strerror(Status));
MsgLog("Saving DSDT to %ls failed - %s\n", OriginDsdt.wc_str(), strerror(Status));
}
gBS->FreePages(dsdt, Pages);
}
FreePool(OriginDsdt);
if (OriginDsdtFixed) FreePool(OriginDsdtFixed);
FreePool(AcpiOemPath);
}
BOOLEAN LoadPatchedAML(CHAR16* AcpiOemPath, CHAR16* PartName, UINTN Pass)
BOOLEAN LoadPatchedAML(CONST CHAR16* AcpiOemPath, CONST CHAR16* PartName, UINTN Pass)
{
CHAR16 FullName[256];
// pass1 prefilter based on file names (optimization that avoids loading same files twice)
@ -1640,7 +1613,7 @@ BOOLEAN LoadPatchedAML(CHAR16* AcpiOemPath, CHAR16* PartName, UINTN Pass)
#define BVALUE_ATTEMPTED 2 // special value for MenuItem.BValue to avoid excessive log output
void LoadAllPatchedAML(CHAR16* AcpiOemPath, UINTN Pass)
void LoadAllPatchedAML(CONST CHAR16* AcpiOemPath, UINTN Pass)
{
if (!gSettings.AutoMerge && AUTOMERGE_PASS1 == Pass) {
// nothing to do in this case, since AutoMerge=false -> no tables ever merged
@ -1713,8 +1686,8 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
SSDT_TABLE *Ssdt = NULL;
UINT8 *buffer = NULL;
UINTN bufferLen = 0;
CONST CHAR16* PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
CHAR16* PathDsdt; // = L"\\DSDT.aml";
constexpr LStringW PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
XStringW PathDsdt; // = L"\\DSDT.aml";
// CHAR16* PatchedAPIC = L"\\EFI\\CLOVER\\ACPI\\origin\\APIC-p.aml";
UINT32* rf = NULL;
UINT64* xf = NULL;
@ -1731,16 +1704,16 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE *ProcLocalApic;
EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE *LocalApicNMI;
// UINTN ApicLen;
UINTN ApicCPUNum;
UINTN ApicCPUNum;
UINT8 *SubTable;
BOOLEAN DsdtLoaded = FALSE;
BOOLEAN NeedUpdate = FALSE;
BOOLEAN DsdtLoaded = FALSE;
BOOLEAN NeedUpdate = FALSE;
OPER_REGION *tmpRegion;
CHAR16* AcpiOemPath = PoolPrint(L"%s\\ACPI\\patched", OEMPath);
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
DbgHeader("PatchACPI");
PathDsdt = PoolPrint(L"\\%s", gSettings.DsdtName);
PathDsdt = SWPrintf("\\%ls", gSettings.DsdtName);
//try to find in SystemTable
for(Index = 0; Index < gST->NumberOfTableEntries; Index++) {
if(CompareGuid (&gST->ConfigurationTable[Index].VendorGuid, &gEfiAcpi20TableGuid)) {
@ -1989,21 +1962,21 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
RootDir = Volume->RootDir;
Status = EFI_NOT_FOUND;
if (FileExists(SelfRootDir, PoolPrint(L"%s%s", AcpiOemPath, PathDsdt))) {
DBG("DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath, PathDsdt);
Status = egLoadFile(SelfRootDir, PoolPrint(L"%s%s", AcpiOemPath, PathDsdt), &buffer, &bufferLen);
if (FileExists(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
if (EFI_ERROR(Status) && FileExists(RootDir, PathDsdt)) {
DBG("DSDT found in booted volume\n");
Status = egLoadFile(RootDir, PathDsdt, &buffer, &bufferLen);
Status = egLoadFile(RootDir, PathDsdt.wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
if (EFI_ERROR(Status) && FileExists(SelfRootDir, PoolPrint(L"%s%s", PathPatched, PathDsdt))) {
DBG("DSDT found in Clover volume: %ls%ls\n", PathPatched, PathDsdt);
Status = egLoadFile(SelfRootDir, PoolPrint(L"%s%s", PathPatched, PathDsdt), &buffer, &bufferLen);
if (EFI_ERROR(Status) && FileExists(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume: %ls%ls\n", PathPatched.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
//
@ -2096,10 +2069,10 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
// XsdtReplaceSizes array is used to keep track of allocations for the merged tables,
// as those tables may need to be freed if patched later.
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))BllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
// Load merged ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath, AUTOMERGE_PASS1);
LoadAllPatchedAML(AcpiOemPath.wc_str(), AUTOMERGE_PASS1);
// Drop tables
if (gSettings.ACPIDropTables) {
@ -2126,7 +2099,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
PatchAllTables();
// Load add-on ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath, AUTOMERGE_PASS2);
LoadAllPatchedAML(AcpiOemPath.wc_str(), AUTOMERGE_PASS2);
if (XsdtReplaceSizes) {
FreePool(XsdtReplaceSizes);
@ -2293,7 +2266,6 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
FreePool(gRegions);
gRegions = tmpRegion;
}
FreePool(AcpiOemPath);
return EFI_SUCCESS;
}
@ -2303,25 +2275,22 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
* by caller.
*/
EFI_STATUS LoadAcpiTable (
CHAR16 *PathPatched,
CHAR16 *TableName,
CONST CHAR16 *PathPatched,
CONST CHAR16 *TableName,
UINT8 **Buffer,
UINTN *BufferLen
UINTN *BufferLen
)
{
EFI_STATUS Status;
CHAR16* TmpStr;
Status = EFI_NOT_FOUND;
// checking \EFI\ACPI\patched dir
TmpStr = PoolPrint(L"%s\\%s", PathPatched, TableName);
XStringW TmpStr = SWPrintf("%ls\\%ls", PathPatched, TableName);
if (FileExists(SelfRootDir, TmpStr)) {
DBG("found %ls\n", TmpStr);
Status = egLoadFile(SelfRootDir, TmpStr, Buffer, BufferLen);
DBG("found %ls\n", TmpStr.wc_str());
Status = egLoadFile(SelfRootDir, TmpStr.wc_str(), Buffer, BufferLen);
}
FreePool(TmpStr);
return Status;
}
@ -2329,7 +2298,7 @@ EFI_STATUS LoadAcpiTable (
* Searches for DSDT in AcpiOemPath or PathPatched dirs and inserts it
* to FadtPointer if found.
*/
EFI_STATUS LoadAndInjectDSDT(CHAR16 *PathPatched,
EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched,
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer)
{
EFI_STATUS Status;
@ -2372,8 +2341,8 @@ EFI_STATUS LoadAndInjectDSDT(CHAR16 *PathPatched,
* Searches for TableName in AcpiOemPath or PathPatched dirs and inserts it
* to Rsdt and/or Xsdt (globals) if found.
*/
EFI_STATUS LoadAndInjectAcpiTable(CHAR16 *PathPatched,
CHAR16 *TableName)
EFI_STATUS LoadAndInjectAcpiTable(CONST CHAR16 *PathPatched,
CONST CHAR16 *TableName)
{
EFI_STATUS Status;
UINT8 *Buffer = NULL;
@ -2436,8 +2405,6 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
EFI_STATUS Status; // = EFI_SUCCESS;
// UINTN Index;
CHAR16* PathPatched;
CHAR16* AcpiOemPath;
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry;
@ -2505,15 +2472,14 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
//
// prepare dirs that will be searched for custom ACPI tables
AcpiOemPath = PoolPrint(L"%s\\ACPI\\%s", OEMPath, OsSubdir);
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\%ls", OEMPath.wc_str(), OsSubdir);
XStringW PathPatched;
if (FileExists(SelfRootDir, AcpiOemPath)) {
PathPatched = AcpiOemPath;
} else {
FreePool(AcpiOemPath);
PathPatched = PoolPrint(L"\\EFI\\CLOVER\\ACPI\\%s", OsSubdir);
PathPatched = SWPrintf("\\EFI\\CLOVER\\ACPI\\%ls", OsSubdir);
}
if (!FileExists(SelfRootDir, PathPatched)) {
FreePool(PathPatched);
DBG("Dir %ls not found. No patching will be done.\n", OsSubdir);
return EFI_NOT_FOUND;
}
@ -2521,7 +2487,7 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
//
// Inject DSDT
//
/* Status = */LoadAndInjectDSDT(PathPatched, FadtPointer);
/* Status = */LoadAndInjectDSDT(PathPatched.wc_str(), FadtPointer);
//
// Drop SSDT if requested. Not until now
@ -2549,7 +2515,7 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
// find and inject other ACPI tables
//
DirIterOpen(SelfRootDir, PathPatched, &DirIter);
DirIterOpen(SelfRootDir, PathPatched.wc_str(), &DirIter);
while (DirIterNext(&DirIter, 2, L"*.aml", &DirEntry)) {
if (DirEntry->FileName[0] == L'.') {
@ -2559,7 +2525,7 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
continue;
}
LoadAndInjectAcpiTable(PathPatched, DirEntry->FileName);
LoadAndInjectAcpiTable(PathPatched.wc_str(), DirEntry->FileName);
}
/*Status = */DirIterClose(&DirIter);
@ -2567,8 +2533,6 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
PostCleanupRSDT();
PostCleanupXSDT();
// release mem
if (PathPatched) FreePool(PathPatched);
return EFI_SUCCESS;
}

View File

@ -52,7 +52,7 @@ BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node)
AML_CHUNK* aml_create_node(AML_CHUNK* parent)
{
AML_CHUNK* node = (AML_CHUNK*)AllocateZeroPool(sizeof(AML_CHUNK));
AML_CHUNK* node = (AML_CHUNK*)BllocateZeroPool(sizeof(AML_CHUNK));
aml_add_to_parent(parent, node);
@ -91,7 +91,7 @@ AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, CONST UINT8* buffer, UINT32 size)
{
node->Type = AML_CHUNK_NONE;
node->Length = (UINT16)size;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
CopyMem(node->Buffer, buffer, node->Length);
}
@ -107,7 +107,7 @@ AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value)
node->Type = AML_CHUNK_BYTE;
node->Length = 1;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[0] = value;
}
@ -122,7 +122,7 @@ AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value)
{
node->Type = AML_CHUNK_WORD;
node->Length = 2;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = value >> 8;
}
@ -138,7 +138,7 @@ AML_CHUNK* aml_add_dword(AML_CHUNK* parent, UINT32 value)
{
node->Type = AML_CHUNK_DWORD;
node->Length = 4;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = (value >> 8) & 0xff;
node->Buffer[2] = (value >> 16) & 0xff;
@ -156,7 +156,7 @@ AML_CHUNK* aml_add_qword(AML_CHUNK* parent, UINT64 value)
{
node->Type = AML_CHUNK_QWORD;
node->Length = 8;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = RShiftU64(value, 8) & 0xff;
node->Buffer[2] = RShiftU64(value, 16) & 0xff;
@ -206,7 +206,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
if (count == 1)
{
node->Length = (UINT16)(4 + root);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
CopyMem(node->Buffer, name, 4 + root);
offset += 4 + root;
return (UINT32)offset;
@ -215,7 +215,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
if (count == 2)
{
node->Length = 2 + 8;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2e; // Double name
CopyMem(node->Buffer+offset, name + root, 8);
@ -224,7 +224,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
}
node->Length = (UINT16)(3 + (count << 2));
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2f; // Multi name
node->Buffer[offset++] = (CHAR8)count; // Names count
@ -288,7 +288,7 @@ AML_CHUNK* aml_add_package(AML_CHUNK* parent)
node->Type = AML_CHUNK_PACKAGE;
node->Length = 1;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
}
return node;
@ -303,7 +303,7 @@ AML_CHUNK* aml_add_alias(AML_CHUNK* parent, /* CONST*/ CHAR8* name1, /* CONST*/
node->Type = AML_CHUNK_ALIAS;
node->Length = 8;
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
aml_fill_simple_name(node->Buffer, name1);
aml_fill_simple_name(node->Buffer+4, name2);
}
@ -385,7 +385,7 @@ AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32
INTN offset=0;
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(size + 2);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A
node->Buffer[offset++] = (CHAR8)size;
CopyMem(node->Buffer+offset, data, node->Length);
@ -404,7 +404,7 @@ AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, CONST CHAR8* StringBuf)
UINTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(len + 3);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE;
node->Buffer[offset++] = (CHAR8)(len + 1);
CopyMem(node->Buffer+offset, StringBuf, len);
@ -423,7 +423,7 @@ AML_CHUNK* aml_add_string(AML_CHUNK* parent, CONST CHAR8* StringBuf)
INTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_STRING;
node->Length = (UINT8)(len + 1);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(len + 1);
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(len + 1);
CopyMem(node->Buffer, StringBuf, len);
// node->Buffer[len] = '\0';
}

View File

@ -397,7 +397,7 @@ AddToBootOrder (
//
// Make new order buffer with space for our option
//
BootOrderNew = (__typeof__(BootOrderNew))AllocateZeroPool((BootOrderLen + 1) * sizeof(UINT16));
BootOrderNew = (__typeof__(BootOrderNew))BllocateZeroPool((BootOrderLen + 1) * sizeof(UINT16));
if (BootOrderNew == NULL) {
DBG("AddToBootOrder: EFI_OUT_OF_RESOURCES\n");
if (BootOrder) {
@ -529,16 +529,12 @@ PrintBootOption (
)
{
UINTN VarSizeTmp;
CHAR16 *FPStr;
DBG("%2llu) Boot%04hX: %ls, Attr: 0x%X\n",
Index, BootOption->BootNum, BootOption->Description, BootOption->Attributes);
FPStr = FileDevicePathToStr(BootOption->FilePathList);
DBG(" %ls\n", FPStr);
FreePool(FPStr);
DBG(" %ls\n", FileDevicePathToXStringW(BootOption->FilePathList).wc_str());
VarSizeTmp = sizeof(BootOption->Attributes)
VarSizeTmp = sizeof(BootOption->Attributes)
+ sizeof(BootOption->FilePathListLength)
+ BootOption->DescriptionSize
+ BootOption->FilePathListLength
@ -651,7 +647,7 @@ CompileBootOption (
+ BootOption->DescriptionSize
+ BootOption->FilePathListLength
+ BootOption->OptionalDataSize;
BootOption->Variable = (__typeof__(BootOption->Variable))AllocateZeroPool(BootOption->VariableSize);
BootOption->Variable = (__typeof__(BootOption->Variable))BllocateZeroPool(BootOption->VariableSize);
if (BootOption->Variable == NULL) {
DBG("CompileBootOption: EFI_OUT_OF_RESOURCES\n");
return EFI_OUT_OF_RESOURCES;
@ -778,14 +774,14 @@ FindBootOptionForFile (
return EFI_OUT_OF_RESOURCES;
}
SearchedDevicePathSize[0] = GetDevicePathSize (SearchedDevicePath[0]);
DBG(" Searching for: %ls (Len: %llu)\n", FileDevicePathToStr(SearchedDevicePath[0]), SearchedDevicePathSize[0]);
DBG(" Searching for: %ls (Len: %llu)\n", FileDevicePathToXStringW(SearchedDevicePath[0]).wc_str(), SearchedDevicePathSize[0]);
Status = CreateBootOptionDevicePath (FileDeviceHandle, FileName, TRUE, &SearchedDevicePath[1]);
if (EFI_ERROR(Status)) {
return EFI_OUT_OF_RESOURCES;
}
SearchedDevicePathSize[1] = GetDevicePathSize (SearchedDevicePath[1]);
DBG(" and for: %ls (Len: %llu)\n", FileDevicePathToStr(SearchedDevicePath[1]), SearchedDevicePathSize[1]);
DBG(" and for: %ls (Len: %llu)\n", FileDevicePathToXStringW(SearchedDevicePath[1]).wc_str(), SearchedDevicePathSize[1]);
//
// Iterate over all BootXXXX vars (actually, only ones that are in BootOrder list)
@ -937,7 +933,7 @@ AddBootOption (
DBG("AddBootOption: %ls\n", BootOption->Description);
DBG(" FilePath: %ls\n", FileDevicePathToStr(BootOption->FilePathList));
DBG(" FilePath: %ls\n", FileDevicePathToXStringW(BootOption->FilePathList).wc_str());
DBG(" BootIndex: %llu\n", BootIndex);
//

View File

@ -430,8 +430,6 @@ SetupDataForOSX(BOOLEAN Hibernate)
UINT64 CpuSpeed;
UINT64 TscFrequency;
UINT64 ARTFrequency;
CHAR16* ProductName;
CHAR16* SerialNumber;
UINTN Revision;
UINT16 Zero = 0;
BOOLEAN isRevLess = (gSettings.REV[0] == 0 &&
@ -474,11 +472,11 @@ SetupDataForOSX(BOOLEAN Hibernate)
// Locate DataHub Protocol
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (VOID**)&gDataHub);
if (!EFI_ERROR(Status)) {
ProductName = (__typeof__(ProductName))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.ProductName, ProductName, 64);
XStringW ProductName;
ProductName.takeValueFrom(gSettings.ProductName);
SerialNumber = (__typeof__(SerialNumber))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.SerialNr, SerialNumber, 64);
XStringW SerialNumber;
SerialNumber.takeValueFrom(gSettings.SerialNr);
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));
@ -498,8 +496,8 @@ SetupDataForOSX(BOOLEAN Hibernate)
DevPathSupportedVal = 1;
LogDataHub(&gEfiMiscSubClassGuid, L"DevicePathsSupported", &DevPathSupportedVal, sizeof(UINT32));
LogDataHub(&gEfiMiscSubClassGuid, L"Model", ProductName, (UINT32)StrSize(ProductName));
LogDataHub(&gEfiMiscSubClassGuid, L"SystemSerialNumber", SerialNumber, (UINT32)StrSize(SerialNumber));
LogDataHub(&gEfiMiscSubClassGuid, L"Model", (VOID*)ProductName.wc_str(), (UINT32)ProductName.sizeInNativeChars());
LogDataHub(&gEfiMiscSubClassGuid, L"SystemSerialNumber", (VOID*)SerialNumber.wc_str(), (UINT32)SerialNumber.sizeInNativeChars());
if (gSettings.InjectSystemID) {
LogDataHub(&gEfiMiscSubClassGuid, L"system-id", &gUuid, sizeof(EFI_GUID));

View File

@ -42,7 +42,7 @@
// VA_LIST Args;
// UINTN StringSize;
//
// AppendStr = (__typeof__(AppendStr))AllocateZeroPool(0x1000);
// AppendStr = (__typeof__(AppendStr))BllocateZeroPool(0x1000);
// if (AppendStr == NULL) {
// return Str->Str;
// }
@ -52,7 +52,7 @@
// VA_END (Args);
// if (NULL == Str->Str) {
// StringSize = StrSize (AppendStr);
// Str->Str = (__typeof__(Str->Str))AllocateZeroPool(StringSize);
// Str->Str = (__typeof__(Str->Str))BllocateZeroPool(StringSize);
//// ASSERT (Str->Str != NULL);
// } else {
// StringSize = StrSize (AppendStr);

View File

@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//#include "device_tree.h"
#include "kernel_patcher.h"
#include "usbfix.h"
#include "../Platform/cpu.h"
#ifndef DEBUG_ALL
#define PATCH_DEBUG 0
@ -415,6 +416,99 @@ GuiEventsInitialize ()
return Status;
}
//EFI_STATUS
//WaitForSingleEvent (
// IN EFI_EVENT Event,
// IN UINT64 Timeout OPTIONAL
// )
//{
// EFI_STATUS Status;
// UINTN Index;
//
// EFI_EVENT WaitList[3];
// EFI_EVENT TimerEvent;
//
// if (Timeout != 0)
// {
// //
// // Create a timer event
// //
// Status = gBS->CreateEvent(EVT_TIMER, 0, NULL, NULL, &TimerEvent);
// if (!EFI_ERROR(Status))
// {
// //
// // Set the timer event
// //
// gBS->SetTimer(TimerEvent, TimerRelative, Timeout);
//
// //
// // Wait for the original event or the timer
// //
// WaitList[0] = Event;
// WaitList[1] = TimerEvent;
//
// Status = gBS->WaitForEvent(2, WaitList, &Index);
// gBS->CloseEvent (TimerEvent);
// if (!EFI_ERROR(Status) && Index == 1)
// {
// Status = EFI_TIMEOUT;
// }
// }
// }
// else
// {
// WaitList[0] = Event;
// Status = gBS->WaitForEvent (1, WaitList, &Index);
// }
// return Status;
//}
//
//set Timeout in ms
EFI_STATUS
WaitFor2EventWithTsc (
IN EFI_EVENT Event1,
IN EFI_EVENT Event2,
IN UINT64 Timeout OPTIONAL
)
{
EFI_STATUS Status;
UINTN Index;
EFI_EVENT WaitList[2];
UINT64 t0, t1;
//all arguments are UINT64, we can use native divide and multiply
UINT64 Delta = DivU64x64Remainder(MultU64x64(Timeout, gCPUStructure.TSCFrequency), 1000, NULL);
if (Timeout != 0)
{
t0 = AsmReadTsc();
do {
Status = gBS->CheckEvent(Event1);
if (!EFI_ERROR(Status)) {
break;
}
if (Event2) {
Status = gBS->CheckEvent(Event2);
if (!EFI_ERROR(Status)) {
break;
}
}
// Let's try to relax processor a bit
CpuPause();
Status = EFI_TIMEOUT;
t1 = AsmReadTsc();
} while ((t1 - t0) < Delta);
}
else
{
WaitList[0] = Event1;
WaitList[1] = Event2;
Status = gBS->WaitForEvent (2, WaitList, &Index);
}
return Status;
}
EFI_STATUS
EventsInitialize (IN LOADER_ENTRY *Entry)
{

View File

@ -24,10 +24,18 @@ EFI_STATUS
GuiEventsInitialize (VOID);
// timeout will be in ms here, as small as 1ms and up
EFI_STATUS
WaitFor2EventWithTsc (
IN EFI_EVENT Event1,
IN EFI_EVENT Event2,
IN UINT64 Timeout OPTIONAL
);
EFI_STATUS
EjectVolume (
IN REFIT_VOLUME *Volume
);
#endif /* PLATFORM_EVENTS_H_ */

View File

@ -904,7 +904,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (acpi_cpu_score) {
FreePool(acpi_cpu_score);
}
acpi_cpu_score = (__typeof__(acpi_cpu_score))AllocateZeroPool(128);
acpi_cpu_score = (__typeof__(acpi_cpu_score))BllocateZeroPool(128);
acpi_cpu_count = 0;
// 5B 83 41 0C 5C 2E 5F 50 52 5F 43 50 55 30 01 10
// 10 00 00 06
@ -1054,7 +1054,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
}
if (add_name) {
acpi_cpu_name[acpi_cpu_count] = (__typeof_am__(acpi_cpu_name[acpi_cpu_count]))AllocateZeroPool(5);
acpi_cpu_name[acpi_cpu_count] = (__typeof_am__(acpi_cpu_name[acpi_cpu_count]))BllocateZeroPool(5);
CopyMem(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);
acpi_cpu_processor_id[acpi_cpu_count] = dsdt[offset + 4];
i = offset + 5;
@ -1076,7 +1076,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (!acpi_cpu_count) {
for (i=0; i < acpi_cpu_max; i++) {
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))AllocateZeroPool(5);
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))BllocateZeroPool(5);
snprintf(acpi_cpu_name[i], 5, "CPU%X", i);
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
}
@ -2399,7 +2399,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
continue;
}
LPCBSIZE = get_size(dsdt, LPCBADR);
device_name[3] = (__typeof_am__(device_name[3]))AllocateZeroPool(5);
device_name[3] = (__typeof_am__(device_name[3]))BllocateZeroPool(5);
CopyMem(device_name[3], dsdt + j, 4);
MsgLog("found LPCB device NAME(_ADR,0x001F0000) at %X And Name is %s\n", j,
device_name[3]);
@ -2448,7 +2448,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
lpcb = (__typeof__(lpcb))AllocateZeroPool(root->Size);
lpcb = (__typeof__(lpcb))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, lpcb, 0);
aml_destroy_node(root);
@ -2698,7 +2698,7 @@ Skip_DSM:
//now insert video
DBG("now inserting Video device\n");
aml_calculate_size(root);
display = (__typeof__(display))AllocateZeroPool(root->Size);
display = (__typeof__(display))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, display, 0);
aml_destroy_node(root);
@ -2806,7 +2806,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
if (!devadr1) {
continue;
}
device_name[11] = (__typeof_am__(device_name[11]))AllocateZeroPool(5);
device_name[11] = (__typeof_am__(device_name[11]))BllocateZeroPool(5);
CopyMem(device_name[11], dsdt+k, 4);
DBG("found HDMI device [0x%08X:%X] at %X and Name is %s\n",
HDMIADR1, HDMIADR2, devadr1, device_name[11]);
@ -2894,7 +2894,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
hdmi = (__typeof__(hdmi))AllocateZeroPool(root->Size);
hdmi = (__typeof__(hdmi))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdmi, 0);
aml_destroy_node(root);
@ -2975,7 +2975,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
continue;
}
device_name[1] = (__typeof_am__(device_name[1]))AllocateZeroPool(5);
device_name[1] = (__typeof_am__(device_name[1]))BllocateZeroPool(5);
CopyMem(device_name[1], dsdt+k, 4);
DBG("found NetWork device [0x%08X:%X] at %X and Name is %s\n",
NetworkADR1[card], NetworkADR2[card], NetworkADR, device_name[1]);
@ -3087,7 +3087,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
}
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = (__typeof__(network))AllocateZeroPool(root->Size);
network = (__typeof__(network))BllocateZeroPool(root->Size);
if (!network) {
return len;
}
@ -3169,7 +3169,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
if (!ArptADR) {
continue;
}
device_name[9] = (__typeof_am__(device_name[9]))AllocateZeroPool(5);
device_name[9] = (__typeof_am__(device_name[9]))BllocateZeroPool(5);
CopyMem(device_name[9], dsdt+k, 4);
DBG("found Airport device [%08X:%X] at %X And Name is %s\n",
ArptADR1, ArptADR2, ArptADR, device_name[9]);
@ -3278,7 +3278,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = (__typeof__(network))AllocateZeroPool(root->Size);
network = (__typeof__(network))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, network, 0);
aml_destroy_node(root);
@ -3459,7 +3459,7 @@ UINT32 AddMCHC (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
*/
aml_calculate_size(root);
mchc = (__typeof__(mchc))AllocateZeroPool(root->Size);
mchc = (__typeof__(mchc))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, mchc, 0);
aml_destroy_node(root);
@ -3546,7 +3546,7 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
}
aml_calculate_size(root);
imei = (__typeof__(imei))AllocateZeroPool(root->Size);
imei = (__typeof__(imei))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, imei, 0);
aml_destroy_node(root);
@ -3604,7 +3604,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[2] = (__typeof_am__(device_name[2]))AllocateZeroPool(5);
device_name[2] = (__typeof_am__(device_name[2]))BllocateZeroPool(5);
CopyMem(device_name[2], dsdt+k, 4);
DBG("found Firewire device NAME(_ADR,0x%08X) at %X And Name is %s\n",
FirewireADR2, k, device_name[2]);
@ -3689,7 +3689,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
firewire = (__typeof__(firewire))AllocateZeroPool(root->Size);
firewire = (__typeof__(firewire))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, firewire, 0);
aml_destroy_node(root);
@ -3742,7 +3742,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
}
// BridgeSize = get_size(dsdt, HDAADR);
device_name[4] = (__typeof_am__(device_name[4]))AllocateZeroPool(5);
device_name[4] = (__typeof_am__(device_name[4]))BllocateZeroPool(5);
CopyMem(device_name[4], dsdt+i, 4);
DBG("found HDA device NAME(_ADR,0x%08X) And Name is %s\n",
HDAADR1, device_name[4]);
@ -3805,7 +3805,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
*/
}
aml_calculate_size(root);
hdef = (__typeof__(hdef))AllocateZeroPool(root->Size);
hdef = (__typeof__(hdef))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdef, 0);
aml_destroy_node(root);
@ -3878,7 +3878,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
USBDATA1 = (__typeof__(USBDATA1))AllocateZeroPool(root->Size);
USBDATA1 = (__typeof__(USBDATA1))BllocateZeroPool(root->Size);
size1 = root->Size;
// DBG("USB1 code size = 0x%08X\n", size1);
aml_write_node(root, USBDATA1, 0);
@ -3951,7 +3951,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA2 = (__typeof__(USBDATA2))AllocateZeroPool(root1->Size);
USBDATA2 = (__typeof__(USBDATA2))BllocateZeroPool(root1->Size);
size2 = root1->Size;
// DBG("USB2 code size = 0x%08X\n", size2);
aml_write_node(root1, USBDATA2, 0);
@ -3959,7 +3959,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
//NFORCE_USB_START -- already done Intel or NForce same USBDATA2
/* aml_calculate_size(root1);
USBDATA4 = (__typeof__(USBDATA4))AllocateZeroPool(root1->Size);
USBDATA4 = (__typeof__(USBDATA4))BllocateZeroPool(root1->Size);
size4 = root1->Size;
DBG("USB OHCI code size = 0x%08X\n", size4);
aml_write_node(root1, USBDATA4, 0);
@ -4000,7 +4000,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA3 = (__typeof__(USBDATA3))AllocateZeroPool(root1->Size);
USBDATA3 = (__typeof__(USBDATA3))BllocateZeroPool(root1->Size);
size3 = root1->Size;
// DBG("USB3 code size = 0x%08X\n", size3);
aml_write_node(root1, USBDATA3, 0);
@ -4015,7 +4015,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
for (j = 0x20; len >= 4 && j < len - 4; j++) {
if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR
XhciName = FALSE;
UsbName[i] = (__typeof_am__(UsbName[i]))AllocateZeroPool(5);
UsbName[i] = (__typeof_am__(UsbName[i]))BllocateZeroPool(5);
// DBG("found USB at 0x%X\n", j);
adr1 = devFind(dsdt, j + 2);
if (!adr1) {
@ -4032,7 +4032,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[10] = (__typeof_am__(device_name[10]))AllocateZeroPool(5);
device_name[10] = (__typeof_am__(device_name[10]))BllocateZeroPool(5);
CopyMem(device_name[10], dsdt+k, 4);
DBG("found USB device [%08X:%X] at %X and Name was %s ->",
USBADR[i], USBADR2[i], k, device_name[10]);
@ -4147,7 +4147,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
}
//NFORCE_USB_START
else if (CmpAdr(dsdt, j, USBADR3[i])) {
UsbName[i] = (__typeof_am__(UsbName[i]))AllocateZeroPool(5);
UsbName[i] = (__typeof_am__(UsbName[i]))BllocateZeroPool(5);
CopyMem(UsbName[i], dsdt+j, 4);
adr1 = devFind(dsdt, j);
@ -4347,7 +4347,7 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
ide = (__typeof__(ide))AllocateZeroPool(root->Size);
ide = (__typeof__(ide))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, ide, 0);
aml_destroy_node(root);
@ -4452,7 +4452,7 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sata = (__typeof__(sata))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4543,7 +4543,7 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sata = (__typeof__(sata))BllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4886,7 +4886,7 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len)
for (i=0; i<len-5; i++) {
if (CmpAdr(dsdt, i, USBADR[j])) {
// get USB name
UsbName[j] = (__typeof__(UsbName[j]))AllocateZeroPool(5);
UsbName[j] = (__typeof__(UsbName[j]))BllocateZeroPool(5);
CopyMem(UsbName[j], dsdt+i, 4);
DBG("found USB device NAME(_ADR,0x%08hhX) And Name is %s\n",
USBADR[j], UsbName[j]);
@ -5107,7 +5107,7 @@ VOID GetBiosRegions(UINT8 *buffer)
}
}
if (tmp.Address) {
OPER_REGION *newRegion = (__typeof__(newRegion))AllocateZeroPool(sizeof(OPER_REGION));
OPER_REGION *newRegion = (__typeof__(newRegion))BllocateZeroPool(sizeof(OPER_REGION));
MsgLog("Found OperationRegion(%s, SystemMemory, %X, ...)\n", tmp.Name, tmp.Address);
*newRegion = tmp;
newRegion->next = gRegions;

View File

@ -58,7 +58,7 @@ CONST CHAR8 hdcID[4] = HDC_ID;
extern UINTN AudioNum;
extern HDA_OUTPUTS AudioList[20];
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
extern CHAR16 *OEMPath;
extern XStringW OEMPath;
VOID
EFIAPI
@ -274,7 +274,7 @@ EFI_STATUS SaveHdaDumpTxt()
// EFI_HDA_CODEC_INFO_PROTOCOL *HdaCodecInfo;
HDA_FUNC_GROUP *AudioFuncGroup;
EFI_HDA_IO_PROTOCOL *HdaIo;
CHAR16 *MiscPath = PoolPrint(L"%s\\misc", OEMPath);
XStringW MiscPath = SWPrintf("%ls\\misc", OEMPath.wc_str());
CHAR8 *MemLogStart;
UINTN MemLogStartLen;
@ -333,21 +333,14 @@ EFI_STATUS SaveHdaDumpTxt()
UINTN WidgetCount = AudioFuncGroup->WidgetsCount;
HdaCodecDumpPrintWidgets(HdaIo, Widgets, WidgetCount);
CHAR16 *PathHdaDump = PoolPrint(L"%s\\HdaCodec#%d (%s).txt", MiscPath, i, HdaCodecDev->Name);
XStringW PathHdaDump = SWPrintf("%ls\\HdaCodec#%llu (%ls).txt", MiscPath.wc_str(), i, HdaCodecDev->Name);
if (PathHdaDump != NULL) {
Status = egSaveFile(SelfRootDir, PathHdaDump, (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
if (EFI_ERROR(Status))
Status = egSaveFile(NULL, PathHdaDump, (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
FreePool(PathHdaDump);
Status = egSaveFile(SelfRootDir, PathHdaDump.wc_str(), (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PathHdaDump.wc_str(), (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
}
}
FreePool(MiscPath);
return Status;
return Status;
}
EFI_STATUS SaveHdaDumpBin()
@ -358,11 +351,8 @@ EFI_STATUS SaveHdaDumpBin()
// EFI_HDA_CODEC_INFO_PROTOCOL *HdaCodecInfo;
HDA_FUNC_GROUP *AudioFuncGroup;
EFI_HDA_IO_PROTOCOL *HdaIo;
CHAR16 *MiscPath = PoolPrint(L"%s\\misc", OEMPath);
XStringW MiscPath = SWPrintf("%ls\\misc", OEMPath.wc_str());
if (MiscPath == NULL)
return EFI_OUT_OF_RESOURCES;
for (UINTN i = 0; i < AudioNum; i++) {
HDA_WIDGET_DEV *Widgets;
UINTN WidgetCount;
@ -371,7 +361,7 @@ EFI_STATUS SaveHdaDumpBin()
UINT8 CodecAddress;
UINT8 *HdaCodecData;
UINT8 *HdaCodecDataPtr;
CHAR16 *PathHdaDump;
XStringW PathHdaDump;
Status = gBS->HandleProtocol(AudioList[i].Handle, &gEfiAudioIoProtocolGuid, (VOID**)&AudioIo);
@ -422,7 +412,7 @@ EFI_STATUS SaveHdaDumpBin()
HdaCodec.WidgetCount = AudioFuncGroup->WidgetsCount;
// Allocate space for codec data
HdaCodecData = (__typeof__(HdaCodecData))AllocateZeroPool(HdaCodecDataSize);
HdaCodecData = (__typeof__(HdaCodecData))BllocateZeroPool(HdaCodecDataSize);
HdaCodecDataPtr = HdaCodecData;
if (!HdaCodecData)
@ -482,21 +472,14 @@ EFI_STATUS SaveHdaDumpBin()
HdaCodecDataPtr += sizeof(HdaWidget);
}
PathHdaDump = PoolPrint(L"%s\\HdaCodec#%d (%s).bin", MiscPath, i, HdaCodecDev->Name);
PathHdaDump = SWPrintf("%ls\\HdaCodec#%llu (%ls).bin", MiscPath.wc_str(), i, HdaCodecDev->Name);
if (PathHdaDump != NULL) {
Status = egSaveFile(SelfRootDir, PathHdaDump, HdaCodecData, HdaCodecDataSize);
if (EFI_ERROR(Status))
Status = egSaveFile(NULL, PathHdaDump, HdaCodecData, HdaCodecDataSize);
FreePool(PathHdaDump);
Status = egSaveFile(SelfRootDir, PathHdaDump.wc_str(), HdaCodecData, HdaCodecDataSize);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PathHdaDump.wc_str(), HdaCodecData, HdaCodecDataSize);
}
FreePool(HdaCodecData);
}
FreePool(MiscPath);
return EFI_SUCCESS;
}

View File

@ -375,32 +375,31 @@ EFIAPI OurBlockIoRead (
/** Get sleep image location (volume and name) */
VOID
GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume, CHAR16 **SleepImageName)
GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume, XStringW* SleepImageNamePtr)
{
EFI_STATUS Status = EFI_NOT_FOUND;
UINT8 *PrefBuffer = NULL;
UINTN PrefBufferLen = 0;
TagPtr PrefDict, dict, dict2, prop;
CONST CHAR16 *PrefName = L"\\Library\\Preferences\\SystemConfiguration\\com.apple.PowerManagement.plist";
CONST CHAR16 *PrefName2 = L"\\Library\\Preferences\\com.apple.PowerManagement.plist";
CHAR16 *PrefName3 = NULL;
CHAR16 *ImageName = NULL;
CONST CHAR16 *PrefName = L"\\Library\\Preferences\\SystemConfiguration\\com.apple.PowerManagement.plist";
CONST CHAR16 *PrefName2 = L"\\Library\\Preferences\\com.apple.PowerManagement.plist";
REFIT_VOLUME *ImageVolume = Volume;
XStringW& SleepImageName = *SleepImageNamePtr;
if (Volume->RootDir) {
// find sleep image entry from plist
Status = egLoadFile(Volume->RootDir, PrefName, &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
PrefName3 = PoolPrint(L"\\Library\\Preferences\\com.apple.PowerManagement.%s.plist", GuidBeToStr(&gUuid));
Status = egLoadFile(Volume->RootDir, PrefName3, &PrefBuffer, &PrefBufferLen);
XStringW PrefName3 = SWPrintf("\\Library\\Preferences\\com.apple.PowerManagement.%ls.plist", GuidBeToStr(&gUuid).wc_str());
Status = egLoadFile(Volume->RootDir, PrefName3.wc_str(), &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
Status = egLoadFile(Volume->RootDir, PrefName2, &PrefBuffer, &PrefBufferLen);
if (!EFI_ERROR(Status)) {
DBG(" read prefs %ls status=%s\n", PrefName2, strerror(Status));
}
} else {
DBG(" read prefs %ls status=%s\n", PrefName3, strerror(Status));
DBG(" read prefs %ls status=%s\n", PrefName3.wc_str(), strerror(Status));
}
} else {
DBG(" read prefs %ls status=%s\n", PrefName, strerror(Status));
@ -416,10 +415,9 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
if (dict2) {
prop = GetProperty(dict2, "Hibernate File");
if (prop && prop->type == kTagTypeString ) {
CHAR16 *p;
if (AsciiStrStr(prop->string, "/Volumes/")) {
CHAR8 *VolNameStart = NULL, *VolNameEnd = NULL;
CHAR16 *VolName = NULL;
XStringW VolName;
UINTN VolNameSize = 0;
// Extract Volumes Name
VolNameStart = AsciiStrStr(prop->string + 1, "/") + 1;
@ -428,51 +426,45 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
if (VolNameEnd) {
VolNameSize = (VolNameEnd - VolNameStart + 1) * sizeof(CHAR16);
if (VolNameSize > 0) {
VolName = (__typeof__(VolName))AllocateZeroPool(VolNameSize);
VolName.strncpy(VolNameStart, VolNameSize);
}
}
}
if (VolName) {
snwprintf(VolName, VolNameSize, "%s", VolNameStart);
ImageVolume = FindVolumeByName(VolName);
if (VolName.notEmpty()) {
ImageVolume = FindVolumeByName(VolName.wc_str());
if (ImageVolume) {
ImageName = PoolPrint(L"%a", VolNameEnd);
SleepImageName = SWPrintf("%s", VolNameEnd);
} else {
ImageVolume = Volume;
}
FreePool(VolName);
}
} else if (AsciiStrStr(prop->string, "/var") && !AsciiStrStr(prop->string, "private")) {
ImageName = PoolPrint(L"\\private%a", prop->string);
SleepImageName = SWPrintf("\\private%s", prop->string);
} else {
ImageName = PoolPrint(L"%a", prop->string);
SleepImageName = SWPrintf("%s", prop->string);
}
p = ImageName;
wchar_t* p = SleepImageName.data(0);
while (*p) {
if (*p == L'/') {
*p = L'\\';
}
p++;
}
DBG(" SleepImage name from pref: ImageVolume = '%ls', ImageName = '%ls'\n", ImageVolume->VolName, ImageName);
DBG(" SleepImage name from pref: ImageVolume = '%ls', ImageName = '%ls'\n", ImageVolume->VolName.wc_str(), SleepImageName.wc_str());
}
}
}
}
}
if (!ImageName) {
ImageName = PoolPrint(L"\\private\\var\\vm\\sleepimage");
DBG(" using default sleep image name = %ls\n", ImageName);
if (SleepImageName.isEmpty()) {
SleepImageName = SWPrintf("\\private\\var\\vm\\sleepimage");
DBG(" using default sleep image name = %ls\n", SleepImageName.wc_str());
}
if (PrefBuffer) {
FreePool(PrefBuffer); //allocated by egLoadFile
}
if (PrefName3) {
FreePool(PrefName3); //allocated by PoolPrint
}
*SleepImageVolume = ImageVolume;
*SleepImageName = ImageName;
}
@ -491,7 +483,7 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume)
EFI_FILE *File = NULL;
VOID *Buffer;
UINTN BufferSize;
CHAR16 *ImageName;
XStringW ImageName;
REFIT_VOLUME *ImageVolume;
if (!Volume) {
@ -519,7 +511,7 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume)
if (ImageVolume->RootDir) {
// Open sleepimage
Status = ImageVolume->RootDir->Open(ImageVolume->RootDir, &File, ImageName, EFI_FILE_MODE_READ, 0);
Status = ImageVolume->RootDir->Open(ImageVolume->RootDir, &File, ImageName.wc_str(), EFI_FILE_MODE_READ, 0);
if (EFI_ERROR(Status)) {
DBG(" sleepimage not found -> %s\n", strerror(Status));
return 0;
@ -799,18 +791,16 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
/* Status = GetRootUUID(Volume);
if (!EFI_ERROR(Status)) {
EFI_GUID TmpGuid;
CHAR16 *TmpStr = NULL;
CHAR16 *Ptr = GuidLEToStr(&Volume->RootUUID);
DBG("got str=%ls\n", Ptr);
Status = StrToGuidLE (Ptr, &TmpGuid);
if (EFI_ERROR(Status)) {
DBG(" cant convert Str %ls to GUID\n", Ptr);
} else {
TmpStr = PoolPrint(L"%s", strguid(&TmpGuid)); //PoolPrint не работает!!!
DBG("got the guid %ls\n", TmpStr);
XStringW TmpStr = SWPrintf("%ls", strguid(&TmpGuid));
DBG("got the guid %ls\n", TmpStr.wc_str());
CopyMem((VOID*)Ptr, TmpStr, StrSize(TmpStr));
DBG("fter CopyMem: %ls\n", Ptr);
FreePool(TmpStr);
}
}
*/
@ -906,8 +896,8 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
// UINTN Size;
CHAR16 *Ptr = (CHAR16*)&OffsetHexStr[0];
DBG(" boot-image before: %ls\n", FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL*)Value));
snwprintf(OffsetHexStr, sizeof(OffsetHexStr), "%ls", (CHAR16 *)(Value + 0x20));
DBG(" boot-image before: %ls\n", FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL*)Value).wc_str());
snwprintf(OffsetHexStr, sizeof(OffsetHexStr), "%ls", (CHAR16 *)(Value + 0x20));
// DBG("OffsetHexStr=%ls\n", OffsetHexStr);
while ((*Ptr != L':') && (*Ptr != 0)) {
Ptr++;
@ -921,14 +911,13 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
ResumeFromCoreStorage = TRUE;
// DBG("got str=%ls\n", Ptr);
Status = StrToGuidLE (Ptr, &TmpGuid);
Status = StrToGuidLE(Ptr, &TmpGuid);
if (EFI_ERROR(Status)) {
DBG(" cant convert Str %ls to GUID\n", Ptr);
} else {
//TmpStr = PoolPrint(L"%s", strguid(&TmpGuid));
XStringW TmpStr = GuidLEToXStringW(&TmpGuid);
// DBG("got the guid %ls\n", TmpStr);
CopyMem((VOID*)Ptr, TmpStr.wc_str(), TmpStr.sizeInNativeChars());
XStringW TmpStr = GuidLEToXStringW(&TmpGuid);
//DBG("got the guid %ls\n", TmpStr);
memcpy((VOID*)Ptr, TmpStr.wc_str(), TmpStr.sizeInBytes());
}
}
if (StrCmp(gST->FirmwareVendor, L"INSYDE Corp.") != 0) {
@ -939,13 +928,13 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
// DBG(" boot-image device path:\n");
Size = GetDevicePathSize(BootImageDevPath);
Value = (UINT8*)BootImageDevPath;
DBG(" boot-image after: %ls\n", FileDevicePathToStr(BootImageDevPath));
DBG(" boot-image after: %ls\n", FileDevicePathToXStringW(BootImageDevPath).wc_str());
//Apple's device path differs from UEFI BIOS device path that will be used by boot.efi
//Value[6] = 8; //Acpi(PNP0A08,0)
Value[22] = SataNum;
Value[24] = 0xFF;
Value[25] = 0xFF;
DBG(" boot-image corrected: %ls\n", FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL*)Value));
DBG(" boot-image corrected: %ls\n", FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL*)Value).wc_str());
PrintBytes(Value, Size);
Status = gRT->SetVariable(L"boot-image", &gEfiAppleBootGuid,
@ -1019,7 +1008,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
Size = GetDevicePathSize(BootImageDevPath);
VarData = (UINT8*)BootImageDevPath;
PrintBytes(VarData, Size);
DBG("boot-image before: %ls\n", FileDevicePathToStr(BootImageDevPath));
DBG("boot-image before: %ls\n", FileDevicePathToXStringW(BootImageDevPath).wc_str());
// VarData[6] = 8;
// VarData[24] = 0xFF;

View File

@ -488,7 +488,7 @@ EFI_STATUS bootMBR(REFIT_VOLUME* volume)
return Status;
}
DBG("boot from partition %ls\n", FileDevicePathToStr(volume->DevicePath));
DBG("boot from partition %ls\n", FileDevicePathToXStringW(volume->DevicePath).wc_str());
Status = InitializeBiosIntCaller(); //mThunkContext);
if (EFI_ERROR(Status)) {
@ -631,7 +631,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
}
if (HdPath != NULL) {
DBG("boot from partition %ls\n", FileDevicePathToStr((EFI_DEVICE_PATH *)HdPath));
DBG("boot from partition %ls\n", FileDevicePathToXStringW((EFI_DEVICE_PATH *)HdPath).wc_str());
LbaOffset = (UINT32)HdPath->PartitionStart;
LbaSize = (UINT32)HdPath->PartitionSize;
DBG("starting from 0x%X LBA \n", LbaOffset);
@ -878,7 +878,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
}
if (HdPath != NULL) {
DBG("boot from partition %ls\n", FileDevicePathToStr((EFI_DEVICE_PATH *)HdPath));
DBG("boot from partition %ls\n", FileDevicePathToXStringW((EFI_DEVICE_PATH *)HdPath).wc_str());
LbaOffset = (UINT32)HdPath->PartitionStart;
LbaSize = (UINT32)HdPath->PartitionSize;
DBG("starting from 0x%X LBA \n", LbaOffset);
@ -921,7 +921,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
// todo: if we managed to get BbsTable, then we may find
// BIOS drive from there, by matching PCI bus, device, function
//
DBG("Looking for parent disk of %ls\n", FileDevicePathToStr(volume->DevicePath));
DBG("Looking for parent disk of %ls\n", FileDevicePathToXStringW(volume->DevicePath).wc_str());
BiosDriveNum = 0;
for (i = 0; i < Volumes.size(); i++) {
if (&Volumes[i] != volume && Volumes[i].BlockIO == volume->WholeDiskBlockIO)

View File

@ -9,6 +9,7 @@
#include "Nvram.h"
#include "BootOptions.h"
#include "guid.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_SET 1
@ -116,7 +117,7 @@ VOID *GetNvramVariable(
//
// Allocate the buffer to return
//
Data = (__typeof__(Data))AllocateZeroPool(IntDataSize + 1);
Data = (__typeof__(Data))BllocateZeroPool(IntDataSize + 1);
if (Data != NULL) {
//
// Read variable into the allocated buffer.
@ -289,7 +290,7 @@ ResetNativeNvram ()
//DbgHeader("ResetNativeNvram: cleanup NVRAM variables");
NameSize = sizeof (CHAR16);
Name = (__typeof__(Name))AllocateZeroPool(NameSize);
Name = (__typeof__(Name))BllocateZeroPool(NameSize);
if (Name == NULL) {
return Status;
}
@ -353,7 +354,7 @@ ResetNativeNvram ()
// find the partition where nvram.plist can be deleted and delete it
if (Volume != NULL) {
if (StriStr(Volume->VolName, L"EFI") != NULL) {
if (StriStr(Volume->VolName.wc_str(), L"EFI") != NULL) {
//DBG("- [%02d]: '%ls' - found nvram.plist and deleted it\n", VolumeIndex, Volume->VolName);
Status = DeleteFile (Volume->RootDir, L"nvram.plist");
} else {
@ -418,7 +419,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
NameSize = sizeof (CHAR16);
Name = (__typeof__(Name))AllocateZeroPool(NameSize);
Name = (__typeof__(Name))BllocateZeroPool(NameSize);
if (Name == NULL) {
return;
}
@ -753,7 +754,7 @@ GetEfiBootDeviceFromNvram ()
}
// DBG("\n");
DBG(" - efi-boot-device-data: %ls\n", FileDevicePathToStr (gEfiBootDeviceData));
DBG(" - efi-boot-device-data: %ls\n", FileDevicePathToXStringW(gEfiBootDeviceData).wc_str());
gEfiBootVolume = gEfiBootDeviceData;
@ -777,7 +778,7 @@ GetEfiBootDeviceFromNvram ()
return EFI_NOT_FOUND;
}
DBG(" - BootCampHD: %ls\n", FileDevicePathToStr (gBootCampHD));
DBG(" - BootCampHD: %ls\n", FileDevicePathToXStringW(gBootCampHD).wc_str());
}
//
@ -794,7 +795,7 @@ GetEfiBootDeviceFromNvram ()
// gEfiBootVolume now contains only Volume path
}
DBG(" - Volume: '%ls'\n", FileDevicePathToStr (gEfiBootVolume));
DBG(" - Volume: '%ls'\n", FileDevicePathToXStringW(gEfiBootVolume).wc_str());
DBG(" - LoaderPath: '%ls'\n", gEfiBootLoaderPath);
//
@ -955,7 +956,7 @@ LoadLatestNvramPlist()
// if we have nvram.plist - load it
//
if (VolumeWithLatestNvramPlist != NULL) {
DBG("Loading nvram.plist from Vol '%ls' -", VolumeWithLatestNvramPlist->VolName);
DBG("Loading nvram.plist from Vol '%ls' -", VolumeWithLatestNvramPlist->VolName.wc_str());
Status = LoadNvramPlist(VolumeWithLatestNvramPlist->RootDir, L"nvram.plist");
}
// else {
@ -1099,11 +1100,11 @@ FindStartupDiskVolume (
INTN Index;
// LEGACY_ENTRY *LegacyEntry;
// LOADER_ENTRY *LoaderEntry;
REFIT_VOLUME *Volume;
// REFIT_VOLUME *Volume;
REFIT_VOLUME *DiskVolume;
BOOLEAN IsPartitionVolume;
XStringW LoaderPath;
CHAR16 *EfiBootVolumeStr;
XStringW EfiBootVolumeStr;
// DBG("FindStartupDiskVolume ...\n");
@ -1125,9 +1126,9 @@ FindStartupDiskVolume (
//
// Check if gEfiBootVolume is disk or partition volume
//
EfiBootVolumeStr = FileDevicePathToStr (gEfiBootVolume);
EfiBootVolumeStr = FileDevicePathToXStringW(gEfiBootVolume);
IsPartitionVolume = NULL != FindDevicePathNodeWithType (gEfiBootVolume, MEDIA_DEVICE_PATH, 0);
DBG(" - Volume: %ls = %ls\n", IsPartitionVolume ? L"partition" : L"disk", EfiBootVolumeStr);
DBG(" - Volume: %ls = %ls\n", IsPartitionVolume ? L"partition" : L"disk", EfiBootVolumeStr.wc_str());
//
// 1. gEfiBootVolume + gEfiBootLoaderPath
@ -1138,15 +1139,15 @@ FindStartupDiskVolume (
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
LOADER_ENTRY& LoaderEntry = *MainMenu->Entries[Index].getLOADER_ENTRY();
Volume = LoaderEntry.Volume;
REFIT_VOLUME* Volume = LoaderEntry.Volume;
LoaderPath = LoaderEntry.LoaderPath;
if (Volume != NULL && BootVolumeDevicePathEqual(gEfiBootVolume, Volume->DevicePath)) {
DBG(" checking '%ls'\n", DevicePathToStr(Volume->DevicePath));
DBG(" checking '%ls'\n", DevicePathToXStringW(Volume->DevicePath).wc_str());
DBG(" '%ls'\n", LoaderPath.wc_str());
// case insensitive cmp
if ( LoaderPath.equalIC(gEfiBootLoaderPath) ) {
// that's the one
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderPath.wc_str());
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
return Index;
}
}
@ -1161,6 +1162,7 @@ FindStartupDiskVolume (
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
LOADER_ENTRY& LoaderEntry = *MainMenu->Entries[Index].getLOADER_ENTRY();
REFIT_VOLUME* Volume = LoaderEntry.Volume;
EFI_DEVICE_PATH *DevicePath = LoaderEntry.DevicePath;
EFI_DEVICE_PATH *MediaPath = FindDevicePathNodeWithType(DevicePath, MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP);
if (MediaPath) {
@ -1168,7 +1170,7 @@ FindStartupDiskVolume (
XStringW MediaPathGuidStr = GuidLEToXStringW(MediaPathGuid);
// DBG(" checking '%ls'\n", MediaPathGuidStr.wc_str());
if (StrStr(gEfiBootLoaderPath, MediaPathGuidStr.wc_str())) {
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderPath.wc_str());
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
return Index;
}
}
@ -1185,14 +1187,14 @@ FindStartupDiskVolume (
if (IsPartitionVolume) {
DBG(" - searching for that partition\n");
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
Volume = NULL;
REFIT_VOLUME* Volume = NULL;
if (MainMenu->Entries[Index].getLEGACY_ENTRY()) {
Volume = MainMenu->Entries[Index].getLEGACY_ENTRY()->Volume;
} else if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
Volume = MainMenu->Entries[Index].getLOADER_ENTRY()->Volume;
}
if (Volume != NULL && BootVolumeDevicePathEqual (gEfiBootVolume, Volume->DevicePath)) {
DBG(" - found entry %lld. '%ls', Volume '%ls'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName);
DBG(" - found entry %lld. '%ls', Volume '%ls'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName.wc_str());
return Index;
}
}
@ -1202,14 +1204,14 @@ FindStartupDiskVolume (
//
DBG(" - searching again, but comparing Media dev path nodes\n");
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
Volume = NULL;
REFIT_VOLUME* Volume = NULL;
if (MainMenu->Entries[Index].getLEGACY_ENTRY()) {
Volume = MainMenu->Entries[Index].getLEGACY_ENTRY()->Volume;
} else if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
Volume = MainMenu->Entries[Index].getLOADER_ENTRY()->Volume;
}
if (Volume != NULL && BootVolumeMediaDevicePathNodesEqual (gEfiBootVolume, Volume->DevicePath)) {
DBG(" - found entry %lld. '%ls', Volume '%ls'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName);
DBG(" - found entry %lld. '%ls', Volume '%ls'\n", Index, MainMenu->Entries[Index].Title.s(), Volume->VolName.wc_str());
return Index;
}
}
@ -1226,11 +1228,11 @@ FindStartupDiskVolume (
DiskVolume = NULL;
DBG(" - searching for that disk\n");
for (Index = 0; Index < (INTN)Volumes.size(); ++Index) {
Volume = &Volumes[Index];
REFIT_VOLUME* Volume = &Volumes[Index];
if (BootVolumeDevicePathEqual (gEfiBootVolume, Volume->DevicePath)) {
// that's the one
DiskVolume = Volume;
DBG(" - found disk as volume %lld. '%ls'\n", Index, Volume->VolName);
DBG(" - found disk as volume %lld. '%ls'\n", Index, Volume->VolName.wc_str());
break;
}
}
@ -1247,7 +1249,7 @@ FindStartupDiskVolume (
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
if (MainMenu->Entries[Index].getLEGACY_ENTRY()) {
LEGACY_ENTRY& LegacyEntry = (LEGACY_ENTRY&)MainMenu->Entries[Index];
Volume = LegacyEntry.Volume;
REFIT_VOLUME* Volume = LegacyEntry.Volume;
if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) {
// check for Win
//DBG(" checking legacy entry %d. %ls\n", Index, LegacyEntry.Title);
@ -1255,13 +1257,13 @@ FindStartupDiskVolume (
//DBG(" OSType = %d\n", Volume->OSType);
if (Volume->LegacyOS->Type == OSTYPE_WIN) {
// that's the one - legacy win partition
DBG(" - found legacy entry %lld. '%ls', Volume '%ls'\n", Index, LegacyEntry.Title.s(), Volume->VolName);
DBG(" - found legacy entry %lld. '%ls', Volume '%ls'\n", Index, LegacyEntry.Title.s(), Volume->VolName.wc_str());
return Index;
}
}
} else if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
LOADER_ENTRY& LoaderEntry = *MainMenu->Entries[Index].getLOADER_ENTRY();
Volume = LoaderEntry.Volume;
REFIT_VOLUME* Volume = LoaderEntry.Volume;
if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) {
// check for Win
//DBG(" checking loader entry %d. %ls\n", Index, LoaderEntry.Title);
@ -1270,7 +1272,7 @@ FindStartupDiskVolume (
//DBG(" LoaderType = %d\n", LoaderEntry.LoaderType);
if (LoaderEntry.LoaderType == OSTYPE_WINEFI) {
// that's the one - win loader entry
DBG(" - found loader entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderEntry.LoaderPath.wc_str());
DBG(" - found loader entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderEntry.LoaderPath.wc_str());
return Index;
}
}
@ -1283,23 +1285,23 @@ FindStartupDiskVolume (
// PciRoot(0x0)/.../Sata(...)
// just find first menu entry on that disk?
//
DBG(" - searching for any entry from disk '%ls'\n", DiskVolume->VolName);
DBG(" - searching for any entry from disk '%ls'\n", DiskVolume->VolName.wc_str());
for (Index = 0; ((Index < (INTN)MainMenu->Entries.size()) && (MainMenu->Entries[Index].Row == 0)); ++Index) {
if (MainMenu->Entries[Index].getLEGACY_ENTRY()) {
LEGACY_ENTRY& LegacyEntry = (LEGACY_ENTRY&)MainMenu->Entries[Index];
Volume = LegacyEntry.Volume;
REFIT_VOLUME* Volume = LegacyEntry.Volume;
if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) {
// that's the one
DBG(" - found legacy entry %lld. '%ls', Volume '%ls'\n", Index, LegacyEntry.Title.s(), Volume->VolName);
DBG(" - found legacy entry %lld. '%ls', Volume '%ls'\n", Index, LegacyEntry.Title.s(), Volume->VolName.wc_str());
return Index;
}
} else if (MainMenu->Entries[Index].getLOADER_ENTRY()) {
LOADER_ENTRY& LoaderEntry = *MainMenu->Entries[Index].getLOADER_ENTRY();
Volume = LoaderEntry.Volume;
REFIT_VOLUME* Volume = LoaderEntry.Volume;
if (Volume != NULL && Volume->WholeDiskBlockIO == DiskVolume->BlockIO) {
// that's the one
DBG(" - found loader entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName, LoaderEntry.LoaderPath.wc_str());
DBG(" - found loader entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderEntry.LoaderPath.wc_str());
return Index;
}
@ -1328,7 +1330,7 @@ EFI_STATUS SetStartupDiskVolume (
DBG("SetStartupDiskVolume:\n");
DBG(" * Volume: '%ls'\n", Volume->VolName);
DBG(" * Volume: '%ls'\n", Volume->VolName.wc_str());
DBG(" * LoaderPath: '%ls'\n", LoaderPath.wc_str());
//
@ -1339,7 +1341,7 @@ EFI_STATUS SetStartupDiskVolume (
FileDevPath = FileDevicePath (NULL, LoaderPath);
DevPath = AppendDevicePathNode (DevPath, FileDevPath);
}
DBG(" * DevPath: %ls\n", Volume->VolName/*, FileDevicePathToStr (DevPath)*/);
DBG(" * DevPath: %ls\n", Volume->VolName.wc_str()/*, FileDevicePathToStr (DevPath)*/);
Guid = FindGPTPartitionGuidInDevicePath (Volume->DevicePath);
DBG(" * GUID = %s\n", strguid(Guid));
@ -1367,25 +1369,6 @@ EFI_STATUS SetStartupDiskVolume (
// (probably not needed at all)
//
if (Guid != NULL) {
// EfiBootDeviceTmpl =
// "<array><dict>"
// "<key>IOMatch</key>"
// "<dict>"
// "<key>IOProviderClass</key><string>IOMedia</string>"
// "<key>IOPropertyMatch</key>"
// "<dict><key>UUID</key><string>%s</string></dict>"
// "</dict>"
// "</dict></array>";
//
// Size = AsciiStrLen(EfiBootDeviceTmpl) + 36;
// EfiBootDevice = (__typeof__(EfiBootDevice))AllocateZeroPool(AsciiStrLen(EfiBootDeviceTmpl) + 36);
// AsciiSPrint (EfiBootDevice, Size, EfiBootDeviceTmpl, strguid(Guid));
// Size = AsciiStrLen(EfiBootDevice);
// DBG(" * efi-boot-device: %s\n", EfiBootDevice);
//
// Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, Size, EfiBootDevice);
// FreePool(EfiBootDevice);
XString8 EfiBootDevice;
EfiBootDevice.SPrintf(
"<array><dict>"

View File

@ -31,7 +31,7 @@ Headers collection for procedures
#include "Settings.h"
#ifndef CLOVERAPPLICATION
#include "../refit/IO.h"
#include "../Platform/Utils.h"
#endif
@ -42,4 +42,8 @@ Headers collection for procedures
#endif
// Jief : temporary rename
#define BllocateZeroPool AllocateZeroPool
#endif

File diff suppressed because it is too large Load Diff

View File

@ -78,15 +78,20 @@ struct ACPI_NAME_LIST {
CHAR8 *Name;
};
typedef struct ACPI_DROP_TABLE ACPI_DROP_TABLE;
struct ACPI_DROP_TABLE
class ACPI_DROP_TABLE
{
public:
ACPI_DROP_TABLE *Next;
UINT32 Signature;
UINT32 Length;
UINT64 TableId;
INPUT_ITEM MenuItem;
BOOLEAN OtherOS;
ACPI_DROP_TABLE() : Next(0), Signature(0), Length(0), TableId(0), OtherOS(0) {}
ACPI_DROP_TABLE(const ACPI_DROP_TABLE& other) = delete; // Can be defined if needed
const ACPI_DROP_TABLE& operator = ( const ACPI_DROP_TABLE & ) = delete; // Can be defined if needed
~ACPI_DROP_TABLE() {}
};
typedef struct CUSTOM_LOADER_ENTRY CUSTOM_LOADER_ENTRY;
@ -95,15 +100,15 @@ struct CUSTOM_LOADER_ENTRY {
CUSTOM_LOADER_ENTRY *SubEntries;
XIcon Image;
XIcon DriveImage;
CONST CHAR16 *ImagePath;
CONST CHAR16 *DriveImagePath;
CONST CHAR16 *Volume;
XStringW Path;
XStringArray LoadOptions;
XStringW ImagePath;
XStringW DriveImagePath;
XStringW Volume;
XStringW Path;
XStringArray LoadOptions;
XStringW FullTitle;
XStringW Title;
CONST CHAR16 *Settings;
XStringW Settings;
CHAR16 Hotkey;
BOOLEAN CommonSettings;
UINT8 Flags;
@ -125,35 +130,49 @@ struct CUSTOM_LOADER_ENTRY {
};
typedef struct CUSTOM_LEGACY_ENTRY CUSTOM_LEGACY_ENTRY;
struct CUSTOM_LEGACY_ENTRY {
CUSTOM_LEGACY_ENTRY *Next;
class CUSTOM_LEGACY_ENTRY
{
public:
CUSTOM_LEGACY_ENTRY* Next;
XIcon Image;
XIcon DriveImage;
CONST CHAR16 *ImagePath;
CONST CHAR16 *DriveImagePath;
CONST CHAR16 *Volume;
XStringW FullTitle;
XStringW Title;
CHAR16 Hotkey;
UINT8 Flags;
UINT8 Type;
UINT8 VolumeType;
XStringW ImagePath;
XStringW DriveImagePath;
XStringW Volume;
XStringW FullTitle;
XStringW Title;
CHAR16 Hotkey;
UINT8 Flags;
UINT8 Type;
UINT8 VolumeType;
CUSTOM_LEGACY_ENTRY() : Next(0), Hotkey(0), Flags(0), Type(0), VolumeType(0) { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created
CUSTOM_LEGACY_ENTRY(const CUSTOM_LEGACY_ENTRY&) = delete;
CUSTOM_LEGACY_ENTRY& operator=(const CUSTOM_LEGACY_ENTRY&) = delete;
};
typedef struct CUSTOM_TOOL_ENTRY CUSTOM_TOOL_ENTRY;
struct CUSTOM_TOOL_ENTRY {
class CUSTOM_TOOL_ENTRY
{
public:
CUSTOM_TOOL_ENTRY *Next;
XIcon Image;
CHAR16 *ImagePath;
CHAR16 *Volume;
XStringW Path;
XStringArray LoadOptions;
XStringW FullTitle;
XStringW Title;
CHAR16 Hotkey;
UINT8 Flags;
UINT8 VolumeType;
XIcon Image;
XStringW ImagePath;
XStringW Volume;
XStringW Path;
XStringArray LoadOptions;
XStringW FullTitle;
XStringW Title;
CHAR16 Hotkey;
UINT8 Flags;
UINT8 VolumeType;
CUSTOM_TOOL_ENTRY() : Next(0), Hotkey(0), Flags(0), VolumeType(0) { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created
CUSTOM_TOOL_ENTRY(const CUSTOM_TOOL_ENTRY&) = delete;
CUSTOM_TOOL_ENTRY& operator=(const CUSTOM_TOOL_ENTRY&) = delete;
};
typedef enum {
@ -170,8 +189,9 @@ typedef enum {
kTagTypeFloat
} TAG_TYPE;
typedef struct DEV_PROPERTY DEV_PROPERTY; //yyyy
struct DEV_PROPERTY {
class DEV_PROPERTY
{
public:
UINT32 Device;
EFI_DEVICE_PATH_PROTOCOL* DevicePath;
CHAR8 *Key;
@ -182,6 +202,12 @@ struct DEV_PROPERTY {
CHAR8 *Label;
INPUT_ITEM MenuItem;
TAG_TYPE ValueType;
DEV_PROPERTY() : Device(0), DevicePath(0), Key(0), Value(0), ValueLen(0), Next(0), Child(0), Label(0), ValueType(kTagTypeNone) { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created
DEV_PROPERTY(const DEV_PROPERTY&) = delete;
DEV_PROPERTY& operator=(const DEV_PROPERTY&) = delete;
};
typedef struct {
@ -530,7 +556,7 @@ typedef struct {
DEV_PROPERTY *ArbProperties;
UINTN QuirksMask;
UINT32 QuirksMask;
UINTN MaxSlide;
} SETTINGS_DATA;
@ -581,23 +607,34 @@ typedef struct {
} SLOT_DEVICE;
// ACPI/PATCHED/AML
typedef struct ACPI_PATCHED_AML ACPI_PATCHED_AML;
struct ACPI_PATCHED_AML
class ACPI_PATCHED_AML
{
public:
ACPI_PATCHED_AML *Next;
CHAR16 *FileName;
INPUT_ITEM MenuItem;
ACPI_PATCHED_AML() : Next(0), FileName(0) {};
ACPI_PATCHED_AML(const ACPI_PATCHED_AML& other) = delete; // Can be defined if needed
const ACPI_PATCHED_AML& operator = ( const ACPI_PATCHED_AML & ) = delete; // Can be defined if needed
~ACPI_PATCHED_AML() { }
};
// syscl - Side load kext
typedef struct SIDELOAD_KEXT SIDELOAD_KEXT;
struct SIDELOAD_KEXT {
class SIDELOAD_KEXT
{
public:
SIDELOAD_KEXT *Next;
SIDELOAD_KEXT *PlugInList;
CHAR16 *FileName;
CHAR16 *KextDirNameUnderOEMPath;
CHAR16 *Version;
XStringW FileName;
XStringW KextDirNameUnderOEMPath;
XStringW Version;
INPUT_ITEM MenuItem;
SIDELOAD_KEXT() : Next(0), PlugInList(0) {};
SIDELOAD_KEXT(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed
const SIDELOAD_KEXT& operator = ( const SIDELOAD_KEXT & ) = delete; // Can be defined if needed
~SIDELOAD_KEXT() { delete Next; delete PlugInList; }
};
typedef struct RT_VARIABLES RT_VARIABLES;
@ -684,7 +721,9 @@ extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl;
// config module
//
typedef struct {
class REFIT_CONFIG
{
public:
INTN Timeout;
UINTN DisableFlags; //to disable some volume types (optical, firewire etc)
BOOLEAN TextOnly;
@ -698,8 +737,8 @@ typedef struct {
BOOLEAN RtcHibernateAware;
BOOLEAN HibernationFixup;
BOOLEAN SignatureFixup;
CHAR16 *Theme;
CHAR16 *ScreenResolution;
XStringW Theme;
XStringW ScreenResolution;
INTN ConsoleMode;
BOOLEAN CustomIcons;
INTN IconFormat;
@ -708,7 +747,43 @@ typedef struct {
BOOLEAN ShowOptimus;
INTN Codepage;
INTN CodepageSize;
} REFIT_CONFIG;
/*
* Defqult ctor :
* -1, // INTN Timeout;
* 0, // UINTN DisableFlags;
* FALSE, // BOOLEAN TextOnly;
* TRUE, // BOOLEAN Quiet;
* FALSE, // BOOLEAN LegacyFirst;
* FALSE, // BOOLEAN NoLegacy;
* FALSE, // BOOLEAN DebugLog;
* FALSE, // BOOLEAN FastBoot;
* FALSE, // BOOLEAN NeverHibernate;
* FALSE, // BOOLEAN StrictHibernate;
* FALSE, // BOOLEAN RtcHibernateAware;
* FALSE, // BOOLEAN HibernationFixup;
* FALSE, // BOOLEAN SignatureFixup;
* L""_XSW, // XStringW Theme;
* L""_XSW, // XStringW ScreenResolution;
* 0, // INTN ConsoleMode;
* FALSE, // BOOLEAN CustomIcons;
* ICON_FORMAT_DEF, // INTN IconFormat;
* FALSE, // BOOLEAN NoEarlyProgress;
* 0xFF, // INT32 Timezone; / 0xFF - not set
* FALSE, // BOOLEAN ShowOptimus;
* 0xC0, // INTN Codepage;
* 0xC0, // INTN CodepageSize; //extended latin
};
*
*/
REFIT_CONFIG() : Timeout(-1), DisableFlags(0), TextOnly(FALSE), Quiet(TRUE), LegacyFirst(FALSE), NoLegacy(FALSE), DebugLog(FALSE), FastBoot(FALSE), NeverHibernate(FALSE), StrictHibernate(FALSE),
RtcHibernateAware(FALSE), HibernationFixup(FALSE), SignatureFixup(FALSE), ConsoleMode(0), CustomIcons(FALSE), IconFormat(ICON_FORMAT_DEF), NoEarlyProgress(FALSE), Timezone(0xFF),
ShowOptimus(FALSE), Codepage(0xC0), CodepageSize(0xC0) {};
REFIT_CONFIG(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed
const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed
~REFIT_CONFIG() { }
} ;
extern REFIT_CONFIG GlobalConfig;
@ -782,10 +857,10 @@ InitTheme (
// EFI_TIME *Time
);
CHAR16*
XStringW
GetOtherKextsDir (BOOLEAN On);
CHAR16*
XStringW
GetOSVersionKextsDir (
CHAR8 *OSVersion
);
@ -798,7 +873,7 @@ InjectKextsFromDir (
VOID
ParseLoadOptions (
OUT CHAR16 **Conf,
OUT XStringW* ConfName,
OUT TagPtr *Dict
);
@ -846,9 +921,9 @@ InitKextList(VOID);
EFI_STATUS
LoadUserSettings (
IN EFI_FILE *RootDir,
CONST CHAR16 *ConfName,
TagPtr *dict
IN EFI_FILE *RootDir,
const XStringW& ConfName,
TagPtr *dict
);
VOID

View File

@ -185,7 +185,7 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
// DBG("not found wave data\n");
goto DONE_ERROR;
}
// TempData = (__typeof__(TempData))AllocateZeroPool(Len * sizeof(INT16));
// TempData = (__typeof__(TempData))BllocateZeroPool(Len * sizeof(INT16));
TempData = (__typeof__(TempData))AllocateAlignedPages(EFI_SIZE_TO_PAGES(Len + 4095), 128);
Tmp = *(Ptr++);
for (Ind = 0; Ind < WaveData.SamplesLength / 2 - 1; Ind++) {
@ -256,7 +256,6 @@ GetStoredOutput()
UINTN h;
// Device Path.
CHAR16 *StoredDevicePathStr = NULL;
EFI_DEVICE_PATH_PROTOCOL *DevicePath = NULL;
UINT8 *StoredDevicePath = NULL; //it is EFI_DEVICE_PATH_PROTOCOL*
UINTN StoredDevicePathSize = 0;
@ -293,12 +292,10 @@ GetStoredOutput()
//we have to convert str->data if happen
if ((StoredDevicePath[0] != 2) && (StoredDevicePath[1] != 1)) {
StoredDevicePathStr = PoolPrint(L"%s", (CHAR16*)StoredDevicePath);
XStringW StoredDevicePathStr = SWPrintf("%ls", (CHAR16*)StoredDevicePath);
FreePool(StoredDevicePath);
DBG("stored device=%ls\n", StoredDevicePathStr);
StoredDevicePath = (UINT8*)ConvertTextToDevicePath((CHAR16*)StoredDevicePathStr);
FreePool(StoredDevicePathStr);
StoredDevicePathStr = NULL;
DBG("stored device=%ls\n", StoredDevicePathStr.wc_str());
StoredDevicePath = (UINT8*)ConvertTextToDevicePath(StoredDevicePathStr.wc_str());
StoredDevicePathSize = GetDevicePathSize((EFI_DEVICE_PATH_PROTOCOL *)StoredDevicePath);
}

View File

@ -463,7 +463,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
aml_calculate_size(root);
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
ssdt = (SSDT_TABLE *)BllocateZeroPool(root->Size);
aml_write_node(root, (CHAR8*)ssdt, 0);
ssdt->Length = root->Size;
FixChecksum(ssdt);
@ -682,7 +682,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
aml_calculate_size(root);
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
ssdt = (SSDT_TABLE *)BllocateZeroPool(root->Size);
aml_write_node(root, (CHAR8*)ssdt, 0);

View File

@ -0,0 +1,111 @@
///*++
//
//Copyright (c) 2005 - 2007, Intel Corporation
//All rights reserved. This program and the accompanying materials
//are licensed and made available under the terms and conditions of the BSD License
//which accompanies this distribution. The full text of the license may be found at
//http://opensource.org/licenses/bsd-license.php
//
//THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
//WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
//Module Name:
//
// IO.c
//
//Abstract:
//
// the IO library function
//
//Revision History
//
//--*/
//
#include "Platform.h"
//
//VOID LowCase (IN OUT CHAR8 *Str)
//{
// while (*Str) {
// if (IS_UPPER(*Str)) {
// *Str |= 0x20;
// }
// Str++;
// }
//}
UINT8 hexstrtouint8 (CHAR8* buf)
{
INT8 i = 0;
if (IS_DIGIT(buf[0]))
i = buf[0]-'0';
else if (IS_HEX(buf[0]))
i = (buf[0] | 0x20) - 'a' + 10;
if (AsciiStrLen(buf) == 1) {
return i;
}
i <<= 4;
if (IS_DIGIT(buf[1]))
i += buf[1]-'0';
else if (IS_HEX(buf[1]))
i += (buf[1] | 0x20) - 'a' + 10;
return i;
}
BOOLEAN IsHexDigit (CHAR8 c) {
return (IS_DIGIT(c) || (IS_HEX(c)))?TRUE:FALSE;
}
//out value is a number of byte. out = len
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len) //assume len = number of UINT8 values
{
CHAR8 *p;
UINT32 i, outlen = 0;
CHAR8 buf[3];
if (hex == NULL || bin == NULL || len <= 0 || AsciiStrLen(hex) < len * 2) {
// DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value
return FALSE;
}
buf[2] = '\0';
p = (CHAR8 *) hex;
for (i = 0; i < len; i++)
{
while ((*p == 0x20) || (*p == ',')) {
p++; //skip spaces and commas
}
if (*p == 0) {
break;
}
if (!IsHexDigit(p[0]) || !IsHexDigit(p[1])) {
MsgLog("[ERROR] bin2hex '%s' syntax error\n", hex);
return 0;
}
buf[0] = *p++;
buf[1] = *p++;
bin[i] = hexstrtouint8(buf);
outlen++;
}
//bin[outlen] = 0;
return outlen;
}
XString8 Bytes2HexStr(UINT8 *data, UINTN len)
{
UINTN i, j, b = 0;
XString8 result;
result.dataSized(len*2+1);
for (i = j = 0; i < len; i++) {
b = data[i] >> 4;
result += (CHAR8) (87 + b + (((b - 10) >> 31) & -39));
b = data[i] & 0xf;
result += (CHAR8) (87 + b + (((b - 10) >> 31) & -39));
}
return result;
}

View File

@ -0,0 +1,45 @@
//
//All rights reserved. This program and the accompanying materials
//are licensed and made available under the terms and conditions of the BSD License
//which accompanies this distribution. The full text of the license may be found at
//http://opensource.org/licenses/bsd-license.php
//
//THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
//WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
//Module Name:
//
// Utils
//
//
#ifndef _UTILS_H_
#define _UTILS_H_
#include "../cpp_foundation/XString.h"
//Unicode
#define IS_COMMA(a) ((a) == L',')
#define IS_HYPHEN(a) ((a) == L'-')
#define IS_DOT(a) ((a) == L'.')
#define IS_LEFT_PARENTH(a) ((a) == L'(')
#define IS_RIGHT_PARENTH(a) ((a) == L')')
#define IS_SLASH(a) ((a) == L'/')
#define IS_NULL(a) ((a) == L'\0')
//Ascii
#define IS_DIGIT(a) (((a) >= '0') && ((a) <= '9'))
#define IS_HEX(a) ((((a) >= 'a') && ((a) <= 'f')) || (((a) >= 'A') && ((a) <= 'F')))
#define IS_UPPER(a) (((a) >= 'A') && ((a) <= 'Z'))
#define IS_ALFA(x) (((x >= 'a') && (x <='z')) || ((x >= 'A') && (x <='Z')))
#define IS_ASCII(x) ((x>=0x20) && (x<=0x7F))
#define IS_PUNCT(x) ((x == '.') || (x == '-'))
////VOID LowCase (IN OUT CHAR8 *Str);
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
BOOLEAN IsHexDigit (CHAR8 c);
UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte
XString8 Bytes2HexStr(UINT8 *data, UINTN len);
#endif

View File

@ -1320,7 +1320,7 @@ BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier)
//static CHAR8 pciName[15];
BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8* pciName = (__typeof__(pciName))AllocateZeroPool(15);
CHAR8* pciName = (__typeof__(pciName))BllocateZeroPool(15);
if (!card->info->model_name || !gSettings.FakeATI) {
return FALSE;
@ -1335,7 +1335,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35);
CHAR8 *ModelName = (__typeof__(ModelName))BllocateZeroPool(35);
if (!card->info->model_name) {
return FALSE;
}
@ -1507,7 +1507,7 @@ BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier)
BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->data = (__typeof__(val->data))AllocateZeroPool(0x80);
val->data = (__typeof__(val->data))BllocateZeroPool(0x80);
if (!val->data)
return FALSE;
@ -1550,7 +1550,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
{
INTN i, pnum;
BOOLEAN Sier;
value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t));
value_t *val = (__typeof__(val))BllocateZeroPool(sizeof(value_t));
Sier = (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.12"));
@ -1655,7 +1655,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id)
}
DBG("Loaded ROM len=%llu\n", bufferLen);
card->rom_size = (UINT32)bufferLen;
card->rom = (__typeof__(card->rom))AllocateZeroPool(bufferLen);
card->rom = (__typeof__(card->rom))BllocateZeroPool(bufferLen);
if (!card->rom) {
return FALSE;
}
@ -1736,7 +1736,7 @@ BOOLEAN read_vbios(BOOLEAN from_pci)
return FALSE;
}
card->rom = (__typeof__(card->rom))AllocateZeroPool(card->rom_size);
card->rom = (__typeof__(card->rom))BllocateZeroPool(card->rom_size);
if (!card->rom) {
return FALSE;
}
@ -1905,7 +1905,7 @@ BOOLEAN devprop_add_pci_config_space(VOID)
{
int offset;
UINT8 *config_space = (__typeof__(config_space))AllocateZeroPool(0x100);
UINT8 *config_space = (__typeof__(config_space))BllocateZeroPool(0x100);
if (!config_space)
return FALSE;
@ -1932,7 +1932,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
UINTN ExpansionRom = 0;
UINTN Reg1, Reg3, Reg5;
card = (__typeof__(card))AllocateZeroPool(sizeof(card_t));
card = (__typeof__(card))BllocateZeroPool(sizeof(card_t));
if (!card) {
return FALSE;
}
@ -2027,7 +2027,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
NameLen = StrLen(gSettings.FBName);
if (NameLen > 2) { //fool proof: cfg_name is 3 character or more.
CfgName = (__typeof__(CfgName))AllocateZeroPool(NameLen);
CfgName = (__typeof__(CfgName))BllocateZeroPool(NameLen);
UnicodeStrToAsciiStrS((CHAR16*)&gSettings.FBName[0], CfgName, 16);
DBG("Users config name %s\n", CfgName);
card->cfg_name = CfgName;
@ -2065,13 +2065,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
DBG("Nr of ports set to min: %d\n", card->ports);
}
//
name = (__typeof__(name))AllocateZeroPool(24);
name = (__typeof__(name))BllocateZeroPool(24);
snprintf(name, 24, "ATY,%s", card->cfg_name);
aty_name.type = kStr;
aty_name.size = (UINT32)AsciiStrLen(name);
aty_name.data = (UINT8 *)name;
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
name_parent = (__typeof__(name_parent))BllocateZeroPool(24);
snprintf(name_parent, 24, "ATY,%sParent", card->cfg_name);
aty_nameparent.type = kStr;
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);
@ -2083,7 +2083,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
{
CHAR8 compatible[64];
CHAR8 *devicepath;
XString8 devicepath;
UINT32 FakeID = 0;
UINTN i;
@ -2163,7 +2163,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
(UINT32)RShiftU64(card->vram_size, 20), card->cfg_name,
ati_dev->vendor_id, ati_dev->device_id,
ati_dev->subsys_id.subsys.vendor_id, ati_dev->subsys_id.subsys.device_id,
devicepath);
devicepath.c_str());
FreePool(card->info);
FreePool(card);

View File

@ -107,7 +107,7 @@ UINT8 *Base64DecodeClover(IN CHAR8 *EncodedData, OUT UINTN *DecodedSize)
return NULL;
}
// to simplify, we'll allocate the same size, although smaller size is needed
DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize);
DecodedData = (__typeof__(DecodedData))BllocateZeroPool(EncodedSize);
base64_init_decodestate(&state_in);
DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in);

View File

@ -70,7 +70,7 @@ LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList);
VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
{
CARDLIST* new_card;
new_card = (__typeof__(new_card))AllocateZeroPool(sizeof(CARDLIST));
new_card = (__typeof__(new_card))BllocateZeroPool(sizeof(CARDLIST));
if (new_card) {
new_card->Signature = CARDLIST_SIGNATURE;
new_card->Id = Id;

View File

@ -55,7 +55,7 @@ UINT32 device_inject_stringlength = 0;
DevPropString *devprop_create_string(VOID)
{
// DBG("Begin creating strings for devices:\n");
device_inject_string = (DevPropString*)AllocateZeroPool(sizeof(DevPropString));
device_inject_string = (DevPropString*)BllocateZeroPool(sizeof(DevPropString));
if(device_inject_string == NULL)
return NULL;
@ -66,22 +66,18 @@ DevPropString *devprop_create_string(VOID)
}
CHAR8 *get_pci_dev_path(pci_dt_t *PciDt)
XString8 get_pci_dev_path(pci_dt_t *PciDt)
{
// DBG("get_pci_dev_path");
CHAR8* tmp;
CHAR16* devpathstr = NULL;
XString8 returnValue;
XStringW devpathstr;
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
UINTN Size;
DevicePath = DevicePathFromHandle (PciDt->DeviceHandle);
DevicePath = DevicePathFromHandle(PciDt->DeviceHandle);
if (!DevicePath)
return NULL;
devpathstr = FileDevicePathToStr(DevicePath);
Size = StrLen(devpathstr) + 1;
tmp = (__typeof__(tmp))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(devpathstr, tmp, Size);
return tmp;
return NullXString;
returnValue = FileDevicePathToXStringW(DevicePath);
return returnValue;
}
@ -142,7 +138,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
if (!DevicePath)
return NULL;
device = (__typeof__(device))AllocateZeroPool(sizeof(DevPropDevice));
device = (__typeof__(device))BllocateZeroPool(sizeof(DevPropDevice));
if (!device) {
return NULL;
}
@ -201,7 +197,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
StringBuf->length += device->length;
if(!StringBuf->entries) {
StringBuf->entries = (DevPropDevice**)AllocateZeroPool(MAX_NUM_DEVICES * sizeof(device));
StringBuf->entries = (DevPropDevice**)BllocateZeroPool(MAX_NUM_DEVICES * sizeof(device));
if(!StringBuf->entries) {
FreePool(device);
return NULL;
@ -234,7 +230,7 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UIN
DBG("\n"); */
l = AsciiStrLen(nm);
length = (UINT32)((l * 2) + len + (2 * sizeof(UINT32)) + 2);
data = (UINT8*)AllocateZeroPool(length);
data = (UINT8*)BllocateZeroPool(length);
if(!data)
return FALSE;
@ -260,7 +256,7 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UIN
offset = device->length - (24 + (6 * device->num_pci_devpaths));
newdata = (UINT8*)AllocateZeroPool((length + offset));
newdata = (UINT8*)BllocateZeroPool((length + offset));
if(!newdata)
return FALSE;
if((device->data) && (offset > 1)) {

View File

@ -48,7 +48,7 @@ typedef struct {
} option_rom_pci_header_t;
CHAR8 *get_pci_dev_path(pci_dt_t *pci_dt);
XString8 get_pci_dev_path(pci_dt_t *pci_dt);
UINT32 pci_config_read32(pci_dt_t *pci_dt, UINT8 reg);
extern pci_dt_t* nvdevice;
VOID* PCIReadRom(pci_dt_t* device);

View File

@ -960,7 +960,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
{
UINTN j;
UINTN i;
CHAR8 *devicepath;
XString8 devicepath;
CONST CHAR8 *model;
DevPropDevice *device = NULL;
UINT8 BuiltIn = 0x00;
@ -990,7 +990,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
//DBG("Finally model=%s\n", model);
MsgLog("%s [%04hX:%04hX] :: %s\n",
model, gma_dev->vendor_id, gma_dev->device_id, devicepath);
model, gma_dev->vendor_id, gma_dev->device_id, devicepath.c_str());
// Resolution
switch (UGAWidth) {

View File

@ -359,10 +359,10 @@ StrToGuidLE (
}
//Slice - I need GuidBEToStr :(
CHAR16 * GuidBeToStr(EFI_GUID *Guid)
XStringW GuidBeToStr(EFI_GUID *Guid)
{
UINT8 *GuidData = (UINT8 *)Guid;
CHAR16 *Str = PoolPrint(L"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
XStringW Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
GuidData[3], GuidData[2], GuidData[1], GuidData[0],
GuidData[5], GuidData[4],
GuidData[7], GuidData[6],

View File

@ -21,7 +21,7 @@ StrToGuidLE (
IN CONST CHAR16 *Str,
OUT EFI_GUID *Guid);
CHAR16 * GuidBeToStr(EFI_GUID *Guid);
XStringW GuidBeToStr(EFI_GUID *Guid);
XString8 GuidLEToXString8(EFI_GUID *Guid);
XStringW GuidLEToXStringW(EFI_GUID *Guid);

View File

@ -125,7 +125,7 @@ UINT32 LOADER_ENTRY::searchSectionByNum(UINT8 * binary, UINT32 Num)
UINT32 binaryIndex;
UINT32 currsect = 0;
UINT32 nsect;
UINT32 textAddr;
UINT32 textAddr = 0; // Init to avoid warning
struct segment_command_64 *loadCommand;
// struct symtab_command *symCmd;
if (!Num) {
@ -220,7 +220,7 @@ UINTN LOADER_ENTRY::searchProcInDriver(UINT8 * driver, UINT32 driverLen, const c
return 0;
}
INT32 i;
UINT32 Offset;
UINT32 Offset = 0; // Init to avoid warning
bool found = false;
for (i = 0; i < lSizeVtable; ++i) {
Offset = vArray[i].n_un.n_strx;

View File

@ -121,7 +121,7 @@ BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
//extern VOID KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry);
//extern VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N, LOADER_ENTRY *Entry);
EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext_v)
EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext_v)
{
EFI_STATUS Status;
UINT8* infoDictBuffer = NULL;
@ -131,8 +131,8 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN
UINTN executableBufferLength = 0;
CHAR8* bundlePathBuffer = NULL;
UINTN bundlePathBufferLength = 0;
CHAR16 *TempName;
CHAR16 *Executable;
XStringW TempName;
XStringW Executable;
TagPtr dict = NULL;
TagPtr prop = NULL;
BOOLEAN NoContents = FALSE;
@ -140,19 +140,17 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN
_BooterKextFileInfo *infoAddr = NULL;
_DeviceTreeBuffer *kext = (_DeviceTreeBuffer *)kext_v;
TempName = PoolPrint(L"%s\\%s", FileName, L"Contents\\Info.plist");
TempName = SWPrintf("%ls\\%ls", FileName, L"Contents\\Info.plist");
// snwprintf(TempName, 512, L"%s\\%s", FileName, "Contents\\Info.plist");
Status = egLoadFile(RootDir, TempName, &infoDictBuffer, &infoDictBufferLength);
FreePool(TempName);
Status = egLoadFile(RootDir, TempName.wc_str(), &infoDictBuffer, &infoDictBufferLength);
if (EFI_ERROR(Status)) {
//try to find a planar kext, without Contents
TempName = PoolPrint(L"%s\\%s", FileName, L"Info.plist");
TempName = SWPrintf("%ls\\%ls", FileName, L"Info.plist");
// snwprintf(TempName, 512, L"%s\\%s", FileName, "Info.plist");
infoDictBufferLength = 0;
Status = egLoadFile(RootDir, TempName, &infoDictBuffer, &infoDictBufferLength);
FreePool(TempName);
Status = egLoadFile(RootDir, TempName.wc_str(), &infoDictBuffer, &infoDictBufferLength);
if (EFI_ERROR(Status)) {
MsgLog("Failed to load extra kext : %ls status=%s\n", TempName, strerror(Status));
MsgLog("Failed to load extra kext : %ls status=%s\n", TempName.wc_str(), strerror(Status));
return EFI_NOT_FOUND;
}
NoContents = TRUE;
@ -171,18 +169,16 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN
prop = GetProperty(dict,"CFBundleExecutable");
if(prop!=0) {
Executable = PoolPrint(L"%a", prop->string);
Executable.takeValueFrom(prop->string);
// AsciiStrToUnicodeStrS(prop->string, Executable, 256);
if (NoContents) {
TempName = PoolPrint(L"%s\\%s", FileName, Executable);
TempName = SWPrintf("%ls\\%ls", FileName, Executable.wc_str());
// snwprintf(TempName, 512, "%s\\%s", FileName, Executable);
} else {
TempName = PoolPrint(L"%s\\%s\\%s", FileName, L"Contents\\MacOS",Executable);
TempName = SWPrintf("%ls\\%ls\\%ls", FileName, L"Contents\\MacOS", Executable.wc_str());
// snwprintf(TempName, 512, L"%s\\%s\\%s", FileName, "Contents\\MacOS",Executable);
}
FreePool(Executable);
Status = egLoadFile(RootDir, TempName, &executableFatBuffer, &executableBufferLength);
FreePool(TempName);
Status = egLoadFile(RootDir, TempName.wc_str(), &executableFatBuffer, &executableBufferLength);
if (EFI_ERROR(Status)) {
FreePool(infoDictBuffer);
MsgLog("Failed to load extra kext (executable not found): %ls\n", FileName);
@ -197,7 +193,7 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN
}
}
bundlePathBufferLength = StrLen(FileName) + 1;
bundlePathBuffer = (__typeof__(bundlePathBuffer))AllocateZeroPool(bundlePathBufferLength);
bundlePathBuffer = (__typeof__(bundlePathBuffer))BllocateZeroPool(bundlePathBufferLength);
UnicodeStrToAsciiStrS(FileName, bundlePathBuffer, bundlePathBufferLength);
kext->length = (UINT32)(sizeof(_BooterKextFileInfo) + infoDictBufferLength + executableBufferLength + bundlePathBufferLength);
@ -219,7 +215,7 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN
return EFI_SUCCESS;
}
EFI_STATUS LOADER_ENTRY::AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType)
EFI_STATUS LOADER_ENTRY::AddKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileName, IN cpu_type_t archCpuType)
{
EFI_STATUS Status;
KEXT_ENTRY *KextEntry;
@ -269,11 +265,11 @@ UINT32 GetKextsSize()
return kextsSize;
}
VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force)
VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, IN CONST CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force)
{
REFIT_DIR_ITER PlugInIter;
EFI_FILE_INFO *PlugInFile;
CHAR16 *FileName;
XStringW FileName;
if ((RootDir == NULL) || (DirName == NULL)) {
return;
}
@ -281,19 +277,18 @@ VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN
while (DirIterNext(&PlugInIter, 1, L"*.kext", &PlugInFile)) {
if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL)
continue; // skip this
FileName = PoolPrint(L"%s\\%s", DirName, PlugInFile->FileName);
FileName = SWPrintf("%ls\\%ls", DirName, PlugInFile->FileName);
// snwprintf(FileName, 512, "%s\\%s", DirName, PlugInFile->FileName);
MsgLog(" %ls PlugIn kext: %ls\n", Force ? L"Force" : L"Extra", FileName);
AddKext( RootDir, FileName, archCpuType);
FreePool(FileName);
MsgLog(" %ls PlugIn kext: %ls\n", Force ? L"Force" : L"Extra", FileName.wc_str());
AddKext( RootDir, FileName.wc_str(), archCpuType);
}
DirIterClose(&PlugInIter);
}
VOID LOADER_ENTRY::AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType)
{
CHAR16 *FileName;
CHAR16 *PlugInName;
XStringW FileName;
XStringW PlugInName;
SIDELOAD_KEXT *CurrentKext;
SIDELOAD_KEXT *CurrentPlugInKext;
EFI_STATUS Status;
@ -302,37 +297,35 @@ VOID LOADER_ENTRY::AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t
CurrentKext = InjectKextList;
while (CurrentKext) {
// DBG(" current kext name=%ls path=%ls, match against=%ls\n", CurrentKext->FileName, CurrentKext->KextDirNameUnderOEMPath, Path);
if (StrCmp(CurrentKext->KextDirNameUnderOEMPath, Path) == 0) {
FileName = PoolPrint(L"%s\\%s", SrcDir, CurrentKext->FileName);
if (StrCmp(CurrentKext->KextDirNameUnderOEMPath.wc_str(), Path) == 0) {
FileName = SWPrintf("%ls\\%ls", SrcDir, CurrentKext->FileName.wc_str());
// snwprintf(FileName, 512, "%s\\%s", SrcDir, CurrentKext->FileName);
if (!(CurrentKext->MenuItem.BValue)) {
// inject require
MsgLog("->Extra kext: %ls (v.%ls)\n", FileName, CurrentKext->Version);
Status = AddKext(SelfVolume->RootDir, FileName, archCpuType);
MsgLog("->Extra kext: %ls (v.%ls)\n", FileName.wc_str(), CurrentKext->Version.wc_str());
Status = AddKext(SelfVolume->RootDir, FileName.wc_str(), archCpuType);
if(!EFI_ERROR(Status)) {
// decide which plugins to inject
CurrentPlugInKext = CurrentKext->PlugInList;
while (CurrentPlugInKext) {
PlugInName = PoolPrint(L"%s\\%s\\%s", FileName, L"Contents\\PlugIns", CurrentPlugInKext->FileName);
PlugInName = SWPrintf("%ls\\%ls\\%ls", FileName.wc_str(), L"Contents\\PlugIns", CurrentPlugInKext->FileName.wc_str());
// snwprintf(PlugInName, 512, L"%s\\%s\\%s", FileName, "Contents\\PlugIns", CurrentPlugInKext->FileName);
if (!(CurrentPlugInKext->MenuItem.BValue)) {
// inject PlugIn require
MsgLog(" |-- PlugIn kext: %ls (v.%ls)\n", PlugInName, CurrentPlugInKext->Version);
AddKext(SelfVolume->RootDir, PlugInName, archCpuType);
MsgLog(" |-- PlugIn kext: %ls (v.%ls)\n", PlugInName.wc_str(), CurrentPlugInKext->Version.wc_str());
AddKext(SelfVolume->RootDir, PlugInName.wc_str(), archCpuType);
} else {
MsgLog(" |-- Disabled plug-in kext: %ls (v.%ls)\n", PlugInName, CurrentPlugInKext->Version);
MsgLog(" |-- Disabled plug-in kext: %ls (v.%ls)\n", PlugInName.wc_str(), CurrentPlugInKext->Version.wc_str());
}
FreePool(PlugInName);
CurrentPlugInKext = CurrentPlugInKext->Next;
} // end of plug-in kext injection
}
} else {
// disable current kext injection
if (!StriStr(SrcDir, L"Off")) {
MsgLog("Disabled kext: %ls (v.%ls)\n", FileName, CurrentKext->Version);
MsgLog("Disabled kext: %ls (v.%ls)\n", FileName.wc_str(), CurrentKext->Version.wc_str());
}
}
FreePool(FileName);
}
CurrentKext = CurrentKext->Next;
} // end of kext injection
@ -341,11 +334,11 @@ VOID LOADER_ENTRY::AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t
EFI_STATUS LOADER_ENTRY::LoadKexts()
{
CHAR16 *SrcDir = NULL;
XStringW SrcDir;
REFIT_DIR_ITER PlugInIter;
EFI_FILE_INFO *PlugInFile;
CHAR16 *FileName;
CHAR16 *PlugIns;
EFI_FILE_INFO *PlugInFile;
XStringW FileName;
XStringW PlugIns;
// CONST CHAR16 *Arch = NULL;
// CONST CHAR16 *Ptr = NULL;
#if defined(MDE_CPU_X64)
@ -358,9 +351,6 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
UINTN extra_size;
VOID *extra;
SIDELOAD_KEXT *CurrentKext = NULL;
SIDELOAD_KEXT *CurrentPlugInKext = NULL;
SIDELOAD_KEXT *Next = NULL;
// Make Arch point to the last appearance of "arch=" in LoadOptions (which is what boot.efi will use).
// if (LoadOptions.notEmpty()) {
@ -395,23 +385,20 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
while (DirIterNext(&PlugInIter, 1, L"*.kext", &PlugInFile)) {
if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL)
continue; // skip this
FileName = PoolPrint(L"%s\\%s", KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName);
FileName = SWPrintf("%ls\\%ls", KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName);
// snwprintf(FileName, 512, "%s\\%s", KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName);
MsgLog(" Force kext: %ls\n", FileName);
AddKext( Volume->RootDir, FileName, archCpuType);
PlugIns = PoolPrint(L"%s\\Contents\\PlugIns", FileName);
MsgLog(" Force kext: %ls\n", FileName.wc_str());
AddKext( Volume->RootDir, FileName.wc_str(), archCpuType);
PlugIns = SWPrintf("%ls\\Contents\\PlugIns", FileName.wc_str());
// snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", FileName);
LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE);
FreePool(FileName);
FreePool(PlugIns);
LoadPlugInKexts(Volume->RootDir, PlugIns.wc_str(), archCpuType, TRUE);
}
DirIterClose(&PlugInIter);
} else {
AddKext( Volume->RootDir, KernelAndKextPatches->ForceKexts[i], archCpuType);
PlugIns = PoolPrint(L"%s\\Contents\\PlugIns", KernelAndKextPatches->ForceKexts[i]);
PlugIns = SWPrintf("%ls\\Contents\\PlugIns", KernelAndKextPatches->ForceKexts[i]);
// snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", KernelAndKextPatches->ForceKexts[i]);
LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE);
FreePool(PlugIns);
LoadPlugInKexts(Volume->RootDir, PlugIns.wc_str(), archCpuType, TRUE);
}
}
}
@ -436,71 +423,65 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
// syscl - allow specific load inject kext
// Clover/Kexts/Other is for general injection thus we need to scan both Other and OSVersion folder
if ((SrcDir = GetOtherKextsDir(TRUE)) != NULL) {
AddKexts(SrcDir, L"Other", archCpuType);
FreePool(SrcDir);
SrcDir = GetOtherKextsDir(TRUE);
if ( SrcDir.notEmpty() ) {
AddKexts(SrcDir.wc_str(), L"Other", archCpuType);
} else {
DBG("GetOtherKextsDir(TRUE) return NULL\n");
}
// slice: CLOVER/kexts/Off keep disabled kext which can be allowed
if ((SrcDir = GetOtherKextsDir(FALSE)) != NULL) {
AddKexts(SrcDir, L"Off", archCpuType);
FreePool(SrcDir);
SrcDir = GetOtherKextsDir(FALSE);
if ( SrcDir.notEmpty() ) {
AddKexts(SrcDir.wc_str(), L"Off", archCpuType);
} else {
DBG("GetOtherKextsDir(FALSE) return NULL\n");
}
// Add kext from 10
{
CHAR16 *OSAllVersionKextsDir;
CHAR16 *OSShortVersionKextsDir;
CHAR16 *OSVersionKextsDirName;
CHAR16 *DirName;
CHAR16 *DirPath;
OSAllVersionKextsDir = PoolPrint(L"%s\\kexts\\10", OEMPath);
XStringW OSAllVersionKextsDir;
XStringW OSShortVersionKextsDir;
XStringW OSVersionKextsDirName;
XStringW DirName;
XStringW DirPath;
OSAllVersionKextsDir = SWPrintf("%ls\\kexts\\10", OEMPath.wc_str());
// snwprintf(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), "%s\\kexts\\10", OEMPath);
AddKexts(OSAllVersionKextsDir, L"10", archCpuType);
FreePool(OSAllVersionKextsDir);
AddKexts(OSAllVersionKextsDir.wc_str(), L"10", archCpuType);
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
DirName = PoolPrint(L"10_install");
DirName = SWPrintf("10_install");
// snwprintf(DirName, sizeof(DirName), "10_install");
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
DirName = PoolPrint(L"10_recovery");
DirName = SWPrintf("10_recovery");
// snwprintf(DirName, sizeof(DirName), "10_recovery");
} else {
DirName = PoolPrint(L"10_normal");
DirName = SWPrintf("10_normal");
// snwprintf(DirName, sizeof(DirName), "10_normal");
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
// snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName);
AddKexts( DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
AddKexts(DirPath.wc_str(), DirName.wc_str(), archCpuType);
// Add kext from 10.{version}
OSShortVersionKextsDir = PoolPrint(L"%s\\kexts\\%s", OEMPath, UniShortOSVersion);
OSShortVersionKextsDir = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), UniShortOSVersion);
// snwprintf(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), "%s\\kexts\\%s", OEMPath, UniShortOSVersion);
AddKexts( OSShortVersionKextsDir, UniShortOSVersion, archCpuType);
FreePool(OSShortVersionKextsDir);
AddKexts( OSShortVersionKextsDir.wc_str(), UniShortOSVersion, archCpuType);
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
DirName = PoolPrint(L"%s_install", UniShortOSVersion);
DirName = SWPrintf("%ls_install", UniShortOSVersion);
// snwprintf(DirName, sizeof(DirName), "%s_install", UniShortOSVersion);
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
DirName = PoolPrint(L"%s_recovery", UniShortOSVersion);
DirName = SWPrintf("%ls_recovery", UniShortOSVersion);
// snwprintf(DirName, sizeof(DirName), "%s_recovery", UniShortOSVersion);
} else {
DirName = PoolPrint(L"%s_normal", UniShortOSVersion);
DirName = SWPrintf("%ls_normal", UniShortOSVersion);
// snwprintf(DirName, sizeof(DirName), "%s_normal", UniShortOSVersion);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
// snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName);
AddKexts( DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
AddKexts(DirPath.wc_str(), DirName.wc_str(), archCpuType);
// Add kext from :
@ -508,44 +489,40 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
// 10.{version}.{minor version} if minor version is > 0
if ( AsciiStrCmp(ShortOSVersion, OSVersion) == 0 ) {
OSVersionKextsDirName = PoolPrint(L"%a.0", OSVersion);
OSVersionKextsDirName = SWPrintf("%s.0", OSVersion);
// snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%a.0", OSVersion);
} else {
OSVersionKextsDirName = PoolPrint(L"%a", OSVersion);
OSVersionKextsDirName = SWPrintf("%s", OSVersion);
// snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%a", OSVersion);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), OSVersionKextsDirName.wc_str());
// snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
AddKexts( DirPath, OSVersionKextsDirName, archCpuType);
FreePool(DirPath);
AddKexts(DirPath.wc_str(), OSVersionKextsDirName.wc_str(), archCpuType);
if ( OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
DirName = PoolPrint(L"%s_install", OSVersionKextsDirName);
DirName = SWPrintf("%ls_install", OSVersionKextsDirName.wc_str());
// snwprintf(DirName, sizeof(DirName), "%s_install", OSVersionKextsDirName);
} else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
DirName = PoolPrint(L"%s_recovery", OSVersionKextsDirName);
DirName = SWPrintf("%ls_recovery", OSVersionKextsDirName.wc_str());
// snwprintf(DirName, sizeof(DirName), "%s_recovery", OSVersionKextsDirName);
} else {
DirName = PoolPrint(L"%s_normal", OSVersionKextsDirName);
DirName = SWPrintf("%ls_normal", OSVersionKextsDirName.wc_str());
// snwprintf(DirName, sizeof(DirName), "%s_normal", OSVersionKextsDirName);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
// snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName);
AddKexts( DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
FreePool(OSVersionKextsDirName);
AddKexts(DirPath.wc_str(), DirName.wc_str(), archCpuType);
}
// reserve space in the device tree
if (GetKextCount() > 0) {
mm_extra_size = GetKextCount() * (sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer));
mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
mm_extra = (__typeof__(mm_extra))BllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DeviceTreeNodeProperty)));
extra_size = GetKextsSize();
extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
extra = (__typeof__(extra))BllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE));
// MsgLog("count: %d \n", GetKextCount());
// MsgLog("mm_extra_size: %d \n", mm_extra_size);
@ -556,24 +533,29 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
FreePool(extra);
}
//No more InjectKextList needed. Will free the list
while (InjectKextList) {
CurrentKext = InjectKextList->Next;
CurrentPlugInKext = InjectKextList->PlugInList;
while (CurrentPlugInKext) {
Next = CurrentPlugInKext->Next;
FreePool(CurrentPlugInKext->FileName);
FreePool(CurrentPlugInKext->KextDirNameUnderOEMPath);
FreePool(CurrentPlugInKext->Version);
FreePool(CurrentPlugInKext);
CurrentPlugInKext = Next;
}
FreePool(InjectKextList->FileName);
FreePool(InjectKextList->KextDirNameUnderOEMPath);
FreePool(InjectKextList->Version);
FreePool(InjectKextList);
InjectKextList = CurrentKext;
}
// SIDELOAD_KEXT *CurrentKext = NULL;
// SIDELOAD_KEXT *CurrentPlugInKext = NULL;
// SIDELOAD_KEXT *Next = NULL;
// //No more InjectKextList needed. Will free the list
// while (InjectKextList) {
// CurrentKext = InjectKextList->Next;
// CurrentPlugInKext = InjectKextList->PlugInList;
// while (CurrentPlugInKext) {
// Next = CurrentPlugInKext->Next;
// FreePool(CurrentPlugInKext->FileName);
// FreePool(CurrentPlugInKext->KextDirNameUnderOEMPath);
// FreePool(CurrentPlugInKext->Version);
// FreePool(CurrentPlugInKext);
// CurrentPlugInKext = Next;
// }
// FreePool(InjectKextList->FileName);
// FreePool(InjectKextList->KextDirNameUnderOEMPath);
// FreePool(InjectKextList->Version);
// FreePool(InjectKextList);
// InjectKextList = CurrentKext;
// }
delete InjectKextList;
InjectKextList = NULL;
return EFI_SUCCESS;
}

View File

@ -391,11 +391,11 @@ VOID LOADER_ENTRY::ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *Force
FSI_STRING_LIST *ForceLoadKexts = (FSI_STRING_LIST *)ForceLoadKexts_v;
// for future?
FSInject->AddStringToList(ForceLoadKexts,
PoolPrint(L"\\AMD%aController.kext\\Contents\\Info.plist", KernelAndKextPatches->KPATIConnectorsController)
SWPrintf("\\AMD%sController.kext\\Contents\\Info.plist", KernelAndKextPatches->KPATIConnectorsController).wc_str()
);
// Lion, ML, SnowLeo 10.6.7 2011 MBP
FSInject->AddStringToList(ForceLoadKexts,
PoolPrint(L"\\ATI%aController.kext\\Contents\\Info.plist", KernelAndKextPatches->KPATIConnectorsController)
SWPrintf("\\ATI%sController.kext\\Contents\\Info.plist", KernelAndKextPatches->KPATIConnectorsController).wc_str()
);
// SnowLeo
FSInject->AddStringToList(ForceLoadKexts, L"\\ATIFramebuffer.kext\\Contents\\Info.plist");
@ -1222,8 +1222,7 @@ VOID LOADER_ENTRY::KextPatcherRegisterKexts(void *FSInject_v, void *ForceLoadKex
for (INTN i = 0; i < KernelAndKextPatches->NrKexts; i++) {
FSInject->AddStringToList((FSI_STRING_LIST*)ForceLoadKexts,
PoolPrint(L"\\%a.kext\\Contents\\Info.plist",
KernelAndKextPatches->KextPatches[i].Name) );
SWPrintf("\\%s.kext\\Contents\\Info.plist", KernelAndKextPatches->KextPatches[i].Name).wc_str() );
}
}

View File

@ -2178,7 +2178,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
const INT32 MAX_BIOS_VERSION_LENGTH = 32;
EFI_STATUS Status = EFI_NOT_FOUND;
DevPropDevice *device = NULL;
CHAR8 *devicepath = NULL;
XString8 devicepath;
BOOLEAN load_vbios = gSettings.LoadVBios;
BOOLEAN Injected = FALSE;
UINT8 *rom = NULL;
@ -2193,12 +2193,10 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
UINT8 *buffer = NULL;
UINTN bufferLen = 0;
UINTN j, n_ports = 0;
UINTN i, version_start;
UINTN i;
INT32 crlf_count = 0;
option_rom_pci_header_t *rom_pci_header;
CHAR8* s;
CHAR8* s1;
CHAR8* version_str = (CHAR8*)AllocateZeroPool(MAX_BIOS_VERSION_LENGTH);
XString8 version_str;
BOOLEAN RomAssigned = FALSE;
UINT32 device_id, subsys_id;
CARDLIST *nvcard;
@ -2294,7 +2292,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
}
if (EFI_ERROR(Status)) {
rom = (__typeof__(rom))AllocateZeroPool(NVIDIA_ROM_SIZE+1);
rom = (__typeof__(rom))BllocateZeroPool(NVIDIA_ROM_SIZE+1);
// PRAMIN first
read_nVidia_PRAMIN(nvda_dev, rom, nvCardType);
@ -2321,7 +2319,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (buffer[i] == 0x55 && buffer[i+1] == 0xaa) {
DBG(" header found at: %llu\n", i);
bufferLen -= i;
rom = (__typeof__(rom))AllocateZeroPool(bufferLen);
rom = (__typeof__(rom))BllocateZeroPool(bufferLen);
for (j = 0; j < bufferLen; j++) {
rom[j] = buffer[i+j];
}
@ -2367,7 +2365,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (crlf_count == 2) {
if (rom[i-1] == 0x20) i--; // strip last " "
for (version_start = i; version_start > (i-MAX_BIOS_VERSION_LENGTH); version_start--) {
for (UINTN version_start = i; version_start > (i-MAX_BIOS_VERSION_LENGTH); version_start--) {
// find start
if (rom[version_start] == 0x00) {
version_start++;
@ -2376,13 +2374,13 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (strncmp((const CHAR8*)rom + version_start, "Version ", 8) == 0) {
version_start += 8;
}
s = (CHAR8*)(rom + version_start);
s1 = version_str;
while ((*s > ' ') && (*s < 'z') && ((INTN)(s1 - version_str) < MAX_BIOS_VERSION_LENGTH)) {
*s1++ = *s++;
CHAR8* s = (CHAR8*)(rom + version_start);
CHAR8* p = s;
while ((*p > ' ') && (*p < 'z') && ((INTN)(p-s) < MAX_BIOS_VERSION_LENGTH)) {
p++;
}
*s1 = 0;
DBG("version %s\n", version_str);
version_str.strncpy(s, p-s);
DBG("version %s\n", version_str.c_str());
break;
}
}
@ -2391,13 +2389,13 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
}
}
} else {
snprintf(version_str, sizeof(version_str), "1.0");
version_str.takeValueFrom("1.0");
}
DBG("nVidia %s ", model);
DBG(" %dMB NV%02hX [%04hX:%04hX] :: %s => device #%d\n", (UINT32)(RShiftU64(videoRam, 20)),
nvCardType, nvda_dev->vendor_id, nvda_dev->device_id,
devicepath, devices_number);
devicepath.c_str(), devices_number);
if (!device_inject_string) {
device_inject_string = devprop_create_string();
@ -2528,7 +2526,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
devprop_add_value(device, "NVPM", default_NVPM, NVPM_LEN);
devprop_add_value(device, "model", (UINT8*)model, (UINT32)AsciiStrLen(model));
devprop_add_value(device, "rom-revision", (UINT8*)version_str, (UINT32)AsciiStrLen(version_str));
devprop_add_value(device, "rom-revision", (UINT8*)version_str.c_str(), version_str.sizeInBytes());
if (gMobile) {
DBG("Nvidia Mobile backlight\n");
devprop_add_value(device, "AAPL,backlight-control", (UINT8*)&boot_display, 4);
@ -2541,7 +2539,6 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
done:
devices_number++;
FreePool(version_str);
if (buffer) {
FreePool(buffer);
}

View File

@ -556,8 +556,8 @@ PLATFORMDATA ApplePlatformData[] =
VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
{
const CHAR8 *i;
CHAR8 *Res1 = (__typeof__(Res1))AllocateZeroPool(9);
CHAR8 *Res2 = (__typeof__(Res2))AllocateZeroPool(11);
CHAR8 *Res1 = (__typeof__(Res1))BllocateZeroPool(9);
CHAR8 *Res2 = (__typeof__(Res2))BllocateZeroPool(11);
AsciiStrCpyS (gSettings.VendorName, 64, BiosVendor);
AsciiStrCpyS (gSettings.RomVersion, 64, ApplePlatformData[Model].firmwareVersion);

View File

@ -99,7 +99,7 @@ XMLDecode(CHAR8* src)
len = AsciiStrLen(src);
#if 0
out = (__typeof__(out))AllocateZeroPool(len+1);
out = (__typeof__(out))BllocateZeroPool(len+1);
if (!out)
return 0;
#else // unsafe
@ -213,7 +213,7 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
return EFI_INVALID_PARAMETER;
}
configBuffer = (__typeof__(configBuffer))AllocateZeroPool(bufferSize+1);
configBuffer = (__typeof__(configBuffer))BllocateZeroPool(bufferSize+1);
if(configBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -932,7 +932,7 @@ TagPtr NewTag( void )
TagPtr tag;
if (gTagsFree == NULL) {
tag = (TagPtr)AllocateZeroPool(TAGCACHESIZE * sizeof(TagStruct));
tag = (TagPtr)BllocateZeroPool(TAGCACHESIZE * sizeof(TagStruct));
if (tag == NULL) {
return NULL;
}
@ -1002,7 +1002,7 @@ CHAR8* NewSymbol(CHAR8* tmpString)
// Add the new symbol.
if (symbol == NULL) {
len = AsciiStrLen(tmpString);
symbol = (SymbolPtr)AllocateZeroPool(sizeof(Symbol) + len + 1);
symbol = (SymbolPtr)BllocateZeroPool(sizeof(Symbol) + len + 1);
if (symbol == NULL) {
return NULL;
}

View File

@ -2052,8 +2052,8 @@ EFI_STATUS PrepatchSmbios()
}
//Create space for SPD
//gRAM = (__typeof__(gRAM))AllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = (__typeof__(gDMI))AllocateZeroPool(sizeof(DMI));
//gRAM = (__typeof__(gRAM))BllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = (__typeof__(gDMI))BllocateZeroPool(sizeof(DMI));
//Collect information for use in menu
GetTableType1();
@ -2073,7 +2073,7 @@ VOID PatchSmbios(VOID) //continue
DbgHeader("PatchSmbios");
newSmbiosTable.Raw = (UINT8*)AllocateZeroPool(MAX_TABLE_SIZE);
newSmbiosTable.Raw = (UINT8*)BllocateZeroPool(MAX_TABLE_SIZE);
//Slice - order of patching is significant
PatchTableType0();
PatchTableType1();

View File

@ -671,7 +671,7 @@ STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
// needed at least for laptops
//fullBanks = (gDMI->MemoryModules == gDMI->CntMemorySlots);
spdbuf = (__typeof__(spdbuf))AllocateZeroPool(MAX_SPD_SIZE);
spdbuf = (__typeof__(spdbuf))BllocateZeroPool(MAX_SPD_SIZE);
// Search MAX_RAM_SLOTS slots
//==>

View File

@ -171,10 +171,10 @@ public:
};
constexpr LString8 operator"" _XS8 ( const char* s, size_t len);
constexpr LString16 operator"" _XS16 ( const char16_t* s, size_t len);
constexpr LString32 operator"" _XS32 ( const char32_t* s, size_t len);
constexpr LStringW operator"" _XSW ( const wchar_t* s, size_t len);
constexpr LString8 operator "" _XS8 ( const char* s, size_t len);
constexpr LString16 operator "" _XS16 ( const char16_t* s, size_t len);
constexpr LString32 operator "" _XS32 ( const char32_t* s, size_t len);
constexpr LStringW operator "" _XSW ( const wchar_t* s, size_t len);
extern const XString8 NullXString;
extern const XStringW NullXStringW;

View File

@ -732,7 +732,7 @@ class XStringAbstract : public __String<T, ThisXStringClass>
// ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
protected:
ThisXStringClass& takeValueFromLiteral (const T* s)
ThisXStringClass& takeValueFromLiteral(const T* s)
{
if ( m_allocatedSize > 0 ) panic("XStringAbstract::takeValueFromLiteral -> m_allocatedSize > 0");
m_data = (T*)s;
@ -874,13 +874,21 @@ public:
// nothing to do
}
}
ThisXStringClass& stealValueFrom(T* S) {
if ( m_allocatedSize > 0 ) free((void*)m_data);
m_data = S;
m_allocatedSize = utf_size_of_utf_string(m_data, S) + 1;
return *((ThisXStringClass*)this);
}
/* takeValueFrom */
template<typename O, class OtherXStringClass>
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
template<typename O>
ThisXStringClass& takeValueFrom(const O* S) { strcpy(S); return *((ThisXStringClass*)this); }
template<typename O, enable_if(is_char(O))>
ThisXStringClass& takeValueFrom(const O C) { strcpy(C); return *((ThisXStringClass*)this); }
template<typename O>
ThisXStringClass& takeValueFrom(const O* S) { strcpy(S); return *((ThisXStringClass*)this); }
template<typename O, enable_if(is_char(O))>
ThisXStringClass& takeValueFrom(const O C) { strcpy(C); return *((ThisXStringClass*)this); }
template<typename O, class OtherXStringClass>
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S, size_t len) { strncpy(S.data(0), len); return *((ThisXStringClass*)this); }
template<typename O>

View File

@ -5,170 +5,6 @@
CHAR16 *Old1_AddLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *LoadOption)
{
// If either option strings are null nothing to do
if (LoadOptions == NULL)
{
if (LoadOption == NULL) return NULL;
// Duplicate original options as nothing to add
return EfiStrDuplicate(LoadOption);
}
// If there is no option or it is already present duplicate original
// with XStringW it will be replaced by if (LoadOptions.contains(LoadOption))
else if ((LoadOption == NULL) || StrStr(LoadOptions, LoadOption))
return EfiStrDuplicate(LoadOptions);
// Otherwise add option
// return PoolPrint(L"%s %s", LoadOptions, LoadOption); //LoadOptions + LoadOption
return SWPrintf("%ls %ls", LoadOptions, LoadOption).forgetDataWithoutFreeing(); //LoadOptions + LoadOption
}
CHAR16 *Old1_RemoveLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *LoadOption)
{
CONST CHAR16 *Placement;
CHAR16 *NewLoadOptions;
UINTN Length, Offset, OptionLength;
//DBG("LoadOptions: '%ls', remove LoadOption: '%ls'\n", LoadOptions, LoadOption);
// If there are no options then nothing to do
if (LoadOptions == NULL) return NULL;
// If there is no option to remove then duplicate original
if (LoadOption == NULL) return EfiStrDuplicate(LoadOptions);
// If not present duplicate original
Placement = StrStr(LoadOptions, LoadOption);
if (Placement == NULL) return EfiStrDuplicate(LoadOptions);
// Get placement of option in original options
Offset = UINTN(Placement - LoadOptions);
Length = StrLen(LoadOptions);
OptionLength = StrLen(LoadOption);
// If this is just part of some larger option (contains non-space at the beginning or end)
if ((Offset > 0 && LoadOptions[Offset - 1] != L' ') ||
((Offset + OptionLength) < Length && LoadOptions[Offset + OptionLength] != L' ')) {
return EfiStrDuplicate(LoadOptions);
}
// Consume preceeding spaces
while (Offset > 0 && LoadOptions[Offset - 1] == L' ') {
OptionLength++;
Offset--;
}
// Consume following spaces
while (LoadOptions[Offset + OptionLength] == L' ') {
OptionLength++;
}
// If it's the whole string return NULL
if (OptionLength == Length) return NULL;
if (Offset == 0) {
// Simple case - we just need substring after OptionLength position
NewLoadOptions = EfiStrDuplicate(LoadOptions + OptionLength);
} else {
// The rest of LoadOptions is Length - OptionLength, but we may need additional space and ending 0
NewLoadOptions = (__typeof__(NewLoadOptions))AllocateZeroPool((Length - OptionLength + 2) * sizeof(CHAR16));
// Copy preceeding substring
CopyMem(NewLoadOptions, (void*)LoadOptions, Offset * sizeof(CHAR16));
if ((Offset + OptionLength) < Length) {
// Copy following substring, but include one space also
OptionLength--;
CopyMem(NewLoadOptions + Offset, (void*)(LoadOptions + Offset + OptionLength), (Length - OptionLength - Offset) * sizeof(CHAR16));
}
}
return NewLoadOptions;
}
//
//static XString AddLoadOption(IN CONST XString& LoadOptions, IN CONST XString& LoadOption)
//{
// // LoadOptions assumed out
// // If either option strings are null nothing to do
// if (LoadOptions.isEmpty()) //initially empty so return new option even if empty
// {
// // return LoadOption
// return LoadOption;
// }
// // If there is no option or it is already present duplicate original
// else {
// if ( LoadOptions.contains(LoadOption) ) return LoadOptions; //good
// // Otherwise add option
//// return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption
// return LoadOptions + " "_XS8 + LoadOption; //why not?
// }
//}
//
//static XString RemoveLoadOption(IN const XString& LoadOptions, IN const XString& LoadOption)
//{
//// CONST CHAR16 *Placement;
//// CHAR16 *NewLoadOptions;
//// UINTN Length, Offset, OptionLength;
//
// //DBG("LoadOptions: '%ls', remove LoadOption: '%ls'\n", LoadOptions, LoadOption);
// // If there are no options then nothing to do
// if (LoadOptions.isEmpty()) return ""_XS8;
// // If there is no option to remove then duplicate original
// if (LoadOption.isEmpty()) return LoadOptions;
// // If not present duplicate original
// xsize Offset = LoadOptions.indexOf(LoadOption);
// if ( Offset == MAX_XSIZE ) return LoadOptions;
//
// // Get placement of option in original options
//// Offset = (Placement - LoadOptions);
// xsize Length = LoadOptions.length();
// xsize OptionLength = LoadOption.length();
//
// // If this is just part of some larger option (contains non-space at the beginning or end)
// if ((Offset > 0 && LoadOptions[Offset - 1] != ' ') ||
// ((Offset + OptionLength) < Length && LoadOptions[Offset + OptionLength] != ' ')) {
// return LoadOptions;
// }
//
// // Consume preceeding spaces
// while (Offset > 0 && LoadOptions[Offset - 1] == ' ') {
// OptionLength++;
// Offset--;
// }
//
// // Consume following spaces
// while (LoadOptions[Offset + OptionLength] == ' ') {
// OptionLength++;
// }
//
// // If it's the whole string return NULL
// if (OptionLength == Length) return ""_XS8;
//
// XString NewLoadOptions;
// if (Offset == 0) {
// // Simple case - we just need substring after OptionLength position
// NewLoadOptions = LoadOptions.subString(OptionLength, MAX_XSIZE);
// } else {
// // Copy preceeding substring
// NewLoadOptions = LoadOptions.subString(0, Offset);
//// CopyMem(NewLoadOptions, LoadOptions, Offset * sizeof(CHAR16));
// if ((Offset + OptionLength) < Length) {
// // Copy following substring, but include one space also
// OptionLength--;
// NewLoadOptions += LoadOptions.subString(Offset + OptionLength, MAX_XSIZE);
//// CopyMem(NewLoadOptions + Offset, LoadOptions + Offset + OptionLength, (Length - OptionLength - Offset) * sizeof(CHAR16));
// }
// }
// return NewLoadOptions;
//}
//
//
int BootOptions_tests()
{
@ -176,22 +12,6 @@ int BootOptions_tests()
// printf("XStringW_tests -> Enter\n");
#endif
{
CHAR16* LoadOptions = NULL;
LoadOptions = Old1_AddLoadOption(LoadOptions, L"opt1");
LoadOptions = Old1_AddLoadOption(LoadOptions, L"opt2");
LoadOptions = Old1_AddLoadOption(LoadOptions, L"opt3");
if ( XString8().takeValueFrom(LoadOptions) != "opt1 opt2 opt3"_XS8 ) return 1;
CHAR16* LoadOptions1 = Old1_RemoveLoadOption(LoadOptions, L"opt1");
if ( XString8().takeValueFrom(LoadOptions1) != "opt2 opt3"_XS8 ) return 2;
CHAR16* LoadOptions2 = Old1_RemoveLoadOption(LoadOptions, L"opt2");
if ( XString8().takeValueFrom(LoadOptions2) != "opt1 opt3"_XS8 ) return 3;
CHAR16* LoadOptions3 = Old1_RemoveLoadOption(LoadOptions, L"opt3");
if ( XString8().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS8 ) return 4;
}
// {
// XString LoadOptions;
//

View File

@ -1431,12 +1431,16 @@ SimpleString teststartWith_(const InitialValue& initialValue)
);
//initia__String.startWith(subStr);
subStr = initia__String.subString(0, count-1) + ((char32_t)(initialValue.utf32[count-1]+1));
expectedResult = false;
CHECK_RESULT(initia__String.startWith(subStr) == expectedResult,
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
);
if ( count > 0 )
{
char32_t c32 = initialValue.utf32[count-1]+1;
subStr = initia__String.subString(0, count-1) + c32;
expectedResult = false;
CHECK_RESULT(initia__String.startWith(subStr) == expectedResult,
ssprintf("\"%s\".startWith(\"%s\") == %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult),
ssprintf("\"%s\".startWith(\"%s\") != %d", SimpleString(initia__String.s()).c_str(), SimpleString(subStr.s()).c_str(), expectedResult)
);
}
//subStr = initia__String.subString(0, count-1);
//subStr = subStr + ((char32_t)(initialValue.utf32[count-1]+1));
//initia__String.startWith(subStr);
@ -1558,6 +1562,24 @@ int XString_tests()
//testindexOf_<XString>(testStringMultiCoded4CaseArray[0].utf8);
//testTakeValueFrom_<XString16>(testStringMultiCodedArray[0].utf16, testStringMultiCodedArray[0].utf16);
{
char* p = (char*)malloc(11);
strcpy(p, "0123456789");
XString8 t8;
t8.stealValueFrom(p);
char* p2 = (char*)malloc(11);
strcpy(p2, "9876543210");
t8.stealValueFrom(p2);
}
{
char16_t* p16 = (char16_t*)malloc(11*sizeof(char16_t));
memcpy((char*)p16, (char*)u"0123456789", 11*sizeof(char16_t));
XString16 t16;
t16.stealValueFrom(p16);
}
TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
TEST_ALL_CLASSES(testEmpty, __TEST0);
TEST_ALL_CLASSES(testTakeValueFrom, TEST_ALL_UTF);

View File

@ -16,7 +16,6 @@
#include "XToolsCommon_test.h"
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
#include "poolprint-test.h"
#include "printlib-test.h"
#endif
@ -61,11 +60,6 @@ bool all_tests()
printf("printlib_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = poolprint_tests();
if ( ret != 0 ) {
printf("poolprint_tests() failed at test %d\n", ret);
all_ok = false;
}
#endif
#ifndef _MSC_VER
ret = printf_lite_tests();

View File

@ -1,12 +0,0 @@
#define F(x) x
#define LF(x) L##x
#define PRIF "%a"
#define PRILF "%s"
#define loggf(...) printf(__VA_ARGS__)
//#define loggf(...) printf(__VA_ARGS__)
#define DISPLAY_ONLY_FAILED
//#define DISPLAY_START_INFO

View File

@ -1,253 +0,0 @@
//
// main.cpp
// Printf-UnitTests
//
// Created by Jief on 29/08/17.
// Copyright © 2017 Jief. All rights reserved.
//
#include <Platform.h>
#include <limits.h>
#include "../cpp_foundation/unicode_conversions.h"
#include <poolprint-test-cpp_conf.h>
#include "poolprint-test.h"
static int nbTestFailed = 0;
#ifdef DISPLAY_ONLY_FAILED
static bool displayOnlyFailed = true;
#else
static bool displayOnlyFailed = false;
#endif
/*
* Print wchar string as a utf8 string.
* This eliminate all problems about wprintf and compilation with short-wchar or long-wchar I had on macOs (2020-03)
*/
static void print_wchar_string(const wchar_t* s)
{
// char utf8[wchar_len(s)*4+1];
// some compiler doesn't like variable length array.
// use a fixed length instead.
char utf8[200];
utf8_string_from_wchar_string(utf8, sizeof(utf8), s);
if ( strlen(utf8) > sizeof(utf8)-2 ) {
loggf("fixed size buf not big enough");
abort();
}
loggf("%s", utf8);
}
VOID
EFIAPI
_PoolCatPrint (
IN CONST CHAR16 *fmt,
IN VA_LIST args,
IN OUT POOL_PRINT *spc,
IN EFI_STATUS
(EFIAPI
*Output)
(
POOL_PRINT *context,
CHAR16 *str
)
);
static int testWPrintf(const char* label, const wchar_t* expectResult, int expectedRet, const wchar_t* format, ...) /*__attribute__((format(printf, 4, 5)))*/;
static int testWPrintf(const char* label, const wchar_t* expectResult, int expectedRet, const wchar_t* format, ...)
{
POOL_PRINT spc;
ZeroMem (&spc, sizeof (spc));
va_list valist;
va_start(valist, format);
// int vsnwprintf_ret = PRINTF_FUNCTION_NAME(PRINTF_CFUNCTION_PREFIX, vsnwprint, PRINTF_CFUNCTION_SUFFIX)(wbuf, sizeof(wbuf)/sizeof(wchar_t), format, valist);
_PoolCatPrint (format, valist, &spc, _PoolPrint);
wchar_t* wbuf = spc.Str;
va_end(valist);
//delay_ms(10);
if ( memcmp(wbuf, expectResult, size_of_utf_string(expectResult)*sizeof(expectResult[0])) != 0 ) {
// loggf(F(" -> ERROR. Expect " PRILF " and get %ls\n"), expectResult, buf);
// not using wprintf, it crashes sometimes, it doesn't work for short-wchar
loggf(F("%s -> ERROR. Expect "), label);
print_wchar_string(expectResult);
loggf(F(" and get "));
print_wchar_string(wbuf);
loggf("\n");
nbTestFailed += 1;
va_start(valist, format);
_PoolCatPrint (format, valist, &spc, _PoolPrint); // for stepping with a debugger.
va_end(valist);
}else if ( !displayOnlyFailed ) {
loggf(F("%s : "), label);
print_wchar_string(wbuf);
loggf(F(" -> OK\n"));
}
//delay_ms(10);
return 1;
}
#define Test1arg(expectResult,format,c) \
{ \
/* char label[1024]; // Visual studio generates __chkstk if declared here */\
snprintf(label, sizeof(label), F("Test swprintf(%s, %s)"), F(#format), F(#c)); \
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c); \
}
#define Test2arg(expectResult,format,c,d) \
{ \
/* char label[1024]; // Visual studio generates __chkstk if declared here */\
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d); \
}
#define Test5arg(expectResult,format,c,d,e,f,g) \
{ \
/* char label[1024]; // Visual studio generates __chkstk if declared here */\
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d,e,f,g); \
}
int poolprint_tests(void)
{
char label[1024]; // to avoid __chkstk problem in Visual studio, label is declared here to be used in TestArg macros
#ifdef DISPLAY_START_INFO
loggf(F("\n"));
loggf(F("Printf unit test\n"));
loggf(F("\n"));
loggf(F("\n"));
// These depends on the plateform. They are not printf unit test, but it's nice to check size of builtin type.
loggf(F("sizeof(float)=%lu\n"), sizeof(float));
loggf(F("sizeof(double)=%zu\n"), sizeof(double));
loggf(F("sizeof(short int)=%zu\n"), sizeof(short int));
loggf(F("sizeof(int)=%zu\n"), sizeof(int));
loggf(F("sizeof(long int)=%zu\n"), sizeof(long int));// long is 64 bits
loggf(F("sizeof(long long int)=%zu\n"), sizeof(long long int));
loggf(F("sizeof(size_t)=%zu=%zu\n"), sizeof(size_t), sizeof(size_t));
loggf(F("sizeof(size_t)=%zu=%zu\n"), sizeof(size_t), sizeof(size_t));
loggf(F("sizeof(void*)=%zu\n"), sizeof(void*));
loggf(F("UINT64_MAX=%llu\n"), UINT64_MAX);
loggf(F("SIZE_T_MAX=%zu\n"), SIZE_T_MAX);
loggf(F("\n"));
loggf(F("PRId16=%a\n"), PRId16);
loggf(F("PRIu16=%a\n"), PRIu16);
loggf(F("PRId32=%a\n"), PRId32);
loggf(F("PRIu32=%a\n"), PRIu32);
loggf(F("PRId32=%a\n"), PRId32);
loggf(F("PRIu32=%a\n"), PRIu32);
loggf(F("PRId64=%a\n"), PRId64);
loggf(F("PRIu64=%a\n"), PRIu64);
loggf(F("\n"));
#endif
// char buf[256];
// snprintf(buf, sizeof(buf), "test %a", "ascii");
// wprintf(L"%llS", (int)4); doesn't check format
// printf("%ls", (char32_t)4);
// in testPrintf functions, buffer is only 40 bytes, to be able to test vsnwprintf truncate correctly.
//
// const char* utf8 = "Āࠀ𐀀Выходиз";
// const wchar_t* unicode = L"Āࠀ𐀀Выходиз";
//printf("%ls %r\n", "foo", 1);
//testWPrintf("", F(L"Āࠀ𐀀🧊Выход'utf16'из"), F("Āࠀ𐀀🧊Выход'%a'из"), "utf16");
Test1arg(F("'utf8-string'"), F("'%a'"), "utf8-string");
Test1arg(F("'utf16-string'"), F("'%ls'"), L"utf16-string");
Test1arg(F("Āࠀ𐀀🧊Выход'utf8'из"), F("Āࠀ𐀀🧊Выход'%a'из"), "utf8");
Test1arg(F("Āࠀ𐀀🧊Выход'utf16'из"), F("Āࠀ𐀀🧊Выход'%ls'из"), L"utf16");
// Test1arg(F("Āࠀ𐀀🧊Выхо'ыход'из"), F("Āࠀ𐀀🧊Выхо'%a'из"), "ыход"); // utf8 chars seems not working with PoolPrint
Test1arg(F("Āࠀ𐀀🧊Выхо'ыход'из"), F("Āࠀ𐀀🧊Выхо'%ls'из"), L"ыход");
// These must always works. It also test that integer type are well defined
Test1arg(F("sizeof(uint8_t)=1"), F("sizeof(uint8_t)=%d"), sizeof(uint8_t)); // %zu not supported by PoolPrint
Test1arg(F("sizeof(uint16_t)=2"), F("sizeof(uint16_t)=%d"), sizeof(uint16_t));
Test1arg(F("sizeof(uint32_t)=4"), F("sizeof(uint32_t)=%d"), sizeof(uint32_t));
Test1arg(F("sizeof(uint64_t)=8"), F("sizeof(uint64_t)=%d"), sizeof(uint64_t));
Test1arg(F("sizeof(int8_t)=1"), F("sizeof(int8_t)=%d"), sizeof(int8_t));
Test1arg(F("sizeof(int16_t)=2"), F("sizeof(int16_t)=%d"), sizeof(int16_t));
Test1arg(F("sizeof(int32_t)=4"), F("sizeof(int32_t)=%d"), sizeof(int32_t));
Test1arg(F("sizeof(int64_t)=8"), F("sizeof(int64_t)=%d"), sizeof(int64_t));
// loggf(F("\n"));
// Test5arg(F("12 34 56.67 hi X"), F("%d %u %.2lf %a %c"), 12, 34, 56.67, "hi", 'X'); // %f, %u not supported by PoolPrint
Test5arg(F("12 34 hi X 0"), F("%d %d %a %c %d"), 12, 34, "hi", 'X', 0); // %f, %u not supported by PoolPrint
// %u not supported by PoolPrint
// %f not supported by PoolPrint
// test format
Test1arg(F("12"), F("%d"), 12);
Test1arg(F("|A|"), F("|%x|"), 0xA); // %x for PoolPrint is %X for printf
Test1arg(F("|AB|"), F("|%x|"), 0xAB); // %x for PoolPrint is %X for printf
Test1arg(F("|ABF|"), F("|%x|"), 0xABF); // %x for PoolPrint is %X for printf
Test1arg(F("|ABFE|"), F("|%x|"), 0xABFE); // %x for PoolPrint is %X for printf
Test1arg(F("|ABFED|"), F("|%x|"), 0xABFED); // %x for PoolPrint is %X for printf
Test1arg(F("|00000ABF|"), F("|%X|"), 0xABF); // %X for PoolPrint is %08X for printf, length specifier is ignored
// test with specifier, space as pad char
Test1arg(F("| 0|"), F("|%5d|"), 0);
Test1arg(F("| 0|"), F("|%5x|"), 0); // %x for PoolPrint is %X for printf
Test1arg(F("|00000000|"), F("|%5X|"), 0); // %X means %08X, length specifier is ignored
// test with specifier too small, space as pad char
Test1arg(F("|1234|"), F("|%2d|"), 1234); // keep under 16 bit value, if not, on 16 bits CPU, the constant become long int and doesn't match %d
Test1arg(F("|ABFE|"), F("|%2x|"), 0xABFE); // %x for PoolPrint is %X for printf
Test1arg(F("|0000ABFE|"), F("|%2X|"), 0xABFE); // %X for PoolPrint is %08X for printf, length specifier is ignored
// test test with specifier, space as pad char
Test1arg(F("| 12|"), F("|%5d|"), 12);
Test1arg(F("| C|"), F("|%5x|"), 12); // %x for PoolPrint is %X for printf
Test1arg(F("|0000000C|"), F("|%5X|"), 12); // %X for PoolPrint is %08X for printf, length specifier is ignored
// test with specifier, 0 as pad char
Test1arg(F("|00012|"), F("|%05d|"), 12);
Test1arg(F("|0000C|"), F("|%05x|"), 12); // %x for PoolPrint is %X for printf
Test1arg(F("|0000000C|"), F("|%05X|"), 12); // %X for PoolPrint is %08X for printf, length specifier is ignored
// Test %F format
Test2arg(F("Flash string |string1| |striiiing2|"), F("Flash string |" PRIF "| |" PRIF "|"), F("string1"), F("striiiing2"));
// test limits
int16_t i;
i = INT16_MAX; Test1arg(F("INT16_MAX=32767"), F("INT16_MAX=%d"), i);
i = INT16_MIN; Test1arg(F("INT16_MIN=-32768"), F("INT16_MIN=%d"), i);
uint16_t ui16;
ui16 = UINT16_MAX; Test1arg(F("UINT16_MAX=65535"), F("UINT16_MAX=%d"), ui16);
int32_t i32;
i32 = INT32_MAX; Test1arg(F("INT32_MAX=2147483647"), F("INT32_MAX=%d"), i32);
i32 = INT32_MIN; Test1arg(F("INT32_MIN=-2147483648"), F("INT32_MIN=%d"), i32);
// uint32_t ui32;
// ui32 = UINT32_MAX; Test1arg(F("UINT32_MAX=4294967295"), F("UINT32_MAX=%ld"), ui32); // PoolPrint print -1
//
// int64_t i64;
// i64 = INT64_MAX; Test1arg(F("INT64_MAX=9223372036854775807"), F("INT64_MAX=%ld"), i64); // PoolPrint print -1
// i64 = INT64_MIN; Test1arg(F("INT64_MIN=-9223372036854775808"), F("INT64_MIN=%ld"), i64); // PoolPrint print 0
//
// uint64_t ui64;
// ui64 = UINT64_MAX; Test1arg(F("UINT64_MAX=18446744073709551615"), F("UINT64_MAX=%ld" ), ui64); // PoolPrint print -1
return nbTestFailed;
}

View File

@ -1 +0,0 @@
int poolprint_tests();

View File

@ -26,11 +26,16 @@ typedef ctor* ctor_ptr;
#if defined(__clang__)
void construct_globals_objects()
void construct_globals_objects(EFI_HANDLE ImageHandle)
{
EFI_LOADED_IMAGE* LoadedImage;
EFI_STATUS Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if ( EFI_ERROR(Status) ) {
panic("construct_globals_objects: Cannot get LoadedImage protocol");
}
UINT32 PeCoffHeaderOffset = 0;
EFI_IMAGE_DOS_HEADER* DosHdr = (EFI_IMAGE_DOS_HEADER*)SelfLoadedImage->ImageBase;
EFI_IMAGE_DOS_HEADER* DosHdr = (EFI_IMAGE_DOS_HEADER*)LoadedImage->ImageBase;
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
// DOS image header is present, so read the PE header after the DOS image header
PeCoffHeaderOffset = DosHdr->e_lfanew;
@ -38,7 +43,7 @@ void construct_globals_objects()
DBG("ImageContext.PeCoffHeaderOffset: %08X %d\n", PeCoffHeaderOffset, PeCoffHeaderOffset);
EFI_IMAGE_OPTIONAL_HEADER_UNION* ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) (SelfLoadedImage->ImageBase) + PeCoffHeaderOffset);
EFI_IMAGE_OPTIONAL_HEADER_UNION* ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) (LoadedImage->ImageBase) + PeCoffHeaderOffset);
EFI_IMAGE_SECTION_HEADER* SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINTN) ImgHdr + sizeof(UINT32) + sizeof(EFI_IMAGE_FILE_HEADER) + ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader);
for (int Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++)
@ -50,8 +55,8 @@ void construct_globals_objects()
if (strcmp((CONST CHAR8*) SectionHeader->Name, ".ctorss") == 0)
{
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
while (currentCtor < ctorend)
{
DBG("&currentCtor %X %d\n", (UINTN) (currentCtor), (UINTN) (currentCtor));
@ -73,9 +78,10 @@ ctor_ptr* p = (ctor_ptr*)&__beginning_of_section_ctors;
ctor_ptr* pend = (ctor_ptr*)&__end_of_section_ctors;
void construct_globals_objects() {
void construct_globals_objects(EFI_HANDLE ImageHandle)
{
(void)ImageHandle;
DBG("CTOR %X %d\n", (UINTN)p, (UINTN)p);
// DBG("CTOR %X %d\n", (UINTN)p[0], (UINTN)p[0]);
while ( p < pend ) {
DBG("CTOR %X %d\n", (UINTN)p[0], (UINTN)p[0]);
(*p)();

View File

@ -2,4 +2,4 @@
/*
* NOTE : SelfLoadedImage must be initialized to call this.
*/
extern void construct_globals_objects();
extern void construct_globals_objects(EFI_HANDLE ImageHandle);

View File

@ -20,6 +20,20 @@ void* operator new (unsigned long count)
return ptr;
}
#if defined(_MSC_VER)
void* operator new[] (size_t count)
#else
void* operator new[] (unsigned long count)
#endif
{
void* ptr = AllocatePool(count);
if ( !ptr ) {
DebugLog(2, "AllocatePool(%lu) returned NULL. Cpu halted\n", count);
CpuDeadLoop();
}
return ptr;
}
#ifdef _MSC_VER
#pragma warning(disable : 4577)
#endif

View File

@ -39,6 +39,7 @@
#include "../Platform/guid.h"
#include "../Platform/APFS.h"
#include "../Platform/cpu.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_COMMON_MENU 1
@ -394,10 +395,10 @@ BOOLEAN AskUserForFilePathFromVolumes(IN CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_
for (Index = 0; Index < Volumes.size(); ++Index) {
REFIT_VOLUME *Volume = &Volumes[Index];
if ((Volume == NULL) || (Volume->RootDir == NULL) ||
((Volume->DevicePathString == NULL) && (Volume->VolName == NULL))) {
((Volume->DevicePathString.isEmpty()) && (Volume->VolName.isEmpty()))) {
continue;
}
REFIT_SIMPLE_MENU_ENTRY_TAG *Entry = new REFIT_SIMPLE_MENU_ENTRY_TAG(SWPrintf("%ls", (Volume->VolName == NULL) ? Volume->DevicePathString : Volume->VolName), TAG_OFFSET + Index, MENU_EXIT_ENTER);
REFIT_SIMPLE_MENU_ENTRY_TAG *Entry = new REFIT_SIMPLE_MENU_ENTRY_TAG(SWPrintf("%ls", (Volume->VolName.isEmpty()) ? Volume->DevicePathString.wc_str() : Volume->VolName.wc_str()), TAG_OFFSET + Index, MENU_EXIT_ENTER);
Menu.Entries.AddReference(Entry, true);
}
// Setup menu
@ -437,25 +438,23 @@ BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCO
}
if (Root != NULL) {
// Get the file path
CHAR16 *DevicePathStr = FileDevicePathToStr(Root);
if (DevicePathStr != NULL) {
XStringW DevicePathStr = FileDevicePathToXStringW(Root);
if (DevicePathStr.notEmpty()) {
UINTN Index = 0;
// Check the volumes for a match
for (Index = 0; Index < Volumes.size(); ++Index) {
REFIT_VOLUME *Volume = &Volumes[Index];
UINTN Length;
if ((Volume == NULL) || (Volume->RootDir == NULL) ||
(Volume->DevicePathString == NULL)) {
(Volume->DevicePathString.isEmpty())) {
continue;
}
Length = StrLen(Volume->DevicePathString);
if (Length == 0) {
if (Volume->DevicePathString.length() == 0) {
continue;
}
// If the path begins with this volumes path it matches
if (StrniCmp(DevicePathStr, Volume->DevicePathString, Length)) {
if (StrniCmp(DevicePathStr.wc_str(), Volume->DevicePathString.wc_str(), Volume->DevicePathString.length())) {
// Need to
CHAR16 *FilePath = DevicePathStr + Length;
CHAR16 *FilePath = DevicePathStr.data(Volume->DevicePathString.length());
UINTN FileLength = StrLen(FilePath);
if (FileLength == 0) {
// If there is no path left then open the root
@ -488,7 +487,6 @@ BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCO
}
}
}
FreePool(DevicePathStr);
}
}
return AskUserForFilePathFromVolumes(Title, Result);

View File

@ -36,6 +36,7 @@
#include "entry_scan.h"
#include "../refit/screen.h"
#include "../refit/menu.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_SCAN_LEGACY 1
@ -55,7 +56,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
{
LEGACY_ENTRY *Entry, *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
CONST CHAR16 *VolDesc;
XStringW VolDesc;
CHAR16 ShortcutLetter = 0;
// INTN i;
@ -68,7 +69,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
// DBG("entry %lld\n", i);
// Only want legacy
if (MainEntry.getLEGACY_ENTRY()) {
if (StriCmp(MainEntry.getLEGACY_ENTRY()->DevicePathString, Volume->DevicePathString) == 0) {
if (StriCmp(MainEntry.getLEGACY_ENTRY()->DevicePathString.wc_str(), Volume->DevicePathString.wc_str()) == 0) {
return true;
}
}
@ -80,9 +81,9 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
while (Custom) {
if (OSFLAG_ISSET(Custom->Flags, OSFLAG_DISABLED) ||
(OSFLAG_ISSET(Custom->Flags, OSFLAG_HIDDEN) && !gSettings.ShowHiddenEntries)) {
if (Custom->Volume) {
if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
if (Custom->Type != 0) {
if (Custom->Type == Volume->LegacyOS->Type) {
return false;
@ -110,10 +111,10 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
LTitle = L"Legacy OS"_XSW;
} else
LTitle = LoaderTitle;
if (Volume->VolName != NULL)
if (Volume->VolName.notEmpty())
VolDesc = Volume->VolName;
else
VolDesc = (Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : L"HD";
VolDesc.takeValueFrom((Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : L"HD");
//DBG("VolDesc=%ls\n", VolDesc);
// prepare the menu entry
@ -165,10 +166,9 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
Entry->LoadOptions.setEmpty();
Entry->LoadOptions.Add((Volume->DiskKind == DISK_KIND_OPTICAL) ? "CD" : ((Volume->DiskKind == DISK_KIND_EXTERNAL) ? "USB" : "HD"));
// create the submenu
// SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = new REFIT_MENU_SCREEN();
// SubScreen->Title = L"Boot Options for "_XSW + LoaderTitle + L" on "_XSW + VolDesc;
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", LoaderTitle.wc_str(), VolDesc);
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", LoaderTitle.wc_str(), VolDesc.wc_str());
SubScreen->TitleImage = Entry->Image; //it is XIcon
SubScreen->ID = SCREEN_BOOT;
@ -296,13 +296,13 @@ VOID AddCustomLegacy(VOID)
DBG("Custom legacy %llu skipped because it is hidden.\n", i);
continue;
}
if (Custom->Volume) {
DBG("Custom legacy %llu matching \"%ls\" ...\n", i, Custom->Volume);
if (Custom->Volume.notEmpty()) {
DBG("Custom legacy %llu matching \"%ls\" ...\n", i, Custom->Volume.wc_str());
}
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) {
Volume = &Volumes[VolumeIndex];
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString);
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName.wc_str(), Volume->DevicePathString.wc_str());
// skip volume if its kind is configured as disabled
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0)
@ -356,9 +356,9 @@ VOID AddCustomLegacy(VOID)
}
// Check for exact volume matches
if (Custom->Volume) {
if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
DBG("skipped\n");
continue;
}

View File

@ -403,16 +403,15 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
EFI_STATUS Status = EFI_NOT_FOUND;
CONST CHAR16* targetNameFile = L"\\System\\Library\\CoreServices\\.disk_label.contentDetails";
CHAR8* fileBuffer;
CHAR8* targetString;
UINTN fileLen = 0;
if(FileExists(Entry->Volume->RootDir, targetNameFile)) {
Status = egLoadFile(Entry->Volume->RootDir, targetNameFile, (UINT8 **)&fileBuffer, &fileLen);
if(!EFI_ERROR(Status)) {
CHAR16 *tmpName;
// CHAR16 *tmpName;
//Create null terminated string
targetString = (CHAR8*) AllocateZeroPool(fileLen+1);
CopyMem( (VOID*)targetString, (VOID*)fileBuffer, fileLen);
DBG("found disk_label with contents:%s\n", targetString);
// targetString = (CHAR8*) A_llocateZeroPool(fileLen+1);
// CopyMem( (VOID*)targetString, (VOID*)fileBuffer, fileLen);
// DBG("found disk_label with contents:%s\n", targetString);
// NOTE: Sothor - This was never run. If we need this correct it and uncomment it.
// if (Entry->LoaderType == OSTYPE_OSX) {
@ -427,16 +426,14 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
// }
// }
//Convert to Unicode
tmpName = (CHAR16*)AllocateZeroPool((fileLen+1)*2);
AsciiStrToUnicodeStrS(targetString, tmpName, fileLen);
// //Convert to Unicode
// tmpName = (CHAR16*)A_llocateZeroPool((fileLen+1)*2);
// AsciiStrToUnicodeStrS(targetString, tmpName, fileLen);
Entry->VolName = EfiStrDuplicate(tmpName);
DBG("Created name:%ls\n", Entry->VolName);
Entry->VolName.strncpy(fileBuffer, fileLen);
DBG("Created name:%ls\n", Entry->VolName.wc_str());
FreePool(tmpName);
FreePool(fileBuffer);
FreePool(targetString);
}
}
return Status;
@ -459,8 +456,8 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
IN BOOLEAN CustomEntry)
{
EFI_DEVICE_PATH *LoaderDevicePath;
CONST CHAR16 *LoaderDevicePathString;
CONST CHAR16 *FilePathAsString;
XStringW LoaderDevicePathString;
XStringW FilePathAsString;
// CONST CHAR16 *OSIconName = NULL;
CHAR16 ShortcutLetter;
LOADER_ENTRY *Entry;
@ -476,19 +473,17 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
if (LoaderDevicePath == NULL) {
return NULL;
}
LoaderDevicePathString = FileDevicePathToStr(LoaderDevicePath);
if (LoaderDevicePathString == NULL) {
LoaderDevicePathString = FileDevicePathToXStringW(LoaderDevicePath);
if (LoaderDevicePathString.isEmpty()) {
return NULL;
}
// Ignore this loader if it's self path
FilePathAsString = FileDevicePathToStr(SelfFullDevicePath);
if (FilePathAsString) {
INTN Comparison = StriCmp(FilePathAsString, LoaderDevicePathString);
FreePool(FilePathAsString);
FilePathAsString = FileDevicePathToXStringW(SelfFullDevicePath);
if (FilePathAsString.notEmpty()) {
INTN Comparison = StriCmp(FilePathAsString.wc_str(), LoaderDevicePathString.wc_str());
if (Comparison == 0) {
DBG("%s skipped because path `%ls` is self path!\n", indent, LoaderDevicePathString);
FreePool(LoaderDevicePathString);
DBG("%s skipped because path `%ls` is self path!\n", indent, LoaderDevicePathString.wc_str());
return NULL;
}
}
@ -502,9 +497,8 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i];
// Only want loaders
if (MainEntry.getLOADER_ENTRY()) {
if (StriCmp(MainEntry.getLOADER_ENTRY()->DevicePathString, LoaderDevicePathString) == 0) {
DBG("%s skipped because path `%ls` already exists for another entry!\n", indent, LoaderDevicePathString);
FreePool(LoaderDevicePathString);
if (StriCmp(MainEntry.getLOADER_ENTRY()->DevicePathString.wc_str(), LoaderDevicePathString.wc_str()) == 0) {
DBG("%s skipped because path `%ls` already exists for another entry!\n", indent, LoaderDevicePathString.wc_str());
return NULL;
}
}
@ -522,11 +516,11 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
INTN type_match=0;
// Check if volume match
if (Custom->Volume != NULL) {
if (Custom->Volume.notEmpty()) {
// Check if the string matches the volume
volume_match =
((StrStr(Volume->DevicePathString, Custom->Volume) != NULL) ||
((Volume->VolName != NULL) && (StrStr(Volume->VolName, Custom->Volume) != NULL))) ? 1 : -1;
((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) != NULL) ||
((Volume->VolName.notEmpty()) && (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) != NULL))) ? 1 : -1;
}
// Check if the volume_type match
@ -574,7 +568,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
} else {
// Custom entry match
DBG("%sSkipped because matching custom entry %llu!\n", indent, CustomIndex);
FreePool(LoaderDevicePathString);
return NULL;
}
}
@ -640,7 +633,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
}
ShortcutLetter = 'M';
if ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) {
if ( Entry->VolName.isEmpty() ) {
// else no sense to override it with dubious name
GetOSXVolumeName(Entry);
}
@ -678,18 +671,18 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
//DBG("OSIconName=%ls \n", OSIconName);
Entry->Title = FullTitle;
if (Entry->Title.isEmpty() && Volume->VolLabel != NULL) {
if (Entry->Title.isEmpty() && Volume->VolLabel.notEmpty()) {
if (Volume->VolLabel[0] == L'#') {
Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(), Volume->VolLabel+1);
Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(), Volume->VolLabel.data(1));
}else{
Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(), Volume->VolLabel);
Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(), Volume->VolLabel.wc_str());
}
}
BOOLEAN BootCampStyle = ThemeX.BootCampStyle;
if ( Entry->Title.isEmpty() && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) {
XStringW BasenameXW = XStringW(Basename(Volume->DevicePathString));
if ( Entry->Title.isEmpty() && Entry->VolName.isEmpty() ) {
XStringW BasenameXW = XStringW(Basename(Volume->DevicePathString.wc_str()));
// DBG("encounter Entry->VolName ==%ls and StrLen(Entry->VolName) ==%llu\n",Entry->VolName, StrLen(Entry->VolName));
if (BootCampStyle) {
if (!LoaderTitle.isEmpty()) {
@ -717,7 +710,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
} else {
Entry->Title.SWPrintf("Boot %ls from %ls", (!LoaderTitle.isEmpty()) ? LoaderTitle.wc_str() : LoaderPath.basename().wc_str(),
Entry->VolName);
Entry->VolName.wc_str());
}
}
// DBG("Entry->Title =%ls\n", Entry->Title.wc_str());
@ -768,7 +761,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
#ifdef DUMP_KERNEL_KEXT_PATCHES
DumpKernelAndKextPatches(Entry->KernelAndKextPatches);
#endif
DBG("%sLoader entry created for '%ls'\n", indent, Entry->DevicePathString);
DBG("%sLoader entry created for '%ls'\n", indent, Entry->DevicePathString.wc_str());
return Entry;
}
@ -798,9 +791,8 @@ void LOADER_ENTRY::AddDefaultMenu()
FileName = LoaderPath.basename();
// create the submenu
// SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = new REFIT_MENU_SCREEN;
SubScreen->Title.SWPrintf("Options for %ls on %ls", Title.wc_str(), VolName);
SubScreen->Title.SWPrintf("Options for %ls on %ls", Title.wc_str(), VolName.wc_str());
SubScreen->TitleImage = Image;
SubScreen->ID = LoaderType + 20; //wow
@ -808,13 +800,13 @@ void LOADER_ENTRY::AddDefaultMenu()
SubScreen->GetAnime();
VolumeSize = RShiftU64(MultU64x32(Volume->BlockIO->Media->LastBlock, Volume->BlockIO->Media->BlockSize), 20);
SubScreen->AddMenuInfoLine_f("Volume size: %lluMb", VolumeSize);
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(DevicePath));
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToXStringW(DevicePath).wc_str());
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (Guid) {
SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid));
}
if ( Volume->ApfsFileSystemUUID.notEmpty() || APFSTargetUUID.notEmpty() ) {
SubScreen->AddMenuInfoLine_f("APFS volume name: %ls", VolName);
SubScreen->AddMenuInfoLine_f("APFS volume name: %ls", VolName.wc_str());
}
if ( Volume->ApfsFileSystemUUID.notEmpty() ) {
SubScreen->AddMenuInfoLine_f("APFS File System UUID: %s", Volume->ApfsFileSystemUUID.c_str());
@ -1010,7 +1002,7 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArra
return NULL;
}
DBG(" AddLoaderEntry for Volume Name=%ls\n", Volume->VolName);
DBG(" AddLoaderEntry for Volume Name=%ls\n", Volume->VolName.wc_str());
if (OSFLAG_ISSET(Flags, OSFLAG_DISABLED)) {
DBG(" skipped because entry is disabled\n");
return NULL;
@ -1335,9 +1327,9 @@ VOID ScanLoader(VOID)
//DBG(", no file system\n", VolumeIndex);
continue;
}
DBG("- [%02llu]: '%ls'", VolumeIndex, Volume->VolName);
if (Volume->VolName == NULL) {
Volume->VolName = L"Unknown";
DBG("- [%02llu]: '%ls'", VolumeIndex, Volume->VolName.wc_str());
if (Volume->VolName.isEmpty()) {
Volume->VolName = L"Unknown"_XSW;
}
// skip volume if its kind is configured as disabled
@ -1398,7 +1390,7 @@ VOID ScanLoader(VOID)
} else if (FileExists(Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
FileExists(Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
FileExists(Volume->RootDir, L"\\com.apple.boot.S\\System\\Library\\PrelinkedKernels\\prelinkedkernel")) {
if (StriStr(Volume->VolName, L"Recovery") != NULL) {
if (StriStr(Volume->VolName.wc_str(), L"Recovery") != NULL) {
// FileVault of HFS+
// TODO: need info for 10.11 and lower
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"macOS FileVault"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
@ -1489,9 +1481,9 @@ VOID ScanLoader(VOID)
//DBG(", no file system\n", VolumeIndex);
continue;
}
DBG("- [%02llu]: '%ls'", VolumeIndex, Volume->VolName);
if (Volume->VolName == NULL) {
Volume->VolName = L"Unknown";
DBG("- [%02llu]: '%ls'", VolumeIndex, Volume->VolName.wc_str());
if (Volume->VolName.isEmpty()) {
Volume->VolName = L"Unknown"_XSW;
}
// skip volume if its kind is configured as disabled
@ -1526,9 +1518,9 @@ VOID ScanLoader(VOID)
}
}
if ( targetLoaderEntry ) {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetLoaderEntry->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, OSFLAG_HIDDEN);
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, OSFLAG_HIDDEN);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
}
@ -1543,15 +1535,15 @@ VOID ScanLoader(VOID)
}
}
if ( targetVolume ) {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetVolume->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetVolume->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Install for %ls via %ls", targetVolume->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Install for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
} else {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, L""_XSW, L"FileVault Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName, Volume->VolName), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
}
@ -1633,11 +1625,11 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
if ((Volume == NULL) || (Volume->RootDir == NULL)) {
continue;
}
if (Volume->VolName == NULL) {
Volume->VolName = L"Unknown";
if (Volume->VolName.isEmpty()) {
Volume->VolName = L"Unknown"_XSW;
}
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString);
DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName.wc_str(), Volume->DevicePathString.wc_str());
// skip volume if its kind is configured as disabled
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) {
@ -1656,9 +1648,9 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
// Check for exact volume matches (devicepath / volumelabel)
if (Custom->Volume) {
if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
DBG("skipped because volume does not match\n");
continue;
}
@ -1709,7 +1701,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
// Change to custom image if needed
if (Image.isEmpty() && Custom->ImagePath) {
if (Image.isEmpty() && Custom->ImagePath.notEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
if (Image.isEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + Custom->ImagePath);
@ -1726,7 +1718,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
// Change to custom drive image if needed
if (DriveImage.isEmpty() && Custom->DriveImagePath) {
if (DriveImage.isEmpty() && Custom->DriveImagePath.notEmpty()) {
DriveImage.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
if (DriveImage.isEmpty()) {
DriveImage.LoadXImage(SelfDir, Custom->ImagePath);
@ -1785,7 +1777,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
// Check if the volume string matches
if (Custom->Volume != Ptr->Volume) {
if (Ptr->Volume == NULL) {
if (Ptr->Volume.isEmpty()) {
// Less precise volume match
if (Custom->Path != Ptr->Path) {
// Better path match
@ -1793,9 +1785,9 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
((Custom->VolumeType == Ptr->VolumeType) ||
((1ull<<Volume->DiskKind) & Custom->VolumeType) != 0));
}
} else if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
if (Custom->Volume == NULL) {
} else if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
if (Custom->Volume.isEmpty()) {
// More precise volume match
if (Custom->Path != Ptr->Path) {
// Better path match
@ -1872,7 +1864,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
Custom->Type, Custom->Flags, Custom->Hotkey, Custom->BootBgColor, Custom->CustomBoot, &Custom->CustomLogo,
/*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE);
if (Entry != NULL) {
DBG("Custom settings: %ls.plist will %s be applied\n", Custom->Settings, Custom->CommonSettings?"not":"");
DBG("Custom settings: %ls.plist will %s be applied\n", Custom->Settings.wc_str(), Custom->CommonSettings?"not":"");
if (!Custom->CommonSettings) {
Entry->Settings = Custom->Settings;
}
@ -1881,23 +1873,22 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
} else if (Custom->SubEntries != NULL) {
UINTN CustomSubIndex = 0;
// Add subscreen
// REFIT_MENU_SCREEN *SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
REFIT_MENU_SCREEN *SubScreen = new REFIT_MENU_SCREEN;
if (SubScreen) {
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title.notEmpty()) ? Custom->Title.wc_str() : CustomPath.wc_str(), Entry->VolName);
SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title.notEmpty()) ? Custom->Title.wc_str() : CustomPath.wc_str(), Entry->VolName.wc_str());
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = Custom->Type + 20;
SubScreen->GetAnime();
VolumeSize = RShiftU64(MultU64x32(Volume->BlockIO->Media->LastBlock, Volume->BlockIO->Media->BlockSize), 20);
SubScreen->AddMenuInfoLine_f("Volume size: %lldMb", VolumeSize);
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(Entry->DevicePath));
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToXStringW(Entry->DevicePath).wc_str());
if (Guid) {
SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid));
}
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS8).c_str());
DBG("Create sub entries\n");
for (CustomSubEntry = Custom->SubEntries; CustomSubEntry; CustomSubEntry = CustomSubEntry->Next) {
if (!CustomSubEntry->Settings) {
if ( CustomSubEntry->Settings.isEmpty() ) {
CustomSubEntry->Settings = Custom->Settings;
}
AddCustomEntry(CustomSubIndex++, (CustomSubEntry->Path.notEmpty()) ? CustomSubEntry->Path : CustomPath, CustomSubEntry, SubScreen);

View File

@ -125,7 +125,7 @@ static EFI_STATUS AddLockedGraphicsGOP(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent
}
// Create a new locked graphics if needed
if (Ptr == NULL) {
Ptr = (LOCKED_GRAPHICS *)AllocateZeroPool(sizeof(LOCKED_GRAPHICS));
Ptr = (LOCKED_GRAPHICS *)BllocateZeroPool(sizeof(LOCKED_GRAPHICS));
if (Ptr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -319,7 +319,7 @@ static EFI_STATUS AddLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent
}
// Create a new locked graphics if needed
if (Ptr == NULL) {
Ptr = (LOCKED_GRAPHICS *)AllocateZeroPool(sizeof(LOCKED_GRAPHICS));
Ptr = (LOCKED_GRAPHICS *)BllocateZeroPool(sizeof(LOCKED_GRAPHICS));
if (Ptr == NULL) {
return EFI_OUT_OF_RESOURCES;
}

View File

@ -59,7 +59,7 @@ VOID EnableSecureBoot(VOID)
{
EFI_STATUS Status = EFI_NOT_FOUND;
BOOLEAN WantDefaultKeys;
CHAR16 *ErrorString = NULL;
CONST CHAR16 *ErrorString = NULL;
UINTN CloverSignatureSize = 0;
VOID *CloverSignature = NULL;
// Check in setup mode
@ -122,12 +122,9 @@ VOID EnableSecureBoot(VOID)
}
}
if (EFI_ERROR(Status)) {
CHAR16 *Str = PoolPrint(L"Enabling secure boot failed because\n%s", ErrorString);
if (Str != NULL) {
AlertMessage(L"Enable Secure Boot", Str);
FreePool(Str);
}
DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString, strerror(Status));
XStringW Str = SWPrintf("Enabling secure boot failed because\n%ls", ErrorString);
AlertMessage(L"Enable Secure Boot", Str);
DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString.wc_str(), strerror(Status));
DisableSecureBoot();
}
}
@ -167,20 +164,14 @@ STATIC VOID DisableMessage(IN EFI_STATUS Status,
IN CHAR16 *String,
IN CHAR16 *ErrorString)
{
CHAR16 *Str = NULL;
XStringW Str;
if (ErrorString != NULL) {
Str = PoolPrint(L"%s\n%s\n%s", String, ErrorString, strerror(Status));
Str = SWPrintf(L"%ls\n%ls\n%ls", String, ErrorString, strerror(Status));
} else {
Str = PoolPrint(L"%s\n%s", String, strerror(Status));
}
if (Str != NULL) {
DBG("Secure Boot: %ls", Str);
AlertMessage(L"Disable Secure Boot", Str);
FreePool(Str);
} else {
DBG("Secure Boot: %ls", String);
AlertMessage(L"Disable Secure Boot", String);
Str = SWPrintf(L"%s\n%s", String, strerror(Status));
}
DBG("Secure Boot: %ls", Str.wc_str());
AlertMessage(L"Disable Secure Boot", Str);
}
// Disable secure boot

View File

@ -130,7 +130,7 @@ STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureLis
OldSignatureList = *SignatureList;
if (OldSignatureList == NULL) {
// There is no list so create a new signature list
NewSignatureList = (EFI_SIGNATURE_LIST *)AllocateZeroPool(sizeof(EFI_SIGNATURE_LIST) + DataSize);
NewSignatureList = (EFI_SIGNATURE_LIST *)BllocateZeroPool(sizeof(EFI_SIGNATURE_LIST) + DataSize);
if (NewSignatureList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -162,7 +162,7 @@ STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureLis
Ptr += OldSignatureList->SignatureSize;
}
// Create a new list for signatures
NewSignatureList = (EFI_SIGNATURE_LIST *)AllocateZeroPool(OldSignatureList->SignatureListSize + DataSize);
NewSignatureList = (EFI_SIGNATURE_LIST *)BllocateZeroPool(OldSignatureList->SignatureListSize + DataSize);
if (NewSignatureList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -666,7 +666,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
SectionPtr = (EFI_IMAGE_SECTION_HEADER *)(ImageBase + PeHeaderOffset + sizeof(EFI_IMAGE_FILE_HEADER) +
sizeof(UINT32) + PeHeader.Pe32->FileHeader.SizeOfOptionalHeader);
// Allocate a new array for the image section headers
Sections = (__typeof__(Sections))AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
Sections = (__typeof__(Sections))BllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
if (Sections == NULL) {
goto Failed;
}
@ -711,7 +711,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
}
// Create the signature list
Size = (sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_GUID) + 256);
Database = (__typeof__(Database))AllocateZeroPool(Size);
Database = (__typeof__(Database))BllocateZeroPool(Size);
if (Database == NULL) {
goto Failed;
}

View File

@ -64,7 +64,6 @@ VOID AddSecureBootTool(VOID)
if (!gSettings.SecureBoot && !gSettings.SecureBootSetupMode) {
return;
}
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (gSettings.SecureBoot) {
Entry = new REFIT_MENU_ENTRY_SECURE_BOOT();
Entry->Title.SWPrintf("Clover Secure Boot Configuration");
@ -269,18 +268,12 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De
if (DevicePathStr != NULL) {
CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (FileDevicePathStr != NULL) {
CHAR16 *Str = PoolPrint(L"%s\n%s\n%s", ErrorString, DevicePathStr, FileDevicePathStr);
if (Str != NULL) {
AlertMessage(L"Insert Image Authentication", Str);
FreePool(Str);
}
XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr);
AlertMessage(L"Insert Image Authentication", Str);
FreePool(FileDevicePathStr);
} else {
CHAR16 *Str = PoolPrint(L"%s\n%s", ErrorString, DevicePathStr);
if (Str != NULL) {
AlertMessage(L"Insert Image Authentication", Str);
FreePool(Str);
}
XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr);
AlertMessage(L"Insert Image Authentication", Str);
}
FreePool(DevicePathStr);
} else {
@ -350,18 +343,12 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *
if (DevicePathStr != NULL) {
CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (FileDevicePathStr != NULL) {
CHAR16 *Str = PoolPrint(L"%s\n%s\n%s", ErrorString, DevicePathStr, FileDevicePathStr);
if (Str != NULL) {
AlertMessage(L"Remove Image Authentication", Str);
FreePool(Str);
}
XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr);
AlertMessage(L"Remove Image Authentication", Str);
FreePool(FileDevicePathStr);
} else {
CHAR16 *Str = PoolPrint(L"%s\n%s", ErrorString, DevicePathStr);
if (Str != NULL) {
AlertMessage(L"Remove Image Authentication", Str);
FreePool(Str);
}
XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr);
AlertMessage(L"Remove Image Authentication", Str);
}
FreePool(DevicePathStr);
} else {

View File

@ -250,7 +250,7 @@ VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
return NULL;
}
// Allocate a buffer large enough to hold the database
Database = (__typeof__(Database))AllocateZeroPool(Size);
Database = (__typeof__(Database))BllocateZeroPool(Size);
if (Database == NULL) {
return NULL;
}
@ -453,7 +453,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
EVP_PKEY_free(PrivateKey);
DataSize = i2d_PKCS7(p7, NULL);
Data = (__typeof__(Data))AllocateZeroPool(DataSize);
Data = (__typeof__(Data))BllocateZeroPool(DataSize);
i2d_PKCS7(p7, (unsigned char **)&Data);
@ -468,7 +468,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
}
// Create the authentication buffer
DBG("Creating authentication ...\n");
Authentication = (EFI_VARIABLE_AUTHENTICATION_2 *)AllocateZeroPool(Size);
Authentication = (EFI_VARIABLE_AUTHENTICATION_2 *)BllocateZeroPool(Size);
if (Authentication == NULL) {
if (Data != NULL) {
FreePool(Data);

View File

@ -84,7 +84,6 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full
return FALSE;
}
// Allocate the entry
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(*Entry));
Entry = new REFIT_MENU_ENTRY_LOADER_TOOL();
if (Entry == NULL) {
return FALSE;
@ -102,7 +101,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full
// Entry->ImageHover = ImageHover;
Entry->LoaderPath = LoaderPath;
Entry->DevicePath = FileDevicePath(Volume->DeviceHandle, Entry->LoaderPath);
Entry->DevicePathString = FileDevicePathToStr(Entry->DevicePath);
Entry->DevicePathString = FileDevicePathToXStringW(Entry->DevicePath);
Entry->LoadOptions = Options;
//actions
Entry->AtClick = ActionSelect;
@ -122,7 +121,6 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
// EFI_STATUS Status;
// prepare the menu entry
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(*Entry));
Entry = new REFIT_MENU_ENTRY_CLOVER();
Entry->Title.takeValueFrom(LoaderTitle);
// Entry->Tag = TAG_CLOVER;
@ -133,7 +131,7 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
Entry->LoaderPath = LoaderPath;
Entry->VolName = Volume->VolName;
Entry->DevicePath = FileDevicePath(Volume->DeviceHandle, Entry->LoaderPath);
Entry->DevicePathString = FileDevicePathToStr(Entry->DevicePath);
Entry->DevicePathString = FileDevicePathToXStringW(Entry->DevicePath);
Entry->Flags = 0;
Entry->LoadOptions.setEmpty();
// Entry->LoaderType = OSTYPE_OTHER;
@ -144,7 +142,6 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
Entry->AtRightClick = ActionDetails;
// create the submenu
// SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = new REFIT_MENU_SCREEN;
SubScreen->Title.takeValueFrom(LoaderTitle);
@ -152,7 +149,7 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = SCREEN_BOOT;
SubScreen->GetAnime();
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(Volume->DevicePath));
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToXStringW(Volume->DevicePath).wc_str());
if (gEmuVariableControl != NULL) {
gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
@ -255,7 +252,7 @@ VOID AddCustomTool(VOID)
continue;
}
if (Custom->Volume) {
if (Custom->Volume.notEmpty()) {
DBG("Custom tool %llu matching \"%ls\" ...\n", i, Custom->Volume);
}
for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) {
@ -289,9 +286,9 @@ VOID AddCustomTool(VOID)
}
// Check for exact volume matches
if (Custom->Volume) {
if ((StrStr(Volume->DevicePathString, Custom->Volume) == NULL) &&
((Volume->VolName == NULL) || (StrStr(Volume->VolName, Custom->Volume) == NULL))) {
if (Custom->Volume.notEmpty()) {
if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) &&
((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) {
DBG("skipped\n");
continue;
}
@ -303,7 +300,7 @@ VOID AddCustomTool(VOID)
}
// Change to custom image if needed
Image = Custom->Image;
if (Image.isEmpty() && Custom->ImagePath) {
if (Image.isEmpty() && Custom->ImagePath.notEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
}
if (Image.isEmpty()) {

View File

@ -53,6 +53,7 @@
#include "../Platform/AcpiPatcher.h"
#include "../Platform/Nvram.h"
#include "../refit/screen.h"
#include "../Platform/Events.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1
@ -712,7 +713,7 @@ EFI_STATUS REFIT_MENU_SCREEN::WaitForInputEventPoll(UINTN TimeoutDefault)
UINTN TimeoutRemain = TimeoutDefault * 100;
while (TimeoutRemain != 0) {
Status = WaitFor2EventWithTsc (gST->ConIn->WaitForKey, NULL, 10);
Status = WaitFor2EventWithTsc(gST->ConIn->WaitForKey, NULL, 10);
if (Status != EFI_TIMEOUT) {
break;
}
@ -801,7 +802,6 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
}
if (HaveTimeout) {
//TimeoutMessage = PoolPrint(L"%s in %d seconds", TimeoutText.data(), TimeoutCountdown);
XStringW TOMessage = SWPrintf("%ls in %lld seconds", TimeoutText.wc_str(), TimeoutCountdown);
((*this).*(StyleFunc))(MENU_FUNCTION_PAINT_TIMEOUT, TOMessage.data());
}
@ -1087,7 +1087,6 @@ VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
static UINTN TextMenuWidth = 0,ItemWidth = 0, MenuHeight = 0;
static UINTN MenuPosY = 0;
//static CHAR16 **DisplayStrings;
CHAR16 *TimeoutMessage;
CHAR16 ResultString[TITLE_MAX_LEN]; // assume a title max length of around 128
UINTN OldChosenItem = ~(UINTN)0;
@ -1316,9 +1315,8 @@ VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
// paint or update message
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
gST->ConOut->SetCursorPosition (gST->ConOut, 3, ConHeight - 1);
TimeoutMessage = PoolPrint(L"%s ", ParamText);
gST->ConOut->OutputString (gST->ConOut, TimeoutMessage);
FreePool(TimeoutMessage);
XStringW TimeoutMessage = SWPrintf("%ls ", ParamText);
gST->ConOut->OutputString (gST->ConOut, TimeoutMessage.wc_str());
}
break;
@ -1960,12 +1958,11 @@ VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
switch (TextC) {
case TEXT_CORNER_REVISION:
// Display Clover boot volume
if (SelfVolume->VolLabel && SelfVolume->VolLabel[0] != L'#') {
// Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel);
Text = XStringW() + gFirmwareRevision + L", booted from "_XSW + SelfVolume->VolLabel;
if (SelfVolume->VolLabel.notEmpty() && SelfVolume->VolLabel[0] != L'#') {
Text = SWPrintf("%ls, booted from %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str());
}
if (Text.isEmpty()) {
Text = XStringW() + gFirmwareRevision + L" "_XSW + SelfVolume->VolName;
Text = SWPrintf("%ls %ls", gFirmwareRevision, SelfVolume->VolName.wc_str());
}
break;
case TEXT_CORNER_HELP:

View File

@ -49,12 +49,12 @@ REFIT_MENU_ENTRY_CLOVER* REFIT_MENU_ENTRY_CLOVER::getPartiallyDuplicatedEntry()
{
REFIT_MENU_ENTRY_CLOVER* DuplicateEntry = new REFIT_MENU_ENTRY_CLOVER();
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= EfiStrDuplicate(DevicePathString);
DuplicateEntry->LoadOptions = LoadOptions;
DuplicateEntry->LoaderPath = LoaderPath;
DuplicateEntry->VolName = EfiStrDuplicate(VolName);
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= DevicePathString;
DuplicateEntry->LoadOptions = LoadOptions;
DuplicateEntry->LoaderPath = LoaderPath;
DuplicateEntry->VolName = VolName;
DuplicateEntry->DevicePath = DevicePath;
DuplicateEntry->Flags = Flags;
return DuplicateEntry;
@ -64,12 +64,12 @@ LOADER_ENTRY* LOADER_ENTRY::getPartiallyDuplicatedEntry() const
{
LOADER_ENTRY* DuplicateEntry = new LOADER_ENTRY();
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= EfiStrDuplicate(DevicePathString);
DuplicateEntry->LoadOptions = LoadOptions;
DuplicateEntry->LoaderPath = LoaderPath;
DuplicateEntry->VolName = EfiStrDuplicate(VolName);
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= DevicePathString;
DuplicateEntry->LoadOptions = LoadOptions;
DuplicateEntry->LoaderPath = LoaderPath;
DuplicateEntry->VolName = VolName;
DuplicateEntry->DevicePath = DevicePath;
DuplicateEntry->Flags = Flags;
DuplicateEntry->LoaderType = LoaderType;

View File

@ -264,9 +264,9 @@ class REFIT_ABSTRACT_MENU_ENTRY
class REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
CONST CHAR16 *DevicePathString;
XStringArray LoadOptions; //moved here for compatibility with legacy
XStringW LoaderPath;
XStringW DevicePathString;
XStringArray LoadOptions; //moved here for compatibility with legacy
XStringW LoaderPath;
XIcon DriveImage;
XIcon BadgeImage;
@ -302,11 +302,11 @@ class REFIT_ABSTRACT_MENU_ENTRY
{
public:
REFIT_VOLUME *Volume;
CONST CHAR16 *VolName;
XStringW VolName;
EFI_DEVICE_PATH *DevicePath;
UINT16 Flags;
REFIT_MENU_ENTRY_CLOVER() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), Volume(NULL), VolName(NULL), DevicePath(NULL), Flags(0) {};
REFIT_MENU_ENTRY_CLOVER() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), Volume(NULL), DevicePath(NULL), Flags(0) {};
REFIT_MENU_ENTRY_CLOVER* getPartiallyDuplicatedEntry() const;
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
@ -348,7 +348,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
public:
XStringW APFSTargetUUID;
CONST CHAR16 *VolName;
XStringW VolName;
EFI_DEVICE_PATH *DevicePath;
UINT16 Flags;
UINT8 LoaderType;
@ -359,7 +359,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
UINT8 CustomBoot;
XImage CustomLogo;
KERNEL_AND_KEXT_PATCHES *KernelAndKextPatches;
CONST CHAR16 *Settings;
XStringW Settings;
UINT8 *KernelData;
UINT32 AddrVtable;
UINT32 SizeVtable;
@ -441,9 +441,9 @@ class REFIT_ABSTRACT_MENU_ENTRY
// int is_mkext_v1(UINT8* drvPtr);
// void patch_mkext_v1(UINT8 *drvPtr); //not used
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT void *kext);
EFI_STATUS AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType);
void LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT void *kext);
EFI_STATUS AddKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileName, IN cpu_type_t archCpuType);
void LoadPlugInKexts(IN EFI_FILE *RootDir, IN CONST CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
void AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType);
void KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);
void KextPatcherStart();

View File

@ -91,8 +91,7 @@ EfiLibOpenRoot (
/**
Function gets the file system information from an open file descriptor,
and stores it in a buffer allocated from pool.
Function gets the file system information from an open file descriptor.
@param FHand The file handle.
@ -101,7 +100,7 @@ EfiLibOpenRoot (
@retval NULL is returned if failed to get Volume Label Info.
**/
EFI_FILE_SYSTEM_VOLUME_LABEL *
XStringW
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
)
@ -109,32 +108,23 @@ EfiLibFileSystemVolumeLabelInfo (
EFI_STATUS Status;
EFI_FILE_SYSTEM_VOLUME_LABEL *VolumeInfo = NULL;
UINTN Size = 0;
XStringW returnValue;
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
VolumeInfo = (__typeof__(VolumeInfo))AllocateZeroPool(Size);
VolumeInfo = (__typeof__(VolumeInfo))BllocateZeroPool(Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
// Check to make sure this isn't actually EFI_FILE_SYSTEM_INFO
if (!EFI_ERROR(Status))
{
EFI_FILE_SYSTEM_INFO *FSInfo = (EFI_FILE_SYSTEM_INFO *)VolumeInfo;
if (FSInfo->Size == (UINT64)Size)
{
// Allocate a new volume label
VolumeInfo = (EFI_FILE_SYSTEM_VOLUME_LABEL *)EfiStrDuplicate(FSInfo->VolumeLabel);
FreePool(FSInfo);
}
}
if (!EFI_ERROR(Status))
{
return VolumeInfo;
returnValue.takeValueFrom(FSInfo->VolumeLabel);
}
FreePool(VolumeInfo);
}
return NULL;
return returnValue;
}
/**
@ -242,7 +232,7 @@ EfiLibFileInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileInfo = (__typeof__(FileInfo))AllocateZeroPool(Size);
FileInfo = (__typeof__(FileInfo))BllocateZeroPool(Size);
Status = FHand->GetInfo (FHand, &gEfiFileInfoGuid, &Size, FileInfo);
}
@ -262,7 +252,7 @@ EfiLibFileSystemInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileSystemInfo = (__typeof__(FileSystemInfo))AllocateZeroPool(Size);
FileSystemInfo = (__typeof__(FileSystemInfo))BllocateZeroPool(Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo);
}
@ -319,7 +309,7 @@ EfiReallocatePool (
NewPool = NULL;
if (NewSize != 0) {
NewPool = (__typeof__(NewPool))AllocateZeroPool(NewSize);
NewPool = (__typeof__(NewPool))BllocateZeroPool(NewSize);
}
if (OldPool != NULL) {

View File

@ -58,7 +58,7 @@ EfiLibOpenRoot (
@retval NULL is returned if failed to get Volume Label Info.
**/
EFI_FILE_SYSTEM_VOLUME_LABEL *
XStringW
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
);

View File

@ -6,8 +6,6 @@
//
#include "FloatLib.h"
#include "../refit/IO.h"
//#define memcpy(dest,source,count) CopyMem(dest,(void*)source,(UINTN)(count))
//#define fabsf(x) ((x >= 0.0f)?x:(-x))
@ -351,7 +349,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
//}
#endif
//
//CHAR16* PoolPrintFloat(float X)
//CHAR16* P__oolPrintFloat(float X)
//{
// INTN I, Fract;
// CHAR8 S = ' ';
@ -362,7 +360,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
// S = '-';
// }
// Fract = (INTN)fabsf((X - D) * 1000000.0f);
// return PoolPrint(L"%c%d.%06d", S, I, Fract);
// return P__oolPrint(L"%c%d.%06d", S, I, Fract);
//}
static UINT32 seed = 12345;

View File

@ -57,6 +57,6 @@ AsciiStrToFloat(IN CONST CHAR8 *String,
VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size,
INTN (*compare)(CONST VOID* a, CONST VOID* b));
#endif
//CHAR16* PoolPrintFloat(float X);
#endif /* FloatLib_h */

View File

@ -484,7 +484,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
if (!p) {
return 0;
}
NSVGtext* text = (NSVGtext*)AllocateZeroPool(sizeof(NSVGtext));
NSVGtext* text = (NSVGtext*)BllocateZeroPool(sizeof(NSVGtext));
if (!text) {
return 0;
}

View File

@ -634,7 +634,7 @@ EFI_STATUS XImage::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
// decode it
Status = FromPNG(FileData, FileDataLength);
if (EFI_ERROR(Status)) {
DBG("%ls not decoded\n", IconName.data());
DBG("%ls not decoded. Status=%s\n", IconName.data(), strerror(Status));
}
FreePool(FileData);
return Status;

View File

@ -4,7 +4,6 @@
//#include "../refit/IO.h"
#include "libeg.h"
class REFIT_MENU_SCREEN;
class XImage;
class XPointer

View File

@ -169,7 +169,7 @@ public:
void parseTheme(void* p, const char** dict); //in nano project
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
EFI_STATUS ParseSVGXIcon(INTN Id, const XString8& IconNameX, XImage* Image, void **SVGIcon);
void* LoadTheme(const CHAR16 *TestTheme); //return TagPtr why?
void* LoadTheme(const XStringW& TestTheme); //return TagPtr why?
EFI_STATUS LoadSvgFrame(INTN i, OUT XImage* XFrame); // for animation
//screen operations

View File

@ -207,7 +207,8 @@ typedef enum {
CheckBit,
} ITEM_TYPE;
typedef struct {
class INPUT_ITEM {
public:
ITEM_TYPE ItemType; //string, value, boolean
BOOLEAN Valid;
BOOLEAN BValue;
@ -217,7 +218,12 @@ typedef struct {
// CHAR8* AValue;
CHAR16* SValue; // Max Size (see below) so the field can be edit by the GUI
UINTN LineShift;
} INPUT_ITEM;
INPUT_ITEM() : ItemType(BoolValue), Valid(0), BValue(0), Pad8(0), IValue(0), SValue(0), LineShift(0) {};
INPUT_ITEM(const INPUT_ITEM& other) = delete; // Can be defined if needed
const INPUT_ITEM& operator = ( const INPUT_ITEM & ) = delete; // Can be defined if needed
~INPUT_ITEM() { }
};
typedef struct {
EFI_STATUS LastStatus;
@ -237,17 +243,18 @@ typedef struct {
typedef struct {
UINT8 Type;
CONST CHAR16 *IconName;
CONST CHAR16 *Name;
CONST CHAR16 *IconName;
CONST CHAR16 *Name;
} LEGACY_OS;
typedef struct {
class REFIT_VOLUME {
public:
EFI_DEVICE_PATH *DevicePath;
EFI_HANDLE DeviceHandle;
EFI_FILE *RootDir;
CONST CHAR16 *DevicePathString;
CONST CHAR16 *VolName;
CONST CHAR16 *VolLabel;
XStringW DevicePathString;
XStringW VolName;
XStringW VolLabel;
UINT8 DiskKind;
LEGACY_OS *LegacyOS;
BOOLEAN Hidden;
@ -267,11 +274,20 @@ typedef struct {
UINT64 SleepImageOffset;
XString8 ApfsFileSystemUUID; // apfs file system UUID of that partition. It's not the UUID of subfolder like in Preboot.
XStringArray ApfsTargetUUIDArray; // this is the array of folders that are named as UUID
} REFIT_VOLUME;
typedef struct KEXT_PATCH KEXT_PATCH;
struct KEXT_PATCH
REFIT_VOLUME() : DevicePath(0), DeviceHandle(0), RootDir(0), DiskKind(0), LegacyOS(0), Hidden(0), BootType(0), IsAppleLegacy(0), HasBootCode(0),
IsMbrPartition(0), MbrPartitionIndex(0), BlockIO(0), BlockIOOffset(0), WholeDiskBlockIO(0), WholeDiskDevicePath(0), WholeDiskDeviceHandle(0),
MbrPartitionTable(0), DriveCRC32(0), RootUUID({0,0,0,{0,0,0,0,0,0,0,0}}), SleepImageOffset(0)
{}
REFIT_VOLUME(const REFIT_VOLUME& other) = delete; // Can be defined if needed
const REFIT_VOLUME& operator = ( const REFIT_VOLUME & ) = delete; // Can be defined if needed
~REFIT_VOLUME() {}
};
class KEXT_PATCH
{
public:
CHAR8 *Name;
CHAR8 *Label;
BOOLEAN IsPlistPatch;
@ -289,9 +305,17 @@ struct KEXT_PATCH
CHAR8 *MatchOS;
CHAR8 *MatchBuild;
INPUT_ITEM MenuItem;
KEXT_PATCH() : Name(0), Label(0), IsPlistPatch(0), DataLen(0), Data(0), Patch(0), MaskFind(0), MaskReplace(0),
StartPattern(0), StartMask(0), StartPatternLen(0), SearchLen(0), ProcedureName(0), MatchOS(0), MatchBuild(0)
{ memset(align, 0, sizeof(align)); }
KEXT_PATCH(const KEXT_PATCH& other) = delete; // Can be defined if needed
const KEXT_PATCH& operator = ( const KEXT_PATCH & ) = delete; // Can be defined if needed
~KEXT_PATCH() {}
};
typedef struct {
class KERNEL_PATCH {
public:
CHAR8 *Label;
INTN DataLen;
UINT8 *Data;
@ -307,7 +331,14 @@ typedef struct {
CHAR8 *MatchOS;
CHAR8 *MatchBuild;
INPUT_ITEM MenuItem;
} KERNEL_PATCH;
KERNEL_PATCH() : Label(0), DataLen(0), Data(0), Patch(0), MaskFind(0), MaskReplace(0), StartPattern(0), StartMask(0),
StartPatternLen(0), SearchLen(0), ProcedureName(0), Count(0), MatchOS(0), MatchBuild(0)
{ }
KERNEL_PATCH(const KERNEL_PATCH& other) = delete; // Can be defined if needed
const KERNEL_PATCH& operator = ( const KERNEL_PATCH & ) = delete; // Can be defined if needed
~KERNEL_PATCH() {}
} ;
typedef struct KERNEL_AND_KEXT_PATCHES
{

View File

@ -171,7 +171,7 @@ VOID egDumpSetConsoleVideoModes(VOID)
if (Status == EFI_SUCCESS) {
//MsgLog(" Mode %d: %dx%d%ls\n", i, Width, Height, (i-1==(UINTN)gST->ConOut->Mode->Mode)?L" (current mode)":L"");
if (!Once) {
MsgLog(" - [%02llu]: %llux%llu%ls\n", i, Width, Height, (i-1==(UINTN)gST->ConOut->Mode->Mode)?L" (current mode)":L"");
MsgLog(" - [%02llu]: %llux%llu%ls\n", i, Width, Height, (i-1==(UINTN)gST->ConOut->Mode->Mode)?L" (current mode)":L"");
}
// Select highest mode (-1) or lowest mode (-2) as/if requested
if ((GlobalConfig.ConsoleMode == -1 && (BestMode == 0 || Height > BestHeight || (Height == BestHeight && Width > BestWidth))) ||
@ -197,12 +197,12 @@ VOID egDumpSetConsoleVideoModes(VOID)
// Mode is valid
if (BestMode-1 != (UINTN)gST->ConOut->Mode->Mode) {
Status = gST->ConOut->SetMode(gST->ConOut, BestMode-1);
MsgLog(" Setting mode (%llu): %s\n", BestMode, strerror(Status));
MsgLog(" Setting mode (%llu): %s\n", BestMode, strerror(Status));
} else {
MsgLog(" Selected mode (%llu) is already set\n", BestMode);
MsgLog(" Selected mode (%llu) is already set\n", BestMode);
}
} else if (BestMode != 0) {
MsgLog(" Selected mode (%llu) is not valid\n", BestMode);
MsgLog(" Selected mode (%llu) is not valid\n", BestMode);
}
}
@ -385,15 +385,11 @@ VOID egInitScreen(IN BOOLEAN SetMaxResolution)
// if it not the first run, just restore resolution
if (egScreenWidth != 0 && egScreenHeight != 0) {
// Resolution = PoolPrint(L"%dx%d",egScreenWidth,egScreenHeight);
XStringW Resolution = SWPrintf("%llux%llu", egScreenWidth, egScreenHeight);
// if (Resolution) { //no sense
Status = egSetScreenResolution(Resolution.wc_str());
// FreePool(Resolution);
if (!EFI_ERROR(Status)) {
return;
}
// }
Status = egSetScreenResolution(Resolution.wc_str());
if (!EFI_ERROR(Status)) {
return;
}
}
egDumpSetConsoleVideoModes();
@ -402,8 +398,8 @@ VOID egInitScreen(IN BOOLEAN SetMaxResolution)
egHasGraphics = FALSE;
if (GraphicsOutput != NULL) {
// egDumpGOPVideoModes();
if (GlobalConfig.ScreenResolution != NULL) {
if (EFI_ERROR(egSetScreenResolution(GlobalConfig.ScreenResolution))) {
if (GlobalConfig.ScreenResolution.notEmpty()) {
if (EFI_ERROR(egSetScreenResolution(GlobalConfig.ScreenResolution.wc_str()))) {
if (SetMaxResolution) {
egSetMaxResolution();
}
@ -534,13 +530,12 @@ VOID egClearScreen(IN const void *Color)
//
// Make a screenshot
//
//CONST CHAR8 ScreenShotName[] = "EFI\\CLOVER\\misc\\screenshot";
EFI_STATUS egScreenShot(VOID)
{
EFI_STATUS Status = EFI_NOT_READY;
//take screen
XImage Screen(egScreenWidth, egScreenHeight);
MsgLog("Make screenshot W=%llu H=%llu\n", egScreenWidth, egScreenHeight);
MsgLog("Make screenshot W=%llu H=%llu\n", egScreenWidth, egScreenHeight);
Screen.GetArea(0, 0, egScreenWidth, egScreenHeight);
//convert to PNG
UINT8 *FileData = NULL;
@ -556,9 +551,7 @@ EFI_STATUS egScreenShot(VOID)
return EFI_NOT_READY;
}
//save file with a first unoccupied name
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot"_XSW);
for (UINTN Index = 0; Index < 60; Index++) {
// ScreenshotName = PoolPrint(L"%a%d.png", ScreenShotName, Index);
XStringW Name = SWPrintf("EFI\\CLOVER\\misc\\screenshot%lld.png", Index);
if (!FileExists(SelfRootDir, Name.wc_str())) {
Status = egSaveFile(SelfRootDir, Name.wc_str(), FileData, FileDataLength);

View File

@ -114,6 +114,7 @@ define them in your own project's source files without needing to change
lodepng source code. Don't forget to remove "static" if you copypaste them
from here.*/
// NOTE : lodepng_malloc has to set memory to zero, which is not the original design of lodepng.
#ifdef LODEPNG_COMPILE_ALLOCATORS
void* lodepng_malloc(size_t size) {
#ifdef LODEPNG_MAX_ALLOC
@ -770,7 +771,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
/* compute maxlens: max total bit length of symbols sharing prefix in the first table*/
// for(i = 0; i < headsize; ++i) maxlens[i] = 0;
// SetMem((void*)maxlens, headsize * sizeof(*maxlens), 0); //we already have AllocateZeroPool
// SetMem((void*)maxlens, headsize * sizeof(*maxlens), 0); //we already have A_llocateZeroPool
for(i = 0; i < tree->numcodes; i++) {
unsigned symbol = tree->codes[i];
unsigned l = tree->lengths[i];

View File

@ -488,10 +488,10 @@ static void nsvg__curveBounds(float* bounds, float* curve)
NSVGparser* nsvg__createParser()
{
NSVGparser* p;
p = (NSVGparser*)AllocateZeroPool(sizeof(NSVGparser));
p = (NSVGparser*)BllocateZeroPool(sizeof(NSVGparser));
if (p == NULL) return NULL;
p->image = (NSVGimage*)AllocateZeroPool(sizeof(NSVGimage));
p->image = (NSVGimage*)BllocateZeroPool(sizeof(NSVGimage));
if (p->image == NULL) {
FreePool(p);
return NULL;
@ -797,7 +797,7 @@ static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
static NSVGgradientLink* nsvg__createGradientLink(const char* id)
{
NSVGgradientLink* grad = (NSVGgradientLink*)AllocateZeroPool(sizeof(NSVGgradientLink));
NSVGgradientLink* grad = (NSVGgradientLink*)BllocateZeroPool(sizeof(NSVGgradientLink));
if (grad == NULL) return NULL;
strncpy(grad->id, id, 63);
grad->id[63] = '\0';
@ -838,7 +838,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGg
}
if (stops == NULL) return NULL;
// DumpFloat2("gradient final xform:", data->xform, 6);
grad = (NSVGgradient*)AllocateZeroPool(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
grad = (NSVGgradient*)BllocateZeroPool(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
if (grad == NULL) return NULL;
// The shape width and height.
if (data->units == NSVG_OBJECT_SPACE) {
@ -967,7 +967,7 @@ static void nsvg__addShape(NSVGparser* p)
if (p->plist == NULL /*&& !p->isText*/ )
return;
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
if (shape == NULL) return;
memcpy(shape->id, attr->id, sizeof shape->id);
@ -1102,11 +1102,11 @@ static void nsvg__addPath(NSVGparser* p, char closed)
if (closed)
nsvg__lineTo(p, p->pts[0], p->pts[1]);
path = (NSVGpath*)AllocateZeroPool(sizeof(NSVGpath));
path = (NSVGpath*)BllocateZeroPool(sizeof(NSVGpath));
if (path == NULL) {
return;
}
path->pts = (float*)AllocateZeroPool(p->npts*2*sizeof(float));
path->pts = (float*)BllocateZeroPool(p->npts*2*sizeof(float));
if (path->pts == NULL) {
FreePool(path);
return;
@ -1853,7 +1853,7 @@ static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* str
static NSVGclipPath* nsvg__createClipPath(const char* name, int index)
{
NSVGclipPath* clipPath = (NSVGclipPath*)AllocateZeroPool(sizeof(NSVGclipPath));
NSVGclipPath* clipPath = (NSVGclipPath*)BllocateZeroPool(sizeof(NSVGclipPath));
if (clipPath == NULL) return NULL;
strncpy(clipPath->id, name, 63);
@ -1978,7 +1978,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
} else if (strcmp(name, "font-size") == 0) {
if (!attr->fontFace) {
// DBG("font face=%d\n", sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
}
attr->fontFace->fontSize = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p));
} else if (strcmp(name, "clip-path") == 0) {
@ -1997,7 +1997,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
} else if (strcmp(name, "font-family") == 0) {
if (!attr->fontFace) {
// DBG("font face=%d\n", sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
}
if (attr->fontFace) {
if (value[0] == 0x27) { //'
@ -2010,7 +2010,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
}
} else if (strcmp(name, "font-weight") == 0) {
if (!attr->fontFace) {
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
}
if (attr->fontFace) {
// char* Next = 0;
@ -2021,7 +2021,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
} else if (strcmp(name, "font-style") == 0) {
DBG("attr=%s value=%s\n", name, value);
if (!attr->fontFace) {
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
}
if (strstr(value, "italic") != NULL) {
DBG("it is italic\n");
@ -2697,7 +2697,7 @@ static void nsvg__parseUse(NSVGparser* p, const char** dict)
takeXformBounds(ref, &xform[0], shape->bounds);
// DumpFloat2("used shape has bounds", shape->bounds, 4);
} else if (refSym) {
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
if (!shape) return;
memcpy(shape->xform, xform, sizeof(float)*6);
// nsvg__xformMultiply(shape->xform, &xform[0]);
@ -2809,7 +2809,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
int i;
DBG("text found\n");
NSVGtext* text = (NSVGtext*)AllocateZeroPool(sizeof(NSVGtext));
NSVGtext* text = (NSVGtext*)BllocateZeroPool(sizeof(NSVGtext));
if (!text) {
return;
}
@ -3123,7 +3123,7 @@ static void nsvg__parsePoly(NSVGparser* p, const char** attr, int closeFlag)
if (href == NULL)
return;
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
if (shape == NULL) return;
memcpy(shape->id, attr->id, sizeof shape->id);
@ -3222,7 +3222,7 @@ static void parsePattern(NSVGparser* p, const char** dict)
}
}
pt = (__typeof__(pt))AllocateZeroPool(sizeof(NSVGpattern));
pt = (__typeof__(pt))BllocateZeroPool(sizeof(NSVGpattern));
AsciiStrCpyS(pt->id, 64, attr->id);
pt->width = w;
pt->height = h;
@ -3277,7 +3277,7 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
{
int i;
NSVGgradientData* grad = (NSVGgradientData*)AllocateZeroPool(sizeof(NSVGgradientData));
NSVGgradientData* grad = (NSVGgradientData*)BllocateZeroPool(sizeof(NSVGgradientData));
if (grad == NULL) return;
//defaults
grad->units = NSVG_USER_SPACE; //NSVG_OBJECT_SPACE;
@ -3412,7 +3412,7 @@ static void nsvg__parseSymbol(NSVGparser* p, const char** dict)
NSVGsymbol* symbol;
NSVGattrib* curAttr = nsvg__getAttr(p);
int i;
symbol = (NSVGsymbol*)AllocateZeroPool(sizeof(NSVGsymbol));
symbol = (NSVGsymbol*)BllocateZeroPool(sizeof(NSVGsymbol));
for (i = 0; dict[i]; i += 2) {
if (strcmp(dict[i], "viewBox") == 0) {
char* Next = 0;
@ -3440,7 +3440,7 @@ static void nsvg__parseGroup(NSVGparser* p, const char** dict)
return;
}
// DBG("parse group\n");
group = (NSVGgroup*)AllocateZeroPool(sizeof(NSVGgroup));
group = (NSVGgroup*)BllocateZeroPool(sizeof(NSVGgroup));
// if (curAttr->id[0] == '\0') //skip anonymous groups
// return;
@ -3560,7 +3560,7 @@ static void nsvg__parseFont(NSVGparser* p, const char** dict)
return;
}
font = (__typeof__(font))AllocateZeroPool(sizeof(*font));
font = (__typeof__(font))BllocateZeroPool(sizeof(*font));
for (i = 0; dict[i]; i += 2) {
if (strcmp(dict[i], "horiz-adv-x") == 0) {
@ -3737,7 +3737,7 @@ static void nsvg__parseGlyph(NSVGparser* p, const char** dict, BOOLEAN missing)
p->plist = NULL;
glyph = (NSVGglyph*)AllocateZeroPool(sizeof(NSVGglyph));
glyph = (NSVGglyph*)BllocateZeroPool(sizeof(NSVGglyph));
if (!glyph) {
return;
}
@ -3971,7 +3971,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
return x;
}
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
if (shape == NULL) return x;
g = p->text->font->glyphs;
@ -4411,7 +4411,7 @@ void nsvgDelete(NSVGimage* image)
if (p == NULL)
return NULL;
res = (NSVGpath*)AllocateZeroPool(sizeof(NSVGpath));
res = (NSVGpath*)BllocateZeroPool(sizeof(NSVGpath));
if (res == NULL) return NULL;
res->pts = (float*)AllocatePool(p->npts*2*sizeof(float));

View File

@ -120,7 +120,7 @@ void qsort(void* Array, int Num, INTN Size,
//caller is responsible for free memory
NSVGrasterizer* nsvgCreateRasterizer()
{
NSVGrasterizer* r = (NSVGrasterizer*)AllocateZeroPool(sizeof(NSVGrasterizer));
NSVGrasterizer* r = (NSVGrasterizer*)BllocateZeroPool(sizeof(NSVGrasterizer));
if (r == NULL) return NULL;
r->tessTol = 0.1f; //0.25f;
r->distTol = 0.01f;
@ -159,7 +159,7 @@ static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur)
}
// Alloc new page
newp = (NSVGmemPage*)AllocateZeroPool(sizeof(NSVGmemPage));
newp = (NSVGmemPage*)BllocateZeroPool(sizeof(NSVGmemPage));
if (newp == NULL) return NULL;
@ -1750,7 +1750,7 @@ void nsvg__rasterizeClipPaths(
// r->stencil = (unsigned char*)realloc(
// r->stencil, r->stencilSize * clipPathCount);
if (oldSize == 0) {
r->stencil = (unsigned char*)AllocateZeroPool(r->stencilSize * clipPathCount);
r->stencil = (unsigned char*)BllocateZeroPool(r->stencilSize * clipPathCount);
if (r->stencil == NULL) return;
} else {
r->stencil = (unsigned char*)ReallocatePool(oldSize, r->stencilSize * clipPathCount, r->stencil);

View File

@ -287,7 +287,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
FontPixel = FontImage.GetPixel(0,0);
UINT16 c0 = 0x20;
INTN RealWidth = CharScaledWidth;
INTN Shift = (FontWidth - CharWidth) * textScale / 2;
INTN Shift = INTN((FontWidth - CharWidth) * textScale / 2); // cast to INTN to avoid warning
if (Shift < 0) {
Shift = 0;
}
@ -329,7 +329,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
RightSpace = 0; //empty place for invisible characters
}
//RealWidth = CharScaledWidth - (int)(RightSpace * textScale); //a part of char
RealWidth = (FontWidth - RightSpace) * textScale; //a part of char
RealWidth = (__typeof__(RealWidth))((FontWidth - RightSpace) * textScale); //a part of char
}
} else {
LeftSpace = 2;

View File

@ -51,8 +51,6 @@
refit/menu.h
refit/screen.cpp
refit/screen.h
refit/IO.cpp
refit/IO.h
entry_scan/common.cpp
entry_scan/common.h
entry_scan/legacy.cpp
@ -205,6 +203,8 @@
# Platform/stringTable.cpp
Platform/usbfix.h
Platform/usbfix.cpp
Platform/Utils.cpp
Platform/Utils.h
# Platform/UsbMass.h
# Platform/UsbMassBoot.h
# Platform/UsbMassImpl.h
@ -257,7 +257,6 @@
cpp_unit_test/global_test.cpp
cpp_unit_test/LoadOptions_test.cpp
cpp_unit_test/LoadOptions_test.h
cpp_unit_test/poolprint-test.h
cpp_unit_test/printf_lite-test.cpp
cpp_unit_test/printf_lite-test.h
cpp_unit_test/printf_lite-test-cpp_conf.h

File diff suppressed because it is too large Load Diff

View File

@ -1,296 +0,0 @@
/*++
Copyright (c) 2005, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
IO.h
Abstract:
Information about the IO library function
Revision History
--*/
#ifndef _SHELL_I_O_H
#define _SHELL_I_O_H
#include <Library/GenericBdsLib.h>
//#include "../gui/menu_items/menu_items.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#define EFI_TPL_APPLICATION 4
#define EFI_TPL_CALLBACK 8
#define EFI_TPL_NOTIFY 16
#define EFI_TPL_HIGH_LEVEL 31
//Unicode
#define IS_COMMA(a) ((a) == L',')
#define IS_HYPHEN(a) ((a) == L'-')
#define IS_DOT(a) ((a) == L'.')
#define IS_LEFT_PARENTH(a) ((a) == L'(')
#define IS_RIGHT_PARENTH(a) ((a) == L')')
#define IS_SLASH(a) ((a) == L'/')
#define IS_NULL(a) ((a) == L'\0')
//Ascii
#define IS_DIGIT(a) (((a) >= '0') && ((a) <= '9'))
#define IS_HEX(a) ((((a) >= 'a') && ((a) <= 'f')) || (((a) >= 'A') && ((a) <= 'F')))
#define IS_UPPER(a) (((a) >= 'A') && ((a) <= 'Z'))
#define IS_ALFA(x) (((x >= 'a') && (x <='z')) || ((x >= 'A') && (x <='Z')))
#define IS_ASCII(x) ((x>=0x20) && (x<=0x7F))
#define IS_PUNCT(x) ((x == '.') || (x == '-'))
// jief move struct definition to here to be accessible from XStringW
typedef struct {
BOOLEAN Ascii;
UINTN Index;
union {
CONST CHAR16 *pw;
CONST CHAR8 *pc;
} u;
} POINTER;
typedef struct _pitem {
POINTER Item;
CHAR16 *Scratch;
UINTN Width;
UINTN FieldWidth;
UINTN *WidthParse;
CHAR16 Pad;
BOOLEAN PadBefore;
BOOLEAN Comma;
BOOLEAN Long;
} PRINT_ITEM;
typedef struct _pstate {
//
// Input
//
POINTER fmt;
VA_LIST args;
//
// Output
//
CHAR16 *Buffer;
CHAR16 *End;
CHAR16 *Pos;
UINTN Len;
UINTN Attr;
UINTN RestoreAttr;
UINTN AttrNorm;
UINTN AttrHighlight;
UINTN AttrError;
UINTN AttrBlueColor;
UINTN AttrGreenColor;
EFI_STATUS (EFIAPI *Output) (void *context, CONST CHAR16 *str);
EFI_STATUS (EFIAPI *SetAttr) (VOID *context, UINTN attr);
VOID *Context;
//
// Current item being formatted
//
struct _pitem *Item;
} PRINT_STATE;
extern
EFI_STATUS
EFIAPI
_PoolPrint(
IN POOL_PRINT *Context,
IN CHAR16 *Buffer
);
extern
UINTN
_PPrint (
IN PRINT_STATE *ps
);
// jief
/*
typedef struct {
CHAR16 *Str;
UINTN Len;
UINTN MaxLen;
} POOL_PRINT;
*/
VOID
Input (
IN CHAR16 *Prompt OPTIONAL,
OUT CHAR16 *InStr,
IN UINTN StrLen
);
VOID
Output (
IN CHAR16 *Str
);
/*
UINTN
EFIAPI
Print (
IN CHAR16 *fmt,
...
); */
UINTN
EFIAPI
PrintAt (
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *fmt,
...
);
/*
UINTN
EFIAPI
SPrint (
OUT CHAR16 *Str,
IN UINTN StrSize,
IN CHAR16 *fmt,
...
);
UINTN
EFIAPI
PrintToken (
IN UINT16 Token,
IN EFI_HII_HANDLE Handle,
...
);
UINTN
EFIAPI
IPrint (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
IN CHAR16 *fmt,
...
);
UINTN
VSPrint (
OUT CHAR16 *Str,
IN UINTN StrSize,
IN CHAR16 *fmt,
IN VA_LIST vargs
);
*/
CHAR16 *
EFIAPI
PoolPrint(
IN CONST CHAR16 *fmt,
...
);
/*
CHAR16 *
EFIAPI
CatPrint (
IN OUT POOL_PRINT *Str,
IN CHAR16 *fmt,
...
);
INTN
EFIAPI
DbgPrint (
IN INTN mask,
IN CHAR8 *fmt,
...
);
*/
VOID
ConMoveCursorBackward (
IN UINTN LineLength,
IN OUT UINTN *Column,
IN OUT UINTN *Row
);
VOID
ConMoveCursorForward (
IN UINTN LineLength,
IN UINTN TotalRow,
IN OUT UINTN *Column,
IN OUT UINTN *Row
);
VOID
IInput (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut,
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn,
IN CHAR16 *Prompt OPTIONAL,
OUT CHAR16 *InStr,
IN UINTN StrLength
);
UINTN
EFIAPI
IPrintAt (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
IN UINTN Column,
IN UINTN Row,
IN CHAR16 *fmt,
...
);
/*
UINTN
EFIAPI
APrint (
IN CHAR8 *fmt,
...
);
VOID
LibEnablePageBreak (
IN INT32 StartRow,
IN BOOLEAN AutoWrap
);
BOOLEAN
LibGetPageBreak (
VOID
);
*/
EFI_STATUS
WaitForSingleEvent (
IN EFI_EVENT Event,
IN UINT64 Timeout OPTIONAL
);
// timeout will be in ms here, as small as 1ms and up
EFI_STATUS
WaitFor2EventWithTsc (
IN EFI_EVENT Event1,
IN EFI_EVENT Event2,
IN UINT64 Timeout OPTIONAL
);
//VOID LowCase (IN OUT CHAR8 *Str);
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
BOOLEAN IsHexDigit (CHAR8 c);
UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte
CHAR8 *Bytes2HexStr(UINT8 *data, UINTN len);
#endif

View File

@ -58,20 +58,20 @@ EFI_HANDLE SelfDeviceHandle;
EFI_LOADED_IMAGE *SelfLoadedImage;
EFI_FILE *SelfRootDir;
EFI_FILE *SelfDir;
CHAR16 *SelfDirPath;
XStringW SelfDirPath;
EFI_DEVICE_PATH *SelfDevicePath;
EFI_DEVICE_PATH *SelfFullDevicePath;
XTheme ThemeX;
CHAR16 *ThemePath;
XStringW ThemePath;
BOOLEAN gThemeChanged = FALSE;
//BOOLEAN gBootArgsChanged = FALSE;
BOOLEAN gBootChanged = FALSE;
BOOLEAN gThemeOptionsChanged = FALSE;
EFI_FILE *OEMDir;
CHAR16 *OEMPath;
XStringW OEMPath;
EFI_FILE *OemThemeDir = NULL;
@ -138,23 +138,6 @@ BOOLEAN MetaiMatch (
IN CONST CHAR16 *Pattern
);
/**
This function converts an input device structure to a Unicode string.
@param DevPath A pointer to the device path structure.
@return A new allocated Unicode string that represents the device path.
**/
CHAR16 *
EFIAPI
DevicePathToStr (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
{
return ConvertDevicePathToText (DevPath, TRUE, TRUE);
}
EFI_STATUS GetRootFromPath(IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, OUT EFI_FILE **Root)
@ -191,7 +174,7 @@ EFI_STATUS GetRootFromPath(IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, OUT EFI_FILE
EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
{
EFI_STATUS Status;
CHAR16 *FilePathAsString;
XStringW FilePathAsString;
UINTN i;
UINTN DevicePathSize;
EFI_DEVICE_PATH_PROTOCOL* TmpDevicePath;
@ -207,25 +190,24 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
SelfDevicePath = (__typeof__(SelfDevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(SelfDevicePath, TmpDevicePath, DevicePathSize);
DBG("SelfDevicePath=%ls @%llX\n", FileDevicePathToStr(SelfDevicePath), (uintptr_t)SelfDeviceHandle);
DBG("SelfDevicePath=%ls @%llX\n", FileDevicePathToXStringW(SelfDevicePath).wc_str(), (uintptr_t)SelfDeviceHandle);
// find the current directory
FilePathAsString = FileDevicePathToStr(SelfLoadedImage->FilePath);
if (FilePathAsString != NULL) {
FilePathAsString = FileDevicePathToXStringW(SelfLoadedImage->FilePath);
if (FilePathAsString.notEmpty()) {
SelfFullDevicePath = FileDevicePath(SelfDeviceHandle, FilePathAsString);
for (i = StrLen(FilePathAsString); i > 0 && FilePathAsString[i] != '\\'; i--) ;
for (i = FilePathAsString.length(); i > 0 && FilePathAsString[i] != '\\'; i--) ;
if (i > 0) {
FilePathAsString[i] = 0;
FilePathAsString = FilePathAsString.subString(0, i);
} else {
FilePathAsString[0] = L'\\';
FilePathAsString[1] = 0;
FilePathAsString = L"\\"_XSW;
}
} else {
FilePathAsString = (__typeof__(FilePathAsString))AllocateCopyPool(StrSize(L"\\"), L"\\");
FilePathAsString = L"\\"_XSW;
}
SelfDirPath = FilePathAsString;
DBG("SelfDirPath = %ls\n", SelfDirPath);
DBG("SelfDirPath = %ls\n", SelfDirPath.wc_str());
return FinishInitRefitLib();
}
@ -284,7 +266,7 @@ EFI_STATUS ReinitSelfLib(VOID)
}
TmpDevicePath = DuplicateDevicePath(SelfDevicePath);
DBG("reinit: self device path=%ls\n", FileDevicePathToStr(TmpDevicePath));
DBG("reinit: self device path=%ls\n", FileDevicePathToXStringW(TmpDevicePath).wc_str());
if(TmpDevicePath == NULL)
return EFI_NOT_FOUND;
@ -301,11 +283,11 @@ EFI_STATUS ReinitSelfLib(VOID)
return EFI_NOT_FOUND;
}
SelfDeviceHandle = NewSelfHandle;
/*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath, EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &OEMDir, OEMPath, EFI_FILE_MODE_READ, 0);
Status = SelfRootDir->Open(SelfRootDir, &SelfDir, SelfDirPath, EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &OEMDir, OEMPath.wc_str(), EFI_FILE_MODE_READ, 0);
Status = SelfRootDir->Open(SelfRootDir, &SelfDir, SelfDirPath.wc_str(), EFI_FILE_MODE_READ, 0);
CheckFatalError(Status, L"while reopening our installation directory");
return Status;
}
@ -324,9 +306,9 @@ EFI_STATUS FinishInitRefitLib(VOID)
return EFI_LOAD_ERROR;
}
}
/*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath, EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &OEMDir, OEMPath, EFI_FILE_MODE_READ, 0);
Status = SelfRootDir->Open(SelfRootDir, &SelfDir, SelfDirPath, EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
/*Status = */SelfRootDir->Open(SelfRootDir, &OEMDir, OEMPath.wc_str(), EFI_FILE_MODE_READ, 0);
Status = SelfRootDir->Open(SelfRootDir, &SelfDir, SelfDirPath.wc_str(), EFI_FILE_MODE_READ, 0);
CheckFatalError(Status, L"while opening our installation directory");
return Status;
}
@ -497,7 +479,7 @@ static VOID ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl
AsciiStrToUnicodeStrS((CHAR8*)&tmp[0], volumeName, 255);
// }
DBG("Detected name %ls\n", volumeName);
Volume->VolName = PoolPrint(L"%s", volumeName);
Volume->VolName.takeValueFrom(volumeName);
for (i=8; i<2000; i++) { //vendor search
if (SectorBuffer[i] == 'A') {
if (AsciiStrStr((CHAR8*)&SectorBuffer[i], "APPLE")) {
@ -717,12 +699,10 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
UINTN PartialLength = 0;
UINTN DevicePathSize;
// UINTN BufferSize = 255;
EFI_FILE_SYSTEM_VOLUME_LABEL *VolumeInfo;
EFI_FILE_SYSTEM_INFO *FileSystemInfoPtr;
EFI_FILE_INFO *RootInfo = NULL;
BOOLEAN Bootable;
// EFI_INPUT_KEY Key;
CHAR16 *tmpName;
// get device path
DiskDevicePath = DevicePathFromHandle(Volume->DeviceHandle);
@ -730,11 +710,11 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
DevicePathSize = GetDevicePathSize (DiskDevicePath);
Volume->DevicePath = (__typeof__(Volume->DevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(Volume->DevicePath, DiskDevicePath, DevicePathSize);
Volume->DevicePathString = FileDevicePathToStr(Volume->DevicePath);
Volume->DevicePathString = FileDevicePathToXStringW(Volume->DevicePath);
#if REFIT_DEBUG > 0
if (Volume->DevicePath != NULL) {
DBG(" %ls\n", FileDevicePathToStr(Volume->DevicePath));
DBG(" %ls\n", FileDevicePathToXStringW(Volume->DevicePath).wc_str());
//#if REFIT_DEBUG >= 2
// DumpHex(1, 0, GetDevicePathSize(Volume->DevicePath), Volume->DevicePath);
//#endif
@ -931,12 +911,9 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
// DBG("LegacyBoot volume\n");
if (HdPath) {
tmpName = (CHAR16*)AllocateZeroPool(60);
snwprintf(tmpName, 60, "Legacy HD%d", HdPath->PartitionNumber);
Volume->VolName = EfiStrDuplicate(tmpName);
FreePool(tmpName);
} else if (!Volume->VolName) {
Volume->VolName = EfiStrDuplicate(L"Whole Disc Boot");
Volume->VolName = SWPrintf("Legacy HD%d", HdPath->PartitionNumber);
} else if (Volume->VolName.isEmpty()) {
Volume->VolName = L"Whole Disc Boot"_XSW;
}
if (!Volume->LegacyOS->IconName)
Volume->LegacyOS->IconName = EfiStrDuplicate(L"legacy");
@ -958,38 +935,34 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
while (BufferSize > 0 && (Buffer[BufferSize-1]=='\n' || Buffer[BufferSize-1]=='\r')) {
Buffer[--BufferSize]='\0';
}
Volume->VolLabel = PoolPrint(L"%a", Buffer);
Volume->VolLabel = SWPrintf("%s", Buffer);
}
}
}
// get volume name
if (!Volume->VolName) {
if (Volume->VolName.isEmpty()) {
FileSystemInfoPtr = EfiLibFileSystemInfo(Volume->RootDir);
if (FileSystemInfoPtr) {
//DBG(" Volume name from FileSystem: '%ls'\n", FileSystemInfoPtr->VolumeLabel);
Volume->VolName = EfiStrDuplicate(FileSystemInfoPtr->VolumeLabel);
Volume->VolName.takeValueFrom(FileSystemInfoPtr->VolumeLabel);
FreePool(FileSystemInfoPtr);
}
}
if (!Volume->VolName) {
VolumeInfo = EfiLibFileSystemVolumeLabelInfo(Volume->RootDir);
if (VolumeInfo) {
//DBG(" Volume name from VolumeLabel: '%ls'\n", VolumeInfo->VolumeLabel);
Volume->VolName = EfiStrDuplicate(VolumeInfo->VolumeLabel);
FreePool(VolumeInfo);
}
if (Volume->VolName.isEmpty()) {
Volume->VolName = EfiLibFileSystemVolumeLabelInfo(Volume->RootDir);
//DBG(" Volume name from VolumeLabel: '%ls'\n", Volume->VolName.wc_str());
}
if (!Volume->VolName) {
if (Volume->VolName.isEmpty()) {
RootInfo = EfiLibFileInfo (Volume->RootDir);
if (RootInfo) {
//DBG(" Volume name from RootFile: '%ls'\n", RootInfo->FileName);
Volume->VolName = EfiStrDuplicate(RootInfo->FileName);
Volume->VolName.takeValueFrom(RootInfo->FileName);
FreePool(RootInfo);
}
}
if (
Volume->VolName == NULL
Volume->VolName.isEmpty()
|| Volume->VolName[0] == 0
|| (Volume->VolName[0] == L'\\' && Volume->VolName[1] == 0)
|| (Volume->VolName[0] == L'/' && Volume->VolName[1] == 0)
@ -997,23 +970,20 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
{
VOID *Instance;
if (!EFI_ERROR(gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) {
Volume->VolName = L"EFI"; \
Volume->VolName = L"EFI"_XSW; \
}
}
if (!Volume->VolName) {
if (Volume->VolName.isEmpty()) {
// DBG("Create unknown name\n");
// WaitForSingleEvent (gST->ConIn->WaitForKey, 0);
// gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (HdPath) {
tmpName = (CHAR16*)AllocateZeroPool(128);
snwprintf(tmpName, 128, "Unknown HD%d", HdPath->PartitionNumber);
Volume->VolName = EfiStrDuplicate(tmpName);
FreePool(tmpName);
Volume->VolName.SWPrintf( "Unknown HD%d", HdPath->PartitionNumber);
// NOTE: this is normal for Apple's VenMedia device paths
} else {
Volume->VolName = EfiStrDuplicate(L"Unknown HD"); //To be able to free it
Volume->VolName = L"Unknown HD"_XSW; //To be able to free it
}
}
@ -1080,11 +1050,11 @@ static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I
} else {
// found a logical partition
Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(*Volume));
Volume = new REFIT_VOLUME;
Volume->DiskKind = WholeDiskVolume->DiskKind;
Volume->IsMbrPartition = TRUE;
Volume->MbrPartitionIndex = LogicalPartitionIndex++;
Volume->VolName = PoolPrint(L"Partition %d", Volume->MbrPartitionIndex + 1);
Volume->VolName = SWPrintf("Partition %llu", Volume->MbrPartitionIndex + 1);
Volume->BlockIO = WholeDiskVolume->BlockIO;
Volume->BlockIOOffset = ExtCurrent + EMbrTable[i].StartLBA;
Volume->WholeDiskBlockIO = WholeDiskVolume->BlockIO;
@ -1131,8 +1101,8 @@ VOID ScanVolumes(VOID)
// first pass: collect information about all handles
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
REFIT_VOLUME* Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(*Volume));
Volume->LegacyOS = (__typeof__(Volume->LegacyOS))AllocateZeroPool(sizeof(LEGACY_OS));
REFIT_VOLUME* Volume = new REFIT_VOLUME;
Volume->LegacyOS = (__typeof__(Volume->LegacyOS))BllocateZeroPool(sizeof(LEGACY_OS));
Volume->DeviceHandle = Handles[HandleIndex];
if (Volume->DeviceHandle == SelfDeviceHandle) {
SelfVolume = Volume;
@ -1148,8 +1118,8 @@ VOID ScanVolumes(VOID)
// AddListElement((VOID ***) &Volumes, &VolumesCount, Volume);
if (!gSettings.ShowHiddenEntries) {
for (HVi = 0; HVi < gSettings.HVCount; HVi++) {
if (StriStr(Volume->DevicePathString, gSettings.HVHideStrings[HVi]) ||
(Volume->VolName != NULL && StriStr(Volume->VolName, gSettings.HVHideStrings[HVi]))) {
if (StriStr(Volume->DevicePathString.wc_str(), gSettings.HVHideStrings[HVi]) ||
(Volume->VolName.notEmpty() && StriStr(Volume->VolName.wc_str(), gSettings.HVHideStrings[HVi]))) {
Volume->Hidden = TRUE;
DBG(" hiding this volume\n");
break;
@ -1176,12 +1146,12 @@ VOID ScanVolumes(VOID)
// DBG("Found %d volumes\n", VolumesCount);
if (SelfVolume == NULL){
DBG(" WARNING: SelfVolume not found"); //Slice - and what?
SelfVolume = (__typeof__(SelfVolume))AllocateZeroPool(sizeof(REFIT_VOLUME));
SelfVolume = new REFIT_VOLUME;
SelfVolume->DeviceHandle = SelfDeviceHandle;
SelfVolume->DevicePath = SelfDevicePath;
SelfVolume->RootDir = SelfRootDir;
SelfVolume->DiskKind = DISK_KIND_BOOTER;
SelfVolume->VolName = L"Clover";
SelfVolume->VolName = L"Clover"_XSW;
SelfVolume->LegacyOS->Type = OSTYPE_EFI;
SelfVolume->HasBootCode = TRUE;
SelfVolume->BootType = BOOTING_BY_PBR;
@ -1250,8 +1220,8 @@ VOID ScanVolumes(VOID)
Volume->IsMbrPartition = TRUE;
Volume->MbrPartitionTable = MbrTable;
Volume->MbrPartitionIndex = PartitionIndex;
if (Volume->VolName == NULL)
Volume->VolName = PoolPrint(L"Partition %d", PartitionIndex + 1);
if (Volume->VolName.isEmpty())
Volume->VolName = SWPrintf("Partition %llu", PartitionIndex + 1);
break;
}
@ -1299,7 +1269,7 @@ VOID ReinitVolumes(VOID)
continue;
}
DBG("Volume %llu at reinit found:\n", VolumeIndex);
DBG("Volume->DevicePath=%ls\n", FileDevicePathToStr(Volume->DevicePath));
DBG("Volume->DevicePath=%ls\n", FileDevicePathToXStringW(Volume->DevicePath).wc_str());
VolumesFound++;
if (Volume->DevicePath != NULL) {
// get the handle for that path
@ -1341,7 +1311,7 @@ VOID ReinitVolumes(VOID)
// VolumesCount = VolumesFound;
}
REFIT_VOLUME *FindVolumeByName(IN CHAR16 *VolName)
REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName)
{
REFIT_VOLUME *Volume;
UINTN VolumeIndex;
@ -1355,7 +1325,7 @@ REFIT_VOLUME *FindVolumeByName(IN CHAR16 *VolName)
if (!Volume) {
continue;
}
if (Volume->VolName && StrCmp(Volume->VolName,VolName) == 0) {
if (Volume->VolName.equal(VolName) == 0) {
return Volume;
}
}
@ -1442,7 +1412,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
// read next directory entry
LastBufferSize = BufferSize = 256;
Buffer = (__typeof__(Buffer))AllocateZeroPool(BufferSize);
Buffer = (__typeof__(Buffer))BllocateZeroPool(BufferSize);
for (IterCount = 0; ; IterCount++) {
Status = Directory->Read(Directory, &BufferSize, Buffer);
if (Status != EFI_BUFFER_TOO_SMALL || IterCount >= 4)
@ -1657,16 +1627,35 @@ INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *Search
return -1;
}
/**
This function converts an input device structure to a Unicode string.
@param DevPath A pointer to the device path structure.
@return A new allocated Unicode string that represents the device path.
**/
XStringW DevicePathToXStringW (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
{
CHAR16* DevicePathStr = ConvertDevicePathToText (DevPath, TRUE, TRUE);
XStringW returnValue;
returnValue.stealValueFrom(DevicePathStr); // do not FreePool FilePath, it's now owned by returnValue
return returnValue;
}
//
// Aptio UEFI returns File DevPath as 2 nodes (dir, file)
// and DevicePathToStr connects them with /, but we need '\\'
CHAR16 *FileDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
{
CHAR16 *FilePath;
CHAR16 *Char;
CONST CHAR16 *Tail;
FilePath = DevicePathToStr(DevPath);
FilePath = ConvertDevicePathToText(DevPath, TRUE, TRUE);
// fix / into '\\'
if (FilePath != NULL) {
for (Char = FilePath; *Char != L'\0'; Char++) {
@ -1685,26 +1674,28 @@ CHAR16 *FileDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
}
Char = (CHAR16*)StrStr(FilePath, L"\\\\"); // cast is ok because FilePath is not const, and we know that StrStr returns a pointer in FilePath. Will disappear when using a string object instead of CHAR16*
}
return FilePath;
XStringW returnValue;
returnValue.stealValueFrom(FilePath); // do not FreePool FilePath, it's now owned by returnValue
return returnValue;
}
CHAR16 *FileDevicePathFileToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
XStringW FileDevicePathFileToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
{
EFI_DEVICE_PATH_PROTOCOL *Node;
if (DevPath == NULL) {
return NULL;
return NullXStringW;
}
Node = (EFI_DEVICE_PATH_PROTOCOL *)DevPath;
while (!IsDevicePathEnd(Node)) {
if ((Node->Type == MEDIA_DEVICE_PATH) &&
(Node->SubType == MEDIA_FILEPATH_DP)) {
return FileDevicePathToStr(Node);
return FileDevicePathToXStringW(Node);
}
Node = NextDevicePathNode(Node);
}
return NULL;
return NullXStringW;
}
BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
@ -1716,7 +1707,7 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (Status == EFI_BUFFER_TOO_SMALL) {
data = (__typeof__(data))AllocateZeroPool(dataSize);
data = (__typeof__(data))BllocateZeroPool(dataSize);
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (EFI_ERROR(Status)) {
DBG("Can't get %ls, size=%llu\n", Name, dataSize);
@ -1729,7 +1720,7 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
}
DBG("\n");
if (DevicePathAt >= 0) {
DBG("%ls: %ls\n", Name, FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL*)&data[DevicePathAt]));
DBG("%ls: %ls\n", Name, FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL*)&data[DevicePathAt]).wc_str());
}
}
}

View File

@ -304,12 +304,12 @@ extern EFI_HANDLE SelfDeviceHandle;
extern EFI_LOADED_IMAGE *SelfLoadedImage;
extern EFI_FILE *SelfRootDir;
extern EFI_FILE *SelfDir;
extern CHAR16 *SelfDirPath;
extern XStringW SelfDirPath;
extern EFI_DEVICE_PATH *SelfDevicePath;
extern EFI_DEVICE_PATH *SelfFullDevicePath;
extern CHAR16 *ThemePath;
extern XStringW ThemePath;
extern EFI_FILE *OEMDir;
extern CHAR16 *OEMPath;
extern XStringW OEMPath;
extern EFI_FILE *OemThemeDir;
extern REFIT_VOLUME *SelfVolume;
@ -344,7 +344,7 @@ EFI_STATUS ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths,
VOID ScanVolumes(VOID);
REFIT_VOLUME *FindVolumeByName(IN CHAR16 *VolName);
REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName);
BOOLEAN FileExists(IN CONST EFI_FILE *BaseDir, IN CONST CHAR16 *RelativePath);
BOOLEAN FileExists(IN CONST EFI_FILE *BaseDir, IN CONST XStringW& RelativePath);
@ -365,8 +365,9 @@ CHAR16 * egFindExtension(IN CHAR16 *FileName);
INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *SearchString, IN UINTN SearchStringLength);
//CHAR16 *FileDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
CHAR16 *FileDevicePathFileToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
XStringW DevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
XStringW FileDevicePathToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
XStringW FileDevicePathFileToXStringW(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
//UINTN FileDevicePathNameLen(IN CONST FILEPATH_DEVICE_PATH *FilePath);
EFI_STATUS InitializeUnicodeCollationProtocol (VOID);

View File

@ -1,369 +0,0 @@
///*
// * refit/list.c
// * list manager functions
// *
// * Copyright (c) 2013 Cadet-petit Armel
// * All rights reserved.
// *
// * Redistribution and use in source and binary forms, with or without
// * modification, are permitted provided that the following conditions are
// * met:
// *
// * * Redistributions of source code must retain the above copyright
// * notice, this list of conditions and the following disclaimer.
// *
// * * Redistributions in binary form must reproduce the above copyright
// * notice, this list of conditions and the following disclaimer in the
// * documentation and/or other materials provided with the
// * distribution.
// *
// * * Neither the name of Cadet-petit Armel nor the names of the
// * contributors may be used to endorse or promote products derived
// * from this software without specific prior written permission.
// *
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// */
//
//#include "Platform.h"
//#include "list.h"
//
//
//#ifndef DEBUG_ALL
//#define DEBUG_LIST 1
//#else
//#define DEBUG_LIST DEBUG_ALL
//#endif
//
//#if DEBUG_LIST == 0
//#define DBG(...)
//#else
//#define DBG(...) DebugLog(DEBUG_LIST, __VA_ARGS__)
//#endif
//
//
//EFI_STATUS
//CreateListElement(IN OUT LIST_ENTRY *List)
//{
//
// //
// // Check for invalid input parameters
// //
// if (List == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// //
// // Initializes the List
// //
// InitializeListHead (List);
//
// return EFI_SUCCESS;
//}
//
//#ifdef RELEASE_LIST
//EFI_STATUS
//AddListElement(
// IN OUT LIST_ENTRY *List,
// IN VOID *Element,
// IN OUT UINTN *CurrentHandle,
// IN LIST_ELEMENT_CONSTRUCTOR Constructor OPTIONAL,
// IN LIST_ELEMENT_DESTRUCTOR Destructor OPTIONAL,
// IN VOID *ConstructorParameters OPTIONAL
//
// )
//#else
//EFI_STATUS
//Add_ListElement(
// IN OUT LIST_ENTRY *List,
// IN VOID *Element,
// IN OUT UINTN *CurrentHandle,
// IN LIST_ELEMENT_CONSTRUCTOR Constructor OPTIONAL,
// IN LIST_ELEMENT_DESTRUCTOR Destructor OPTIONAL,
// IN VOID *ConstructorParameters OPTIONAL
//
// )
//#endif
//{
//
// REFIT_LIST *CurrentList;
// EFI_STATUS Status;
// UINTN Handle;
//
//
//
// //
// // Check for invalid input parameters
// //
// if (List == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// if (CurrentHandle == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// Handle = *CurrentHandle;
//
// //
// // Initializes the element if the Constructor is not NULL
// //
// if (Constructor != NULL) {
//
// Status = Constructor(&Element, ConstructorParameters);
//
// if (EFI_ERROR(Status)) {
// return EFI_ABORTED;
// }
//#ifdef DEBUG_LIST
// if (Destructor == NULL) {
// DBG("Warning: The element have a constructor but no destructor, possible memory leak !!!\n");
// }
//#endif
// }
//#ifdef DEBUG_LIST
// else {
//
// if (Element == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// if (Destructor != NULL) {
// DBG("Warning: The element have a destructor but no constructor, an unpredictable bug may occur (or not) !!!\n");
// }
// }
//#endif
//
// //
// // Create a new list entry
// //
// CurrentList = (__typeof__(CurrentList))AllocateZeroPool(sizeof (REFIT_LIST));
//
// if (!CurrentList) {
// return EFI_OUT_OF_RESOURCES;
// }
//
// //
// // Increment the handle
// //
// Handle++;
//
// //
// // Initialize the list entry contents
// //
// CurrentList->Element = Element;
// CurrentList->Signature = REFIT_LIST_SIGNATURE;
// CurrentList->Destructor = Destructor;
// CurrentList->Handle = Handle;
//
// //
// // NOTE: It should be useless to store this but let store it anyway
// //
// CurrentList->Constructor = Constructor;
// CurrentList->ConstructorParameters = ConstructorParameters;
//
// //
// // Return the handle
// //
// *CurrentHandle = Handle;
//
// //
// // Insert the list entry at the end of the list
// //
// InsertTailList (List, &CurrentList->Link);
//
// return EFI_SUCCESS;
//}
//
//LIST_ENTRY *
//FindElementByHandle(
// IN LIST_ENTRY *List,
// IN CONST UINTN Handle
// )
//{
//
// LIST_ENTRY *Link;
// REFIT_LIST *Entry;
//
// //
// // Check for invalid input parameters
// //
// if (List == NULL) {
// return NULL;
// }
//
// if (Handle == 0) {
// //
// // The first handle of the list is 1, if 0 is passed in parameters it's useless to go further
// // and we return the list pointer
// //
// return List;
// }
//
// //
// // Find the entry in the list with the given handle (if any)
// //
// if (IsListEmpty(List) == FALSE) {
// for (Link = List->ForwardLink; Link != List; Link = Link->ForwardLink) {
//
// if (Link != NULL) {
//
// if (Link != List) {
//
// Entry = CR(Link, REFIT_LIST, Link, REFIT_LIST_SIGNATURE);
//
// if (Entry != NULL) {
//
// if (Handle == Entry->Handle) {
// return Link;
//
// }
// }
// }
//
// }
// }
// }
//
// return List;
//}
//
//EFI_STATUS
//RemoveElementByHandle(
// IN OUT LIST_ENTRY *List,
// IN CONST UINTN Handle
// )
//{
//
// LIST_ENTRY *Link;
// REFIT_LIST *Entry;
// EFI_STATUS Status;
// VOID *Element;
//
// //
// // Check for invalid input parameters
// //
// if (List == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// if (Handle == 0) {
// //
// // The first handle of the list is 1, if 0 is passed in parameters it's useless to go further
// // and we return the list pointer
// //
// return EFI_INVALID_PARAMETER;
// }
//
// //
// // Remove and Free the entry of the list with the given handle
// // (additionally destroy the associated element if the destructor is not NULL)
// //
// if ((Link = FindElementByHandle(List,Handle)) != List) {
//
// if (Link != NULL) {
//
// Entry = CR(Link, REFIT_LIST, Link, REFIT_LIST_SIGNATURE);
//
// if (Entry != NULL) {
// Element = Entry->Element;
//
// if (Element != NULL) {
// if (Entry->Destructor != NULL) {
//
// //
// // Destroy the element with the given destructor
// //
// Status = Entry->Destructor(&Element);
//
// if (EFI_ERROR(Status)) {
// return EFI_ABORTED;
// }
//
// }
// }
//
// RemoveEntryList (Link);
//
// FreePool(Entry);
// }
//
// }
//
// } else {
// return EFI_NOT_FOUND;
// }
//
// return EFI_SUCCESS;
//}
//
//EFI_STATUS
//FreeListElement(IN OUT LIST_ENTRY *List)
//{
// LIST_ENTRY *Link;
// REFIT_LIST *Entry;
// VOID *Element;
// EFI_STATUS Status;
//
// //
// // Check for invalid input parameters
// //
// if (List == NULL) {
// return EFI_INVALID_PARAMETER;
// }
//
// //
// // Remove and Free all entrys of the list (additionally destroy all elements that have a destructor)
// //
// if (IsListEmpty(List) == FALSE) {
// for (Link = List->ForwardLink; Link != List; Link = Link->ForwardLink) {
//
// if (Link != NULL) {
//
// if (Link != List) {
// Entry = CR(Link, REFIT_LIST, Link, REFIT_LIST_SIGNATURE);
//
// if (Entry != NULL) {
// Element = Entry->Element;
//
// if (Element != NULL) {
// if (Entry->Destructor != NULL) {
//
// //
// // Destroy the element with the given destructor
// //
// Status = Entry->Destructor(&Element);
//
// if (EFI_ERROR(Status)) {
// return EFI_ABORTED;
// }
//
// }
// }
//
// RemoveEntryList (Link);
//
// FreePool(Entry);
//
// }
// }
// }
// }
// } else {
// return EFI_NOT_FOUND;
// }
//
// return EFI_SUCCESS;
//
//}
//
//// EOF

View File

@ -1,140 +0,0 @@
///*
// * refit/list.c
// * list manager functions
// *
// * Copyright (c) 2013 Cadet-petit Armel
// * All rights reserved.
// *
// * Redistribution and use in source and binary forms, with or without
// * modification, are permitted provided that the following conditions are
// * met:
// *
// * * Redistributions of source code must retain the above copyright
// * notice, this list of conditions and the following disclaimer.
// *
// * * Redistributions in binary form must reproduce the above copyright
// * notice, this list of conditions and the following disclaimer in the
// * documentation and/or other materials provided with the
// * distribution.
// *
// * * Neither the name of Cadet-petit Armel nor the names of the
// * contributors may be used to endorse or promote products derived
// * from this software without specific prior written permission.
// *
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// */
//
//#ifndef __REFITLIST_STANDARD_H__
//#define __REFITLIST_STANDARD_H__
//
//
//#include "libeg.h"
//
////
//// NOTE: To avoid a duplicate symbol error, with the lib.c AddListElement
//// do not remove this quote !!!
////
////#define RELEASE_LIST
//
////
//// Refit Elements Linked List Signature.
////
//#define REFIT_LIST_SIGNATURE SIGNATURE_32 ('R', 'E', 'L', 'L')
//
////
//// Refit Elements Linked List Constructor Type.
////
//typedef
//EFI_STATUS
//(EFIAPI *LIST_ELEMENT_CONSTRUCTOR) (
// IN OUT VOID **Element,
// IN OUT VOID *Parameters
// );
//
////
//// Refit Elements Linked List Destructor Type.
////
//typedef
//EFI_STATUS
//(EFIAPI *LIST_ELEMENT_DESTRUCTOR) (
// IN VOID **Element
// );
//
////
//// Refit Elements Linked List Entry definition.
////
//// Signature must be set to REFIT_LIST_SIGNATURE
//// Link is the linked list data.
//// Element is a pointer to the Element.
//// Constuctor is a pointer to the Element's constructor function.
//// Destructor is a pointer to the Element's destructor function.
//// ConstructorParameters is the to pass to the constructor.
//// Handle is used to identify a particular Element.
////
//typedef struct {
// UINT32 Signature;
// LIST_ENTRY Link;
// VOID *Element;
// LIST_ELEMENT_CONSTRUCTOR Constructor;
// LIST_ELEMENT_DESTRUCTOR Destructor;
// VOID *ConstructorParameters;
// UINTN Handle;
//} REFIT_LIST;
//
//
//EFI_STATUS
//CreateListElement(IN OUT LIST_ENTRY *List);
//
//#ifdef RELEASE_LIST
//EFI_STATUS
//AddListElement(
// IN OUT LIST_ENTRY *List,
// IN VOID *Element,
// IN OUT UINTN *CurrentHandle,
// IN LIST_ELEMENT_CONSTRUCTOR Constructor OPTIONAL,
// IN LIST_ELEMENT_DESTRUCTOR Destructor OPTIONAL,
// IN VOID *ConstructorParameters OPTIONAL
// );
//#else
//EFI_STATUS
//Add_ListElement(
// IN OUT LIST_ENTRY *List,
// IN VOID *Element,
// IN OUT UINTN *CurrentHandle,
// IN LIST_ELEMENT_CONSTRUCTOR Constructor OPTIONAL,
// IN LIST_ELEMENT_DESTRUCTOR Destructor OPTIONAL,
// IN VOID *ConstructorParameters OPTIONAL
//
// );
//#endif
//
//LIST_ENTRY *
//FindElementByHandle(
// IN LIST_ENTRY *List,
// IN CONST UINTN Handle
// );
//
//
//EFI_STATUS
//RemoveElementByHandle(
// IN OUT LIST_ENTRY *List,
// IN CONST UINTN Handle
// );
//
//
//EFI_STATUS
//FreeListElement(IN OUT LIST_ENTRY *List);
//
//
//#endif
///* EOF */

View File

@ -70,6 +70,7 @@
#include "../Platform/BootOptions.h"
#include "../Platform/boot.h"
#include "../Platform/kext_inject.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_MAIN 1
@ -505,28 +506,28 @@ VOID LOADER_ENTRY::FilterBootPatches()
VOID ReadSIPCfg()
{
UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS;
CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
CHAR16 *csrLog = (__typeof__(csrLog))BllocateZeroPool(SVALUE_MAX_SIZE);
if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS");
if (csrCfg & CSR_ALLOW_UNRESTRICTED_FS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_FS"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_FS"));
if (csrCfg & CSR_ALLOW_TASK_FOR_PID)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_TASK_FOR_PID"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_TASK_FOR_PID"));
if (csrCfg & CSR_ALLOW_KERNEL_DEBUGGER)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_KERNEL_DEBUGGER"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_KERNEL_DEBUGGER"));
if (csrCfg & CSR_ALLOW_APPLE_INTERNAL)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_APPLE_INTERNAL"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_APPLE_INTERNAL"));
if (csrCfg & CSR_ALLOW_UNRESTRICTED_DTRACE)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_DTRACE"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_DTRACE"));
if (csrCfg & CSR_ALLOW_UNRESTRICTED_NVRAM)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_NVRAM"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNRESTRICTED_NVRAM"));
if (csrCfg & CSR_ALLOW_DEVICE_CONFIGURATION)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_DEVICE_CONFIGURATION"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_DEVICE_CONFIGURATION"));
if (csrCfg & CSR_ALLOW_ANY_RECOVERY_OS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_ANY_RECOVERY_OS"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_ANY_RECOVERY_OS"));
if (csrCfg & CSR_ALLOW_UNAPPROVED_KEXTS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, PoolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNAPPROVED_KEXTS"));
StrCatS(csrLog, SVALUE_MAX_SIZE/2, P__oolPrint(L"%a%a", StrLen(csrLog) ? " | " : "", "CSR_ALLOW_UNAPPROVED_KEXTS"));
if (StrLen(csrLog)) {
DBG("CSR_CFG: %ls\n", csrLog);
@ -577,11 +578,11 @@ VOID LOADER_ENTRY::StartLoader()
// DBG("StartLoader() start\n");
DbgHeader("StartLoader");
if (Settings) {
DBG(" Settings: %ls\n", Settings);
if (Settings.notEmpty()) {
DBG(" Settings: %ls\n", Settings.wc_str());
Status = LoadUserSettings(SelfRootDir, Settings, &dict);
if (!EFI_ERROR(Status)) {
DBG(" - found custom settings for this entry: %ls\n", Settings);
DBG(" - found custom settings for this entry: %ls\n", Settings.wc_str());
gBootChanged = TRUE;
Status = GetUserSettings(SelfRootDir, dict);
if (EFI_ERROR(Status)) {
@ -1192,7 +1193,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne
if (DriversArrSize == 0) {
// new array
DriversArrSize = 16;
DriversArr = (__typeof__(DriversArr))AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
DriversArr = (__typeof__(DriversArr))BllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
} else if (DriversArrNum + 1 == DriversArrSize) {
// extend array
DriversArr = (__typeof__(DriversArr))ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
@ -1619,8 +1620,8 @@ INTN FindDefaultEntry(VOID)
}
Volume = Entry.Volume;
if ((Volume->VolName == NULL || StrCmp(Volume->VolName, gSettings.DefaultVolume) != 0) &&
!StrStr(Volume->DevicePathString, gSettings.DefaultVolume)) {
if ((Volume->VolName.isEmpty() || StrCmp(Volume->VolName.wc_str(), gSettings.DefaultVolume) != 0) &&
!StrStr(Volume->DevicePathString.wc_str(), gSettings.DefaultVolume)) {
continue;
}
@ -1629,7 +1630,7 @@ INTN FindDefaultEntry(VOID)
continue;
}
DBG(" - found entry %lld. '%ls', Volume '%ls', DevicePath '%ls'\n", Index, Entry.Title.s(), Volume->VolName, Entry.DevicePathString);
DBG(" - found entry %lld. '%ls', Volume '%ls', DevicePath '%ls'\n", Index, Entry.Title.s(), Volume->VolName.wc_str(), Entry.DevicePathString.wc_str());
// if first method failed and second succeeded - uninstall emulation
if (gEmuVariableControl != NULL) {
gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
@ -1734,44 +1735,42 @@ extern UINT8 *gLanMmio[4]; // their MMIO regions
extern UINT8 gLanMac[4][6]; // their MAC addresses
extern UINTN nLanPaths; // number of LAN pathes
BOOLEAN SetOEMPathIfExists(IN EFI_FILE *Root, IN CHAR16 *path, CONST CHAR16 *ConfName)
BOOLEAN SetOEMPathIfExists(IN EFI_FILE *Root, const XStringW& path, const XStringW& ConfName)
{
BOOLEAN res = FileExists(Root, path);
if ( res ) {
CHAR16 ConfigPath[1024];
snwprintf(ConfigPath, sizeof(ConfigPath), "%ls\\%ls.plist", path, ConfName);
snwprintf(ConfigPath, sizeof(ConfigPath), "%ls\\%ls.plist", path.wc_str(), ConfName.wc_str());
BOOLEAN res2 = FileExists(Root, ConfigPath);
if ( res2 ) {
OEMPath = path;
DBG("CheckOEMPathExists: set OEMPath: %ls\n", OEMPath);
DBG("CheckOEMPathExists: set OEMPath: %ls\n", OEMPath.wc_str());
return 1;
}else{
DBG("CheckOEMPathExists tried %ls. '%ls.plist' not exists in dir\n", path, ConfName);
FreePool(path);
DBG("CheckOEMPathExists tried %ls. '%ls.plist' not exists in dir\n", path.wc_str(), ConfName.wc_str());
}
}else{
DBG("CheckOEMPathExists tried %ls. Dir not exists\n", path);
FreePool(path);
DBG("CheckOEMPathExists tried %ls. Dir not exists\n", path.wc_str());
}
return 0;
}
VOID SetOEMPath(CONST CHAR16 *ConfName)
VOID SetOEMPath(const XStringW& ConfName)
{
OEMPath = PoolPrint(L"%s", L"EFI\\CLOVER");
if (ConfName == NULL) {
DBG("set OEMPath (ConfName == NULL): %ls\n", OEMPath);
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
} else if (!gFirmwareClover && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a\\UEFI", gSettings.OEMBoard), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a", gSettings.OEMProduct), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a-%d", gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a", gSettings.OEMBoard), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a-%d", gSettings.OEMBoard, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) {
OEMPath.takeValueFrom("EFI\\CLOVER");
if ( ConfName.isEmpty() ) {
DBG("set OEMPath (ConfName == NULL): %ls\n", OEMPath.wc_str());
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
} else if (!gFirmwareClover && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s\\UEFI", gSettings.OEMBoard), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMProduct), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMBoard), ConfName)) {
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMBoard, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) {
} else {
DBG("set OEMPath by default: %ls\n", OEMPath);
DBG("set OEMPath by default: %ls\n", OEMPath.wc_str());
}
}
@ -1813,7 +1812,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
//UINT64 TscDiv;
//UINT64 TscRemainder = 0;
// LOADER_ENTRY *LoaderEntry;
CHAR16 *ConfName = NULL;
XStringW ConfName;
TagPtr smbiosTags = NULL;
TagPtr UniteTag = NULL;
BOOLEAN UniteConfigs = FALSE;
@ -1841,13 +1840,26 @@ RefitMain (IN EFI_HANDLE ImageHandle,
ConsoleInHandle = SystemTable->ConsoleInHandle;
{
EFI_LOADED_IMAGE* LoadedImage;
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if ( !EFI_ERROR(Status) ) DBG("Clover : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
#ifdef JIEF_DEBUG
gBS->Stall(1500000); // to give time to gdb to connect
// gBS->Stall(0500000); // to give time to gdb to connect
// PauseForKey(L"press\n");
#endif
}
construct_globals_objects(gImageHandle); // do this after SelfLoadedImage is initialized
gRT->GetTime(&Now, NULL);
// firmware detection
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
if (!gFirmwareRevision) {
// gFirmwareRevision = PoolPrint(L"%d", gST->FirmwareRevision);
// gFirmwareRevision = P__oolPrint(L"%d", gST->FirmwareRevision);
}
InitializeConsoleSim();
InitBooterLog();
@ -1872,14 +1884,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
if (EFI_ERROR(Status))
return Status;
DBG("Clover : Image base = 0x%llX\n", (uintptr_t)SelfLoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
#ifdef JIEF_DEBUG
// gBS->Stall(1500000); // to give time to gdb to connect
gBS->Stall(0500000); // to give time to gdb to connect
// PauseForKey(L"press\n");
#endif
construct_globals_objects(); // do this after SelfLoadedImage is initialized
#ifdef JIEF_DEBUG
all_tests();
// PauseForKey(L"press\n");
@ -1958,23 +1962,17 @@ RefitMain (IN EFI_HANDLE ImageHandle,
GetBootFromOption();
} else {
ParseLoadOptions(&ConfName, &gConfigDict[1]);
if (ConfName) {
if (StrLen(ConfName) == 0) {
if (ConfName.isEmpty()) {
gConfigDict[1] = NULL;
FreePool(ConfName);
ConfName = NULL;
} else {
SetOEMPath(ConfName);
Status = LoadUserSettings(SelfRootDir, ConfName, &gConfigDict[1]);
DBG("%ls\\%ls.plist%ls loaded with name from LoadOptions: %s\n",
OEMPath, ConfName, EFI_ERROR(Status) ? L" not" : L"", strerror(Status));
OEMPath.wc_str(), ConfName.wc_str(), EFI_ERROR(Status) ? L" not" : L"", strerror(Status));
if (EFI_ERROR(Status)) {
gConfigDict[1] = NULL;
FreePool(ConfName);
ConfName = NULL;
}
}
}
}
}
if (gConfigDict[1]) {
@ -1987,15 +1985,14 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
}
if (!gConfigDict[1] || UniteConfigs) {
SetOEMPath(L"config");
Status = LoadUserSettings(SelfRootDir, L"config", &gConfigDict[0]);
DBG("%ls\\config.plist%ls loaded: %s\n", OEMPath, EFI_ERROR(Status) ? L" not" : L"", strerror(Status));
SetOEMPath(L"config"_XSW);
Status = LoadUserSettings(SelfRootDir, L"config"_XSW, &gConfigDict[0]);
DBG("%ls\\config.plist%ls loaded: %s\n", OEMPath.wc_str(), EFI_ERROR(Status) ? L" not" : L"", strerror(Status));
}
snwprintf(gSettings.ConfigName, 64, "%ls%ls%ls",
/* gSettings.ConfigName = PoolPrint(L"%s%s%s", */
gConfigDict[0] ? L"config": L"",
(gConfigDict[0] && gConfigDict[1]) ? L" + ": L"",
!gConfigDict[1] ? L"": (ConfName ? ConfName : L"Load Options"));
!gConfigDict[1] ? L"": (ConfName.notEmpty() ? ConfName.wc_str() : L"Load Options"));
gSettings.MainConfigName = EfiStrDuplicate(gSettings.ConfigName);
gSettings.PointerEnabled = TRUE;
@ -2246,7 +2243,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
// dropDSM = gSettings.DropOEM_DSM; //if set by user
// }
// Load any extra SMBIOS information
if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios", &smbiosTags)) && (smbiosTags != NULL)) {
if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios"_XSW, &smbiosTags)) && (smbiosTags != NULL)) {
TagPtr dictPointer = GetProperty(smbiosTags,"SMBIOS");
if (dictPointer) {
ParseSMBIOSSettings(dictPointer);
@ -2628,8 +2625,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
*/
if ( LoaderEntry->LoadOptions.contains("BO-ADD") ) {
CHAR16 *Description;
CONST CHAR16 *VolName;
XStringW Description;
CONST CHAR16 *LoaderName;
INTN EntryIndex, NameSize, Name2Size;
LOADER_ENTRY *Entry;
@ -2648,11 +2644,11 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
Entry = (LOADER_ENTRY *)MainMenu.Entries[EntryIndex].getLOADER_ENTRY();
VolName = Entry->Volume->VolName;
if (VolName == NULL) {
VolName = L"";
XStringW& VolName = Entry->Volume->VolName;
if (VolName.isEmpty()) {
VolName = NullXStringW;
}
NameSize = StrSize(VolName); //can't use StrSize with NULL! Stupid UEFI!!!
NameSize = VolName.sizeInBytes();
Name2Size = 0;
if (Entry->LoaderPath.notEmpty()) {
LoaderName = Basename(Entry->LoaderPath.wc_str());
@ -2663,15 +2659,15 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Name2Size = StrSize(LoaderName);
}
Description = PoolPrint(L"Clover start %s at %s", (LoaderName != NULL)?LoaderName:L"legacy", VolName);
Description = SWPrintf("Clover start %ls at %ls", (LoaderName != NULL)?LoaderName:L"legacy", VolName.wc_str());
OptionalDataSize = NameSize + Name2Size + 4 + 2; //signature + VolNameSize
OptionalData = (__typeof__(OptionalData))AllocateZeroPool(OptionalDataSize);
OptionalData = (__typeof__(OptionalData))BllocateZeroPool(OptionalDataSize);
if (OptionalData == NULL) {
break;
}
CopyMem(OptionalData, "Clvr", 4); //signature = 0x72766c43
CopyMem(OptionalData + 4, &NameSize, 2);
CopyMem(OptionalData + 6, VolName, NameSize);
CopyMem(OptionalData + 6, VolName.wc_str(), VolName.sizeInBytes());
if (Name2Size != 0) {
CopyMem(OptionalData + 6 + NameSize, LoaderName, Name2Size);
}
@ -2680,7 +2676,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
LoaderEntry->Volume->DeviceHandle,
LoaderEntry->LoaderPath,
TRUE,
Description,
Description.wc_str(),
OptionalData,
OptionalDataSize,
EntryIndex,
@ -2691,7 +2687,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Entry->BootNum = BootNum;
}
FreePool(OptionalData);
FreePool(Description);
} //for (EntryIndex

View File

@ -58,6 +58,7 @@
#include "../include/Devices.h"
#include "../Platform/boot.h"
#include "../Platform/Injectors.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1
@ -132,24 +133,25 @@ VOID FillInputs(BOOLEAN New)
UINTN InputItemsCount = 0;
if (New) {
InputItems = (__typeof__(InputItems))AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
// InputItems = (__typeof__(InputItems))A_llocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
InputItems = new INPUT_ITEM[130];
}
InputItems[InputItemsCount].ItemType = ASString; //0
//even though Ascii we will keep value as Unicode to convert later
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(SVALUE_MAX_SIZE);
}
// no need for extra space here, it is added by ApplyInputs()
snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s", gSettings.BootArgs);
InputItems[InputItemsCount].ItemType = UNIString; //1
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(32);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(32);
}
snwprintf(InputItems[InputItemsCount++].SValue, 32, "%ls", gSettings.DsdtName); // 1-> 2
InputItems[InputItemsCount].ItemType = UNIString; //2
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(63);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(63);
}
snwprintf(InputItems[InputItemsCount++].SValue, 63, "%ls", gSettings.BlockKexts);
@ -164,12 +166,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable;
InputItems[InputItemsCount].ItemType = Decimal; //7
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(8);
}
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.PLimitDict);
InputItems[InputItemsCount].ItemType = Decimal; //8
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(8);
}
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.UnderVoltStep);
InputItems[InputItemsCount].ItemType = BoolValue; //9
@ -184,7 +186,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.EnableISS;
InputItems[InputItemsCount].ItemType = Decimal; //14
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.QPI);
InputItems[InputItemsCount].ItemType = BoolValue; //15
@ -193,17 +195,17 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(20);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%llX", gPlatformFeature);
InputItems[InputItemsCount].ItemType = Hex; //18
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(36);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(36);
}
snwprintf(InputItems[InputItemsCount++].SValue, 36, "0x%hX", gSettings.BacklightLevel);
InputItems[InputItemsCount].ItemType = Decimal; //19
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
if (gSettings.BusSpeed > 20000) {
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.BusSpeed);
@ -214,7 +216,7 @@ VOID FillInputs(BOOLEAN New)
for (i=0; i<NGFX; i++) {
InputItems[InputItemsCount].ItemType = ASString; //20+i*6
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gGraphics[i].Model);
@ -223,7 +225,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.InjectATI;
InputItems[InputItemsCount].ItemType = ASString; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(20);
}
if (StrLen(gSettings.FBName) > 2) { //fool proof: cfg_name is 3 character or more.
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%ls", gSettings.FBName);
@ -238,26 +240,26 @@ VOID FillInputs(BOOLEAN New)
snprintf((CHAR8*)&tmp[2*j], 3, "%02hhX", gSettings.Dcfg[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(40);
}
snwprintf(InputItems[InputItemsCount++].SValue, 40, "%s", tmp);
snwprintf(InputItems[InputItemsCount++].SValue, 40, "%s", tmp);
//InputItems[InputItemsCount++].SValue = PoolPrint(L"%08x",*(UINT64*)&gSettings.Dcfg[0]);
//InputItems[InputItemsCount++].SValue = P__oolPrint(L"%08x",*(UINT64*)&gSettings.Dcfg[0]);
} else /*if (gGraphics[i].Vendor == Intel) */ {
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
InputItems[InputItemsCount++].BValue = gSettings.InjectIntel;
InputItems[InputItemsCount].ItemType = Hex; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(20);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.IgPlatform);
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.IgPlatform);
// InputItemsCount += 3;
// continue;
}
InputItems[InputItemsCount].ItemType = Decimal; //23+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(8);
}
if (gSettings.VideoPorts > 0) {
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.VideoPorts);
@ -271,15 +273,15 @@ VOID FillInputs(BOOLEAN New)
snprintf((CHAR8*)&tmp[2*j], 3, "%02hhX", gSettings.NVCAP[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(84);
}
snwprintf(InputItems[InputItemsCount++].SValue, 84, "%s", tmp);
snwprintf(InputItems[InputItemsCount++].SValue, 84, "%s", tmp);
} else { //ATI and others there will be connectors
InputItems[InputItemsCount].ItemType = Hex; //24+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(20);
}
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%08x", gGraphics[i].Connectors);
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%08x", gGraphics[i].Connectors);
}
InputItems[InputItemsCount].ItemType = BoolValue; //25+6i
@ -303,13 +305,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //50
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.RefCLK);
InputItems[InputItemsCount].ItemType = ASString; //51 OS version if non-detected
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(SVALUE_MAX_SIZE);
}
snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s ", NonDetected);
@ -319,12 +321,12 @@ VOID FillInputs(BOOLEAN New)
//VendorEDID & ProductEDID 53, 54
InputItems[InputItemsCount].ItemType = Decimal; //53
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04hX", gSettings.VendorEDID);
InputItems[InputItemsCount].ItemType = Decimal; //54
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04hX", gSettings.ProductEDID);
@ -341,7 +343,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.HDAInjection;
InputItems[InputItemsCount].ItemType = Decimal; // 60
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.HDALayoutId);
@ -352,13 +354,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //62
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(24);
}
snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeatures);
InputItems[InputItemsCount].ItemType = Hex; //63
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(24);
}
snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeaturesMask);
@ -383,12 +385,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //70
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(12);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(12);
}
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02lld", gSettings.PointerSpeed);
InputItems[InputItemsCount].ItemType = Decimal; //71
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04llu", gSettings.DoubleClickTime);
InputItems[InputItemsCount].ItemType = BoolValue; //72
@ -402,68 +404,68 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //75
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04hX", gSettings.C3Latency);
InputItems[InputItemsCount].ItemType = Decimal; //76
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.EnabledCores);
InputItems[InputItemsCount].ItemType = Decimal; //77
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.SavingMode);
InputItems[InputItemsCount].ItemType = ASString; //78
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ProductName);
InputItems[InputItemsCount].ItemType = ASString; //79
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.VersionNr);
InputItems[InputItemsCount].ItemType = ASString; //80
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.SerialNr);
InputItems[InputItemsCount].ItemType = ASString; //81
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardNumber);
InputItems[InputItemsCount].ItemType = ASString; //82
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardSerialNumber);
InputItems[InputItemsCount].ItemType = Decimal; //83
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.BoardType);
InputItems[InputItemsCount].ItemType = ASString; //84
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardVersion);
InputItems[InputItemsCount].ItemType = Decimal; //85
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.ChassisType);
InputItems[InputItemsCount].ItemType = ASString; //86
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.RomVersion);
InputItems[InputItemsCount].ItemType = ASString; //87
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ReleaseDate);
@ -484,38 +486,38 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //94
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeATI);
InputItems[InputItemsCount].ItemType = Hex; //95
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeNVidia);
InputItems[InputItemsCount].ItemType = Hex; //96
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIntel);
InputItems[InputItemsCount].ItemType = Hex; //97
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeLAN);
InputItems[InputItemsCount].ItemType = Hex; //98
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeWIFI);
InputItems[InputItemsCount].ItemType = Hex; //99
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeSATA);
InputItems[InputItemsCount].ItemType = Hex; //100
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101 - Quirks
@ -525,12 +527,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT;
InputItems[InputItemsCount].ItemType = Hex; //103
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIMEI);
InputItems[InputItemsCount].ItemType = Hex; //104
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.KernelAndKextPatches.FakeCPUID);
@ -547,7 +549,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //109
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%01X", gSettings.DualLink);
@ -558,7 +560,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //112
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.IntelMaxValue);
@ -573,12 +575,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = ASString; //117
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.EfiVersion);
InputItems[InputItemsCount].ItemType = ASString; //118
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(64);
}
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BooterCfgStr);
@ -586,7 +588,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = 119;
InputItems[InputItemsCount].ItemType = Decimal; //120
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04d", DefaultAudioVolume);
@ -594,7 +596,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
InputItems[InputItemsCount].ItemType = Decimal; //122
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))BllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04lld", gSettings.MaxSlide);
InputItems[InputItemsCount].ItemType = BoolValue; //123
@ -655,13 +657,10 @@ VOID ApplyInputs(VOID)
}
i++; //3
if (InputItems[i].Valid) {
if (GlobalConfig.Theme) {
FreePool(GlobalConfig.Theme);
}
if (OldChosenTheme == 0xFFFF) {
GlobalConfig.Theme = PoolPrint(L"embedded");
GlobalConfig.Theme = L"embedded"_XSW;
} else {
GlobalConfig.Theme = PoolPrint(L"%s", ThemesList[OldChosenTheme]);
GlobalConfig.Theme.takeValueFrom(ThemesList[OldChosenTheme]);
}
//will change theme after ESC
@ -1023,7 +1022,7 @@ VOID ApplyInputs(VOID)
i++; //90
if (InputItems[i].Valid) {
Status = LoadUserSettings(SelfRootDir, ConfigsList[OldChosenConfig], &dict);
Status = LoadUserSettings(SelfRootDir, XStringW(ConfigsList[OldChosenConfig]), &dict);
if (!EFI_ERROR(Status)) {
gBootChanged = TRUE;
gThemeChanged = TRUE;
@ -1097,7 +1096,7 @@ VOID ApplyInputs(VOID)
gQuirks.SetupVirtualMap = ((gSettings.QuirksMask & QUIRK_VIRT) != 0); //1
gQuirks.SignalAppleOS = ((gSettings.QuirksMask & QUIRK_OS) != 0); //0
gQuirks.SyncRuntimePermissions = ((gSettings.QuirksMask & QUIRK_PERM) != 0); //1
DBG("applied Quirks mask:%llx\n", gSettings.QuirksMask); //default is 0xA861
DBG("applied Quirks mask:%x\n", gSettings.QuirksMask); //default is 0xA861
}
i++; //102
if (InputItems[i].Valid) {
@ -1705,7 +1704,6 @@ REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MEN
Entry->Image = OptionMenu.TitleImage;
Entry->AtClick = AtClick;
// create the submenu
// *SubScreen = (__typeof_am__(*SubScreen))AllocateZeroPool(sizeof(**SubScreen));
*SubScreen = new REFIT_MENU_SCREEN();
// (*SubScreen)->Title = EfiStrDuplicate(Entry->Title);
(*SubScreen)->Title = Entry->Title;
@ -1917,7 +1915,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextPatches()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXTS, "Custom kexts patches->");
for (Index = 0; Index < NrKexts; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%90s", KextPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
@ -1953,14 +1950,13 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
Kext = InjectKextList;
while (Kext) {
if (StrCmp(Kext->KextDirNameUnderOEMPath, UniSysVer) == 0) {
if (StrCmp(Kext->KextDirNameUnderOEMPath.wc_str(), UniSysVer) == 0) {
if ( SubScreen == NULL ) {
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
SubScreen->AddMenuInfoLine_f("Choose/check kext to disable:");
}
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%ls, v.%ls", Kext->FileName, Kext->Version);
InputBootArgs->Title.SWPrintf("%ls, v.%ls", Kext->FileName.wc_str(), Kext->Version.wc_str());
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(Kext->MenuItem);
@ -1970,9 +1966,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
SIDELOAD_KEXT *plugInKext = Kext->PlugInList;
while (plugInKext) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf(" |-- %ls, v.%ls", plugInKext->FileName, plugInKext->Version);
InputBootArgs->Title.SWPrintf(" |-- %ls, v.%ls", plugInKext->FileName.wc_str(), plugInKext->Version.wc_str());
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(plugInKext->MenuItem);
@ -1993,7 +1988,7 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
{
LOADER_ENTRY *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
CHAR16 *kextDir = NULL;
XStringW kextDir;
// UINTN i;
CHAR8 ShortOSVersion[8];
// CHAR16 *UniSysVer = NULL;
@ -2094,13 +2089,13 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
SubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s",
ChosenOS);
}
if ((kextDir = GetOtherKextsDir(TRUE)) != NULL) {
kextDir = GetOtherKextsDir(TRUE);
if ( kextDir.notEmpty() ) {
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"Other"), true);
FreePool(kextDir);
}
if ((kextDir = GetOtherKextsDir(FALSE)) != NULL) {
kextDir = GetOtherKextsDir(FALSE);
if ( kextDir.notEmpty() ) {
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"Off"), true);
FreePool(kextDir);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
@ -2121,7 +2116,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKernelPatches()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KERNELS, "Custom kernel patches->");
for (Index = 0; Index < NrKernels; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%90s", KernelPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
@ -2148,7 +2142,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBootPatches()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BOOTER, "Custom booter patches->");
for (Index = 0; Index < NrBoots; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%90s", BootPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
@ -2344,7 +2337,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->");
for (Index = 0; Index < PatchDsdtNum; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%90s", gSettings.PatchDsdtLabel[Index]);
// InputBootArgs->Tag = TAG_INPUT;
@ -2372,7 +2364,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE);
for (i = 0; i < DsdtsNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
@ -2425,7 +2416,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort()
SubScreen->AddMenuItemInput(120, "Volume:", TRUE);
for (i = 0; i < AudioNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.SWPrintf("%ls_%s", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
@ -2444,12 +2434,9 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
{
REFIT_INPUT_DIALOG *InputBootArgs;
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
// InputBootArgs->Item = ADDRESS_OF(DEV_PROPERTY, Prop, INPUT_ITEM, MenuItem);
InputBootArgs->Item = &Prop->MenuItem;
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
@ -2472,7 +2459,7 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
break;
default: //type data, print first 24 bytes
//CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
SubScreen->AddMenuInfo_f(" value[%llu]: %24s", Prop->ValueLen, Bytes2HexStr((UINT8*)Prop->Value, MIN(24, Prop->ValueLen)));
SubScreen->AddMenuInfo_f(" value[%llu]: %24s", Prop->ValueLen, Bytes2HexStr((UINT8*)Prop->Value, MIN(24, Prop->ValueLen)).c_str());
break;
}
@ -2559,7 +2546,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes()
SubScreen->AddMenuItemSwitch(3, "embedded", FALSE);
for (i = 0; i < ThemesNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(ThemesList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
@ -2695,7 +2681,6 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs()
SubScreen->AddMenuInfoLine_f("Select a config file:");
for (i = 0; i < ConfigsNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(ConfigsList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
@ -2717,7 +2702,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuQuirks()
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_QUIRKS, NULL);
Entry->Title.SWPrintf("Quirks mask [0x%04llx]->", gSettings.QuirksMask);
Entry->Title.SWPrintf("Quirks mask [0x%04x]->", gSettings.QuirksMask);
// submenu description
SubScreen->AddMenuInfoLine_f("Choose options to fix memory");

View File

@ -40,6 +40,7 @@
#include "../libeg/XTheme.h"
#include "../Platform/BasicIO.h"
#include "menu.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#ifndef DEBUG_ALL
#define DEBUG_SCR 1