This commit is contained in:
SergeySlice 2020-10-12 15:06:00 +03:00
commit d2bec9ba0c
21 changed files with 666 additions and 349 deletions

@ -1 +1 @@
Subproject commit b114709c9ae8f823951fda29a6d103523c1344a5 Subproject commit f10d9d3ce19b84b553d65c1a8ed925a91354d8af

View File

@ -143,6 +143,19 @@
9A670D1F24E535AB00B5D780 /* XBuffer_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A670D1B24E535AB00B5D780 /* XBuffer_tests.cpp */; }; 9A670D1F24E535AB00B5D780 /* XBuffer_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A670D1B24E535AB00B5D780 /* XBuffer_tests.cpp */; };
9A7D518424FC32F700FA1CC3 /* XBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */; }; 9A7D518424FC32F700FA1CC3 /* XBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */; };
9A7D518524FC32F700FA1CC3 /* XRBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D518324FC32F700FA1CC3 /* XRBuffer.cpp */; }; 9A7D518524FC32F700FA1CC3 /* XRBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D518324FC32F700FA1CC3 /* XRBuffer.cpp */; };
9A838CA4253423F0008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */; };
9A838CA5253423F0008303F5 /* find_replace_mask_OC_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CA3253423F0008303F5 /* find_replace_mask_OC_tests.cpp */; };
9A838CA6253425A3008303F5 /* DataPatcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838A4A253423A5008303F5 /* DataPatcher.c */; settings = {COMPILER_FLAGS = "-w"; }; };
9A838CA7253425A3008303F5 /* DataPatcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838A4A253423A5008303F5 /* DataPatcher.c */; };
9A838CA8253425A4008303F5 /* DataPatcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838A4A253423A5008303F5 /* DataPatcher.c */; };
9A838CA9253425A4008303F5 /* DataPatcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838A4A253423A5008303F5 /* DataPatcher.c */; };
9A838CAC25342626008303F5 /* MemoryOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CAB25342626008303F5 /* MemoryOperation.cpp */; };
9A838CAD25342629008303F5 /* MemoryOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CAB25342626008303F5 /* MemoryOperation.cpp */; };
9A838CAE2534262A008303F5 /* MemoryOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CAB25342626008303F5 /* MemoryOperation.cpp */; };
9A838CAF2534262A008303F5 /* MemoryOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CAB25342626008303F5 /* MemoryOperation.cpp */; };
9A838CB025345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */; };
9A838CB125345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */; };
9A838CB225345E94008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */; };
9A9223312402FD1000483CBA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; }; 9A9223312402FD1000483CBA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; }; 9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; }; 9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
@ -273,6 +286,13 @@
9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBuffer.cpp; sourceTree = "<group>"; }; 9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBuffer.cpp; sourceTree = "<group>"; };
9A7D518224FC32F700FA1CC3 /* XRBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRBuffer.h; sourceTree = "<group>"; }; 9A7D518224FC32F700FA1CC3 /* XRBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRBuffer.h; sourceTree = "<group>"; };
9A7D518324FC32F700FA1CC3 /* XRBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRBuffer.cpp; sourceTree = "<group>"; }; 9A7D518324FC32F700FA1CC3 /* XRBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRBuffer.cpp; sourceTree = "<group>"; };
9A838A4A253423A5008303F5 /* DataPatcher.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; path = DataPatcher.c; sourceTree = "<group>"; };
9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = find_replace_mask_Clover_tests.cpp; sourceTree = "<group>"; };
9A838CA1253423F0008303F5 /* find_replace_mask_OC_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = find_replace_mask_OC_tests.h; sourceTree = "<group>"; };
9A838CA2253423F0008303F5 /* find_replace_mask_Clover_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = find_replace_mask_Clover_tests.h; sourceTree = "<group>"; };
9A838CA3253423F0008303F5 /* find_replace_mask_OC_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = find_replace_mask_OC_tests.cpp; sourceTree = "<group>"; };
9A838CAA25342626008303F5 /* MemoryOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryOperation.h; sourceTree = "<group>"; };
9A838CAB25342626008303F5 /* MemoryOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryOperation.cpp; sourceTree = "<group>"; };
9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 signed char"; sourceTree = BUILT_PRODUCTS_DIR; }; 9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 signed char"; sourceTree = BUILT_PRODUCTS_DIR; };
9A9223302402FD1000483CBA /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; }; 9A9223302402FD1000483CBA /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; }; 9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
@ -358,6 +378,10 @@
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = { 9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A838CA0253423F0008303F5 /* find_replace_mask_Clover_tests.cpp */,
9A838CA2253423F0008303F5 /* find_replace_mask_Clover_tests.h */,
9A838CA3253423F0008303F5 /* find_replace_mask_OC_tests.cpp */,
9A838CA1253423F0008303F5 /* find_replace_mask_OC_tests.h */,
9A36E52A24F3C845007A1107 /* plist_tests.cpp */, 9A36E52A24F3C845007A1107 /* plist_tests.cpp */,
9A36E52B24F3C846007A1107 /* plist_tests.h */, 9A36E52B24F3C846007A1107 /* plist_tests.h */,
9A0B08512402FE9B00E2B470 /* all_tests.cpp */, 9A0B08512402FE9B00E2B470 /* all_tests.cpp */,
@ -409,6 +433,8 @@
9A28CCAC241B816400F3D247 /* Platform */ = { 9A28CCAC241B816400F3D247 /* Platform */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A838CAB25342626008303F5 /* MemoryOperation.cpp */,
9A838CAA25342626008303F5 /* MemoryOperation.h */,
9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */, 9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */,
9A36E51D24F3B82A007A1107 /* b64cdecode.h */, 9A36E51D24F3B82A007A1107 /* b64cdecode.h */,
9A36E4D924F3B51C007A1107 /* plist */, 9A36E4D924F3B51C007A1107 /* plist */,
@ -480,9 +506,35 @@
path = libeg; path = libeg;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
9A83876E253423A4008303F5 /* OpenCorePkg */ = {
isa = PBXGroup;
children = (
9A8389CD253423A5008303F5 /* Library */,
);
name = OpenCorePkg;
path = ../../OpenCorePkg;
sourceTree = "<group>";
};
9A8389CD253423A5008303F5 /* Library */ = {
isa = PBXGroup;
children = (
9A838A44253423A5008303F5 /* OcMiscLib */,
);
path = Library;
sourceTree = "<group>";
};
9A838A44253423A5008303F5 /* OcMiscLib */ = {
isa = PBXGroup;
children = (
9A838A4A253423A5008303F5 /* DataPatcher.c */,
);
path = OcMiscLib;
sourceTree = "<group>";
};
9A9223242402FD1000483CBA = { 9A9223242402FD1000483CBA = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A83876E253423A4008303F5 /* OpenCorePkg */,
9A36E51C24F3B5B4007A1107 /* rEFIt_UEFI */, 9A36E51C24F3B5B4007A1107 /* rEFIt_UEFI */,
9A1A3FD82424BC22008C89EB /* MemLogLibDefault */, 9A1A3FD82424BC22008C89EB /* MemLogLibDefault */,
9A92232F2402FD1000483CBA /* Main */, 9A92232F2402FD1000483CBA /* Main */,
@ -653,6 +705,7 @@
files = ( files = (
9A36E50524F3B537007A1107 /* TagInt64.cpp in Sources */, 9A36E50524F3B537007A1107 /* TagInt64.cpp in Sources */,
9A36E50124F3B537007A1107 /* TagDict.cpp in Sources */, 9A36E50124F3B537007A1107 /* TagDict.cpp in Sources */,
9A838CAD25342629008303F5 /* MemoryOperation.cpp in Sources */,
9A36E50D24F3B537007A1107 /* TagData.cpp in Sources */, 9A36E50D24F3B537007A1107 /* TagData.cpp in Sources */,
9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */, 9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
9A36E52D24F3C846007A1107 /* plist_tests.cpp in Sources */, 9A36E52D24F3C846007A1107 /* plist_tests.cpp in Sources */,
@ -664,6 +717,7 @@
9A36E51924F3B537007A1107 /* TagKey.cpp in Sources */, 9A36E51924F3B537007A1107 /* TagKey.cpp in Sources */,
9A9EA7F9245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */, 9A9EA7F9245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
9A36E52724F3BB6B007A1107 /* FloatLib.cpp in Sources */, 9A36E52724F3BB6B007A1107 /* FloatLib.cpp in Sources */,
9A838CB125345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */, 9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */, 9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
9A0B08742403B08400E2B470 /* main.cpp in Sources */, 9A0B08742403B08400E2B470 /* main.cpp in Sources */,
@ -676,6 +730,7 @@
9A36E4FD24F3B537007A1107 /* TagBool.cpp in Sources */, 9A36E4FD24F3B537007A1107 /* TagBool.cpp in Sources */,
9A36E4F524F3B537007A1107 /* plist.cpp in Sources */, 9A36E4F524F3B537007A1107 /* plist.cpp in Sources */,
9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */, 9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */,
9A838CA7253425A3008303F5 /* DataPatcher.c in Sources */,
9A36E4F924F3B537007A1107 /* xml.cpp in Sources */, 9A36E4F924F3B537007A1107 /* xml.cpp in Sources */,
9A0B087D2403B08400E2B470 /* XStringArray_test.cpp in Sources */, 9A0B087D2403B08400E2B470 /* XStringArray_test.cpp in Sources */,
9A36E51124F3B537007A1107 /* TagArray.cpp in Sources */, 9A36E51124F3B537007A1107 /* TagArray.cpp in Sources */,
@ -697,6 +752,7 @@
files = ( files = (
9A36E50724F3B537007A1107 /* TagInt64.cpp in Sources */, 9A36E50724F3B537007A1107 /* TagInt64.cpp in Sources */,
9A36E50324F3B537007A1107 /* TagDict.cpp in Sources */, 9A36E50324F3B537007A1107 /* TagDict.cpp in Sources */,
9A838CAF2534262A008303F5 /* MemoryOperation.cpp in Sources */,
9A36E50F24F3B537007A1107 /* TagData.cpp in Sources */, 9A36E50F24F3B537007A1107 /* TagData.cpp in Sources */,
9A2A7C6C24576CCE00422263 /* LoadOptions_test.cpp in Sources */, 9A2A7C6C24576CCE00422263 /* LoadOptions_test.cpp in Sources */,
9A36E52F24F3C846007A1107 /* plist_tests.cpp in Sources */, 9A36E52F24F3C846007A1107 /* plist_tests.cpp in Sources */,
@ -708,6 +764,7 @@
9A36E51B24F3B537007A1107 /* TagKey.cpp in Sources */, 9A36E51B24F3B537007A1107 /* TagKey.cpp in Sources */,
9A9EA7FB245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */, 9A9EA7FB245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
9A36E52924F3BB6B007A1107 /* FloatLib.cpp in Sources */, 9A36E52924F3BB6B007A1107 /* FloatLib.cpp in Sources */,
9A838CB225345E94008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
9A2A7C7124576CCE00422263 /* strlen.cpp in Sources */, 9A2A7C7124576CCE00422263 /* strlen.cpp in Sources */,
9A2A7C7224576CCE00422263 /* xcode_utf_fixed.cpp in Sources */, 9A2A7C7224576CCE00422263 /* xcode_utf_fixed.cpp in Sources */,
9A2A7C7324576CCE00422263 /* main.cpp in Sources */, 9A2A7C7324576CCE00422263 /* main.cpp in Sources */,
@ -720,6 +777,7 @@
9A36E4FF24F3B537007A1107 /* TagBool.cpp in Sources */, 9A36E4FF24F3B537007A1107 /* TagBool.cpp in Sources */,
9A36E4F724F3B537007A1107 /* plist.cpp in Sources */, 9A36E4F724F3B537007A1107 /* plist.cpp in Sources */,
9A2A7C7A24576CCE00422263 /* printf_lite.c in Sources */, 9A2A7C7A24576CCE00422263 /* printf_lite.c in Sources */,
9A838CA9253425A4008303F5 /* DataPatcher.c in Sources */,
9A36E4FB24F3B537007A1107 /* xml.cpp in Sources */, 9A36E4FB24F3B537007A1107 /* xml.cpp in Sources */,
9A2A7C7B24576CCE00422263 /* XStringArray_test.cpp in Sources */, 9A2A7C7B24576CCE00422263 /* XStringArray_test.cpp in Sources */,
9A36E51324F3B537007A1107 /* TagArray.cpp in Sources */, 9A36E51324F3B537007A1107 /* TagArray.cpp in Sources */,
@ -741,6 +799,7 @@
files = ( files = (
9A36E50624F3B537007A1107 /* TagInt64.cpp in Sources */, 9A36E50624F3B537007A1107 /* TagInt64.cpp in Sources */,
9A36E50224F3B537007A1107 /* TagDict.cpp in Sources */, 9A36E50224F3B537007A1107 /* TagDict.cpp in Sources */,
9A838CAE2534262A008303F5 /* MemoryOperation.cpp in Sources */,
9A36E50E24F3B537007A1107 /* TagData.cpp in Sources */, 9A36E50E24F3B537007A1107 /* TagData.cpp in Sources */,
9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */, 9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
9A36E52E24F3C846007A1107 /* plist_tests.cpp in Sources */, 9A36E52E24F3C846007A1107 /* plist_tests.cpp in Sources */,
@ -752,6 +811,7 @@
9A36E51A24F3B537007A1107 /* TagKey.cpp in Sources */, 9A36E51A24F3B537007A1107 /* TagKey.cpp in Sources */,
9A9EA7FA245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */, 9A9EA7FA245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
9A36E52824F3BB6B007A1107 /* FloatLib.cpp in Sources */, 9A36E52824F3BB6B007A1107 /* FloatLib.cpp in Sources */,
9A838CB025345E93008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */, 9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */, 9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
9A57C21B2418B9A00029A39F /* main.cpp in Sources */, 9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
@ -764,6 +824,7 @@
9A36E4FE24F3B537007A1107 /* TagBool.cpp in Sources */, 9A36E4FE24F3B537007A1107 /* TagBool.cpp in Sources */,
9A36E4F624F3B537007A1107 /* plist.cpp in Sources */, 9A36E4F624F3B537007A1107 /* plist.cpp in Sources */,
9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */, 9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */,
9A838CA8253425A4008303F5 /* DataPatcher.c in Sources */,
9A36E4FA24F3B537007A1107 /* xml.cpp in Sources */, 9A36E4FA24F3B537007A1107 /* xml.cpp in Sources */,
9A57C2252418B9A00029A39F /* XStringArray_test.cpp in Sources */, 9A57C2252418B9A00029A39F /* XStringArray_test.cpp in Sources */,
9A36E51224F3B537007A1107 /* TagArray.cpp in Sources */, 9A36E51224F3B537007A1107 /* TagArray.cpp in Sources */,
@ -783,6 +844,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9A838CAC25342626008303F5 /* MemoryOperation.cpp in Sources */,
9A36E50424F3B537007A1107 /* TagInt64.cpp in Sources */, 9A36E50424F3B537007A1107 /* TagInt64.cpp in Sources */,
9A36E50024F3B537007A1107 /* TagDict.cpp in Sources */, 9A36E50024F3B537007A1107 /* TagDict.cpp in Sources */,
9A36E50C24F3B537007A1107 /* TagData.cpp in Sources */, 9A36E50C24F3B537007A1107 /* TagData.cpp in Sources */,
@ -794,9 +856,11 @@
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */, 9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */,
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */, 9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */,
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */, 9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */,
9A838CA6253425A3008303F5 /* DataPatcher.c in Sources */,
9A36E51824F3B537007A1107 /* TagKey.cpp in Sources */, 9A36E51824F3B537007A1107 /* TagKey.cpp in Sources */,
9A9EA7F8245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */, 9A9EA7F8245AAB310076EC02 /* XToolsCommon_test.cpp in Sources */,
9A36E52624F3BB6B007A1107 /* FloatLib.cpp in Sources */, 9A36E52624F3BB6B007A1107 /* FloatLib.cpp in Sources */,
9A838CA4253423F0008303F5 /* find_replace_mask_Clover_tests.cpp in Sources */,
9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */, 9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
9A9223312402FD1000483CBA /* main.cpp in Sources */, 9A9223312402FD1000483CBA /* main.cpp in Sources */,
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */, 9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */,
@ -811,6 +875,7 @@
9A0B08582402FF7F00E2B470 /* XStringArray_test.cpp in Sources */, 9A0B08582402FF7F00E2B470 /* XStringArray_test.cpp in Sources */,
9A36E4F824F3B537007A1107 /* xml.cpp in Sources */, 9A36E4F824F3B537007A1107 /* xml.cpp in Sources */,
9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */, 9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */,
9A838CA5253423F0008303F5 /* find_replace_mask_OC_tests.cpp in Sources */,
9A7D518524FC32F700FA1CC3 /* XRBuffer.cpp in Sources */, 9A7D518524FC32F700FA1CC3 /* XRBuffer.cpp in Sources */,
9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */, 9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */,
9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */, 9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */,
@ -951,7 +1016,10 @@
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREFIX_HEADER = ""; GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = JIEF_DEBUG; GCC_PREPROCESSOR_DEFINITIONS = (
JIEF_DEBUG,
UNIT_TESTS,
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -1037,7 +1105,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_PREFIX_HEADER = ""; GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_PREPROCESSOR_DEFINITIONS = UNIT_TESTS;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

View File

@ -43,12 +43,12 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableUBSanitizer = "YES" disableMainThreadChecker = "YES"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
stopOnEveryMainThreadCheckerIssue = "YES" migratedStopOnEveryIssue = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable <BuildableProductRunnable
@ -61,33 +61,6 @@
ReferencedContainer = "container:cpp_tests.xcodeproj"> ReferencedContainer = "container:cpp_tests.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "MallocStackLogging"
value = ""
isEnabled = "YES">
</AdditionalOption>
<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> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release" buildConfiguration = "Release"

View File

@ -171,11 +171,16 @@ void SetMem(void *Destination, UINTN Length, char c)
memset(Destination, c, (size_t)Length); memset(Destination, c, (size_t)Length);
} }
void CopyMem(void *Destination, void *Source, UINTN Length) void CopyMem(void *Destination, const void *Source, UINTN Length)
{ {
memmove(Destination, Source, (size_t)Length); memmove(Destination, Source, (size_t)Length);
} }
INTN CompareMem(const void* DestinationBuffer, const void* SourceBuffer, UINTN Length)
{
return memcmp(SourceBuffer, DestinationBuffer, Length);
}
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src) CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src)
{ {
CHAR16* newS = (CHAR16*)malloc((wcslen_fixed(Src)+1)*sizeof(wchar_t)); CHAR16* newS = (CHAR16*)malloc((wcslen_fixed(Src)+1)*sizeof(wchar_t));

View File

@ -21,14 +21,6 @@
#include <wchar.h> #include <wchar.h>
#include "posix.h" #include "posix.h"
#include "../../../rEFIt_UEFI/Platform/Posix/abort.h"
#include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h"
#include "../../../rEFIt_UEFI/cpp_foundation/XString.h"
#include "../../../rEFIt_UEFI/cpp_foundation/XObjArray.h"
#include "xcode_utf_fixed.h"
#ifndef __cplusplus #ifndef __cplusplus
//typedef uint16_t wchar_t; //typedef uint16_t wchar_t;
typedef uint32_t char32_t; typedef uint32_t char32_t;
@ -149,6 +141,15 @@ typedef RETURN_STATUS EFI_STATUS;
#define __typeof__(x) decltype(x) #define __typeof__(x) decltype(x)
#endif #endif
#include "../../../rEFIt_UEFI/Platform/Posix/abort.h"
#include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h"
#include "../../../rEFIt_UEFI/cpp_foundation/XString.h"
#include "../../../rEFIt_UEFI/cpp_foundation/XObjArray.h"
#include "xcode_utf_fixed.h"
void CpuDeadLoop(void); void CpuDeadLoop(void);
void DebugLog(INTN DebugMode, const char *FormatString, ...); void DebugLog(INTN DebugMode, const char *FormatString, ...);
#define MsgLog ::printf #define MsgLog ::printf
@ -190,7 +191,8 @@ void FreePool(const void* Buffer);
void ZeroMem(void *Destination, UINTN Length); void ZeroMem(void *Destination, UINTN Length);
void SetMem(void *Destination, UINTN Length, char c); void SetMem(void *Destination, UINTN Length, char c);
void CopyMem(void *Destination, void *Source, UINTN Length); void CopyMem(void *Destination, const void *Source, UINTN Length);
INTN CompareMem(const void* DestinationBuffer, const void* SourceBuffer, UINTN Length);
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src); CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src);
CHAR16* StrStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString); CHAR16* StrStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString);

View File

@ -1,8 +1,6 @@
#ifndef __XTOOLSCONF_H__ #ifndef __XTOOLSCONF_H__
#define __XTOOLSCONF_H__ #define __XTOOLSCONF_H__
#include <posix.h>
#define xsize size_t #define xsize size_t
//#define xisize INTN //#define xisize INTN
@ -25,6 +23,9 @@
#define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize) #define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize)
#include <Platform.h>
#include <posix.h>
#endif #endif

View File

@ -0,0 +1,198 @@
/*
* Copyright (c) 2011-2012 Frank Peng. All rights reserved.
*
*/
#include "MemoryOperation.h"
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
//
// Searches Source for Search pattern of size SearchSize
// and returns the number of occurences.
//
UINTN SearchAndCount(const UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize)
{
UINTN NumFounds = 0;
const UINT8 *End = Source + SourceSize;
while (Source < End) {
if (CompareMem(Source, Search, SearchSize) == 0) {
NumFounds++;
Source += SearchSize;
} else {
Source++;
}
}
return NumFounds;
}
//
// Searches Source for Search pattern of size SearchSize
// and replaces it with Replace up to MaxReplaces times.
// If MaxReplaces <= 0, then there is no restriction on number of replaces.
// Replace should have the same size as Search.
// Returns number of replaces done.
//
UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
// UINT8 *Begin = Source;
UINT8 *End = Source + SourceSize;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
if (CompareMem(Source, Search, SearchSize) == 0) {
// printf(" found pattern at %llx\n", (UINTN)(Source - Begin));
CopyMem(Source, Replace, SearchSize);
NumReplaces++;
MaxReplaces--;
Source += SearchSize;
} else {
Source++;
}
}
return NumReplaces;
}
BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSize, const UINT8 *Mask, UINTN MaskSize)
{
UINT8 M;
if (!Mask || MaskSize == 0) {
return !CompareMem(Source, Search, SearchSize);
}
for (UINTN Ind = 0; Ind < SearchSize; Ind++) {
if (Ind < MaskSize)
M = *Mask++;
else M = 0xFF;
if ((*Source++ & M) != (*Search++ & M)) {
return FALSE;
}
}
return TRUE;
}
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize)
{
UINT8 M, D;
// the procedure is called from SearchAndReplaceMask with own check but for future it is better to check twice
if (!Dest || !Replace) {
return;
}
if (!Mask) {
CopyMem(Dest, Replace, SearchSize); //old behavior
return;
}
for (UINTN Ind = 0; Ind < SearchSize; Ind++) {
M = *Mask++;
D = *Dest;
*Dest++ = ((D ^ *Replace++) & M) ^ D;
}
}
UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize)
{
if (!Source || !Search || !SearchSize) {
return MAX_UINTN;
}
for (UINTN i = 0; i < SourceSize - SearchSize; ++i) {
if (CompareMemMask(&Source[i], Search, SearchSize, MaskSearch, MaskSize)) {
return i;
}
}
return MAX_UINTN;
}
UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, const UINT8 *MaskSearch, UINTN SearchSize,
const UINT8 *Replace, const UINT8 *MaskReplace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
UINT8 *End = Source + SourceSize;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
if (CompareMemMask((const UINT8 *)Source, Search, SearchSize, MaskSearch, SearchSize)) {
CopyMemMask(Source, Replace, MaskReplace, SearchSize);
NumReplaces++;
MaxReplaces--;
Source += SearchSize;
} else {
Source++;
}
}
return NumReplaces;
}
UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
UINTN Skip = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
UINT8 *End = Source + SourceSize;
const UINT8 *SearchEnd = Search + SearchSize;
const UINT8 *Pos = NULL;
UINT8 *SourcePos = NULL;
UINT8 *FirstMatch = Source;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while (((Source + SearchSize) <= End) &&
(NoReplacesRestriction || (MaxReplaces > 0))) { // num replaces
while (*Source != '\0') { //comparison
Pos = Search;
FirstMatch = Source;
Skip = 0;
while (*Source != '\0' && Pos != SearchEnd) {
if (*Source <= 0x20) { //skip invisibles in sources
Source++;
Skip++;
continue;
}
if (*Source != *Pos) {
break;
}
// printf("%c", *Source);
Source++;
Pos++;
}
if (Pos == SearchEnd) { // pattern found
SourcePos = FirstMatch;
break;
}
else
SourcePos = NULL;
Source = FirstMatch + 1;
/* if (Pos != Search) {
printf("\n");
} */
}
if (!SourcePos) {
break;
}
CopyMem(SourcePos, Replace, SearchSize);
SetMem(SourcePos + SearchSize, Skip, 0x20); //fill skip places with spaces
NumReplaces++;
MaxReplaces--;
Source = FirstMatch + SearchSize + Skip;
}
return NumReplaces;
}

View File

@ -0,0 +1,60 @@
/*
* MemoryOperation.h
*
* Created on: Oct 12, 2020
* Author: jief
*/
#ifndef MEMORYOPERATION_H_
#define MEMORYOPERATION_H_
#ifdef __cplusplus
extern "C" {
#endif
//#include <Library/BaseLib.h>
//#include <Library/BaseMemoryLib.h>
//#include <Library/DebugLib.h>
//
// Searches Source for Search pattern of size SearchSize
// and returns the number of occurences.
//
UINTN SearchAndCount(const UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize);
//
// Searches Source for Search pattern of size SearchSize
// and replaces it with Replace up to MaxReplaces times.
// If MaxReplaces <= 0, then there is no restriction on number of replaces.
// Replace should have the same size as Search.
// Returns number of replaces done.
//
UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces);
BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSize, const UINT8 *Mask, UINTN MaskSize);
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize);
UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize);
UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, const UINT8 *MaskSearch, UINTN SearchSize,
const UINT8 *Replace, const UINT8 *MaskReplace, INTN MaxReplaces);
UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces);
#ifdef __cplusplus
}
#endif
#endif /* MEMORYOPERATION_H_ */

View File

@ -5,10 +5,10 @@
#if defined(CLOVER_BUILD) || !defined(_MSC_VER) #if defined(CLOVER_BUILD) || !defined(_MSC_VER)
void abort(void) void abort(void)
{ {
printf("A fatal error happened. System halted\n"); printf("A fatal error happened. System halted\n");
while (1) { // tis will avoid warning : Function declared 'noreturn' should not return while (1) { // tis will avoid warning : Function declared 'noreturn' should not return
CpuDeadLoop(); CpuDeadLoop();
} }
} }
#endif #endif
@ -25,40 +25,44 @@ static void panic_(const char* format, VA_LIST va)
#endif #endif
; ;
#ifdef CLOVER_BUILD
extern void egSetGraphicsModeEnabled(BOOLEAN); extern void egSetGraphicsModeEnabled(BOOLEAN);
#endif
#define FATAL_ERROR_MSG "\nA fatal error happened. System halted.\n" #define FATAL_ERROR_MSG "\nA fatal error happened. System halted.\n"
static void panic_(const char* format, VA_LIST va) static void panic_(const char* format, VA_LIST va)
{ {
egSetGraphicsModeEnabled(false); #ifdef CLOVER_BUILD
if ( format ) { egSetGraphicsModeEnabled(false);
vprintf(format, va); #endif
#ifdef DEBUG_ON_SERIAL_PORT if ( format ) {
char buf[500]; vprintf(format, va);
vsnprintf(buf, sizeof(buf)-1, format, va); #ifdef DEBUG_ON_SERIAL_PORT
SerialPortWrite((UINT8*)buf, strlen(buf)); char buf[500];
#endif vsnprintf(buf, sizeof(buf)-1, format, va);
} SerialPortWrite((UINT8*)buf, strlen(buf));
printf(FATAL_ERROR_MSG); #endif
}
printf(FATAL_ERROR_MSG);
#ifdef DEBUG_ON_SERIAL_PORT #ifdef DEBUG_ON_SERIAL_PORT
SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG)); SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG));
#endif #endif
while (1) { // this will avoid warning : Function declared 'noreturn' should not return while (1) { // this will avoid warning : Function declared 'noreturn' should not return
CpuDeadLoop(); CpuDeadLoop();
} }
} }
void panic(const char* format, ...) void panic(const char* format, ...)
{ {
#ifdef PANIC_CAN_RETURN #ifdef PANIC_CAN_RETURN
if ( stop_at_panic ) { if ( stop_at_panic ) {
VA_LIST va; VA_LIST va;
VA_START(va, format); VA_START(va, format);
panic_(format, va); // panic doesn't return panic_(format, va); // panic doesn't return
// VA_END(va); // VA_END(va);
}else{ }else{
i_have_panicked = true; i_have_panicked = true;
} }
#else #else
VA_LIST va; VA_LIST va;
VA_START(va, format); VA_START(va, format);
@ -69,5 +73,5 @@ void panic(const char* format, ...)
void panic(void) void panic(void)
{ {
panic(nullptr); panic(nullptr);
} }

View File

@ -19,6 +19,8 @@
#include "kext_inject.h" #include "kext_inject.h"
#include "kernel_patcher.h" #include "kernel_patcher.h"
#include "MemoryOperation.h"
//#include "sse3_patcher.h" //#include "sse3_patcher.h"
//#include "sse3_5_patcher.h" //#include "sse3_5_patcher.h"

View File

@ -178,28 +178,7 @@ extern LIST_ENTRY gKextList; // Jief : globals variables... not great.
// //
//void KextPatcherStart(LOADER_ENTRY *Entry); //void KextPatcherStart(LOADER_ENTRY *Entry);
//
// Searches Source for Search pattern of size SearchSize
// and returns the number of occurences.
//
UINTN SearchAndCount(const UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize);
BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSize, const UINT8 *Mask, UINTN MaskSize);
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize);
UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize);
UINTN FindRelative32(const UINT8 *Source, UINTN Start, UINTN SourceSize, UINTN taskLocation); UINTN FindRelative32(const UINT8 *Source, UINTN Start, UINTN SourceSize, UINTN taskLocation);
//UINTN FindSection(const UINT8 *Source, UINTN len, const UINT8* seg, const UINT8* sec);
//
// Searches Source for Search pattern of size SearchSize
// and replaces it with Replace up to MaxReplaces times.
// If MaxReplaces <= 0, then there is no restriction on number of replaces.
// Replace should have the same size as Search.
// Returns number of replaces done.
//
UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces);
UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, const UINT8 *MaskSearch, UINTN SearchSize,
const UINT8 *Replace, const UINT8 *MaskReplace, INTN MaxReplaces);
#endif /* !__LIBSAIO_KERNEL_PATCHER_H */ #endif /* !__LIBSAIO_KERNEL_PATCHER_H */

View File

@ -10,6 +10,7 @@ extern "C" {
#include "../Platform/plist/plist.h" #include "../Platform/plist/plist.h"
#include "../Platform/Settings.h" #include "../Platform/Settings.h"
#include "../Platform/guid.h" #include "../Platform/guid.h"
#include "MemoryOperation.h"
#ifndef DEBUG_ALL #ifndef DEBUG_ALL
#define KEXT_INJECT_DEBUG 1 #define KEXT_INJECT_DEBUG 1
@ -1127,7 +1128,7 @@ void EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
patchLocation2 = FindMemMask(&KernelData[procLocation], 0x500, find3, sizeof(find3), mask3, sizeof(mask3)); patchLocation2 = FindMemMask(&KernelData[procLocation], 0x500, find3, sizeof(find3), mask3, sizeof(mask3));
DBG("IOTaskHasEntitlement at 0x%llx, loadExecutable at 0x%llx\n", taskLocation, procLocation); DBG("IOTaskHasEntitlement at 0x%llx, loadExecutable at 0x%llx\n", taskLocation, procLocation);
DBG("find3 at 0x%llx\n", patchLocation2); DBG("find3 at 0x%llx\n", patchLocation2);
if (patchLocation2 != KERNEL_MAX_SIZE) { if (patchLocation2 != MAX_UINTN) {
DBG_RT("=> patch SIP applied\n"); DBG_RT("=> patch SIP applied\n");
patchLocation2 += procLocation; patchLocation2 += procLocation;
KernelData[patchLocation2 + 3] = 0xEB; KernelData[patchLocation2 + 3] = 0xEB;
@ -1247,7 +1248,7 @@ void EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
} else { } else {
*/ */
//The patch is not needed for bigsur //The patch is not needed for bigsur
if (patchLocation3 != KERNEL_MAX_SIZE) { if (patchLocation3 != MAX_UINTN) {
DBG("==> patched KxldUnmap (10.14 - 10.15)\n"); DBG("==> patched KxldUnmap (10.14 - 10.15)\n");
// 00 0F 85 XX XX 00 00 48 // 00 0F 85 XX XX 00 00 48
// 00 90 E9 XX XX 00 00 48 // 00 90 E9 XX XX 00 00 48

View File

@ -21,6 +21,7 @@ extern "C" {
#include "kernel_patcher.h" #include "kernel_patcher.h"
#include "kext_inject.h" #include "kext_inject.h"
#include "../gui/menu_items/menu_items.h" #include "../gui/menu_items/menu_items.h"
#include "MemoryOperation.h"
#define OLD_METHOD 0 #define OLD_METHOD 0
@ -40,97 +41,6 @@ extern "C" {
#endif #endif
// runtime debug
//#define DBG_RT(...) if ( KernelAndKextPatches.KPDebug ) { printf(__VA_ARGS__); }
//
// Searches Source for Search pattern of size SearchSize
// and returns the number of occurences.
//
UINTN SearchAndCount(const UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize)
{
UINTN NumFounds = 0;
const UINT8 *End = Source + SourceSize;
while (Source < End) {
if (CompareMem(Source, Search, SearchSize) == 0) {
NumFounds++;
Source += SearchSize;
} else {
Source++;
}
}
return NumFounds;
}
//
// Searches Source for Search pattern of size SearchSize
// and replaces it with Replace up to MaxReplaces times.
// If MaxReplaces <= 0, then there is no restriction on number of replaces.
// Replace should have the same size as Search.
// Returns number of replaces done.
//
UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
// UINT8 *Begin = Source;
UINT8 *End = Source + SourceSize;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
if (CompareMem(Source, Search, SearchSize) == 0) {
// printf(" found pattern at %llx\n", (UINTN)(Source - Begin));
CopyMem(Source, Replace, SearchSize);
NumReplaces++;
MaxReplaces--;
Source += SearchSize;
} else {
Source++;
}
}
return NumReplaces;
}
BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSize, const UINT8 *Mask, UINTN MaskSize)
{
UINT8 M;
if (!Mask || MaskSize == 0) {
return !CompareMem(Source, Search, SearchSize);
}
for (UINTN Ind = 0; Ind < SearchSize; Ind++) {
if (Ind < MaskSize)
M = *Mask++;
else M = 0xFF;
if ((*Source++ & M) != (*Search++ & M)) {
return FALSE;
}
}
return TRUE;
}
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize)
{
UINT8 M, D;
// the procedure is called from SearchAndReplaceMask with own check but for future it is better to check twice
if (!Dest || !Replace) {
return;
}
if (!Mask) {
CopyMem(Dest, Replace, SearchSize); //old behavior
return;
}
for (UINTN Ind = 0; Ind < SearchSize; Ind++) {
M = *Mask++;
D = *Dest;
*Dest++ = ((D ^ *Replace++) & M) ^ D;
}
}
// search a pattern like // search a pattern like
// call task or jmp address // call task or jmp address
//return the address next to the command //return the address next to the command
@ -173,104 +83,6 @@ UINTN FindSection(const UINT8 *Source, UINTN len, const UINT8* seg, const UINT8*
return 0; return 0;
} }
*/ */
UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize)
{
if (!Source || !Search || !SearchSize) {
return KERNEL_MAX_SIZE;
}
for (UINTN i = 0; i < SourceSize - SearchSize; ++i) {
if (CompareMemMask(&Source[i], Search, SearchSize, MaskSearch, MaskSize)) {
return i;
}
}
return KERNEL_MAX_SIZE;
}
UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, const UINT8 *MaskSearch, UINTN SearchSize,
const UINT8 *Replace, const UINT8 *MaskReplace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
UINT8 *End = Source + SourceSize;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
if (CompareMemMask((const UINT8 *)Source, Search, SearchSize, MaskSearch, SearchSize)) {
CopyMemMask(Source, Replace, MaskReplace, SearchSize);
NumReplaces++;
MaxReplaces--;
Source += SearchSize;
} else {
Source++;
}
}
return NumReplaces;
}
UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *Replace, INTN MaxReplaces)
{
UINTN NumReplaces = 0;
UINTN Skip = 0;
BOOLEAN NoReplacesRestriction = MaxReplaces <= 0;
UINT8 *End = Source + SourceSize;
const UINT8 *SearchEnd = Search + SearchSize;
const UINT8 *Pos = NULL;
UINT8 *SourcePos = NULL;
UINT8 *FirstMatch = Source;
if (!Source || !Search || !Replace || !SearchSize) {
return 0;
}
while (((Source + SearchSize) <= End) &&
(NoReplacesRestriction || (MaxReplaces > 0))) { // num replaces
while (*Source != '\0') { //comparison
Pos = Search;
FirstMatch = Source;
Skip = 0;
while (*Source != '\0' && Pos != SearchEnd) {
if (*Source <= 0x20) { //skip invisibles in sources
Source++;
Skip++;
continue;
}
if (*Source != *Pos) {
break;
}
// printf("%c", *Source);
Source++;
Pos++;
}
if (Pos == SearchEnd) { // pattern found
SourcePos = FirstMatch;
break;
}
else
SourcePos = NULL;
Source = FirstMatch + 1;
/* if (Pos != Search) {
printf("\n");
} */
}
if (!SourcePos) {
break;
}
CopyMem(SourcePos, Replace, SearchSize);
SetMem(SourcePos + SearchSize, Skip, 0x20); //fill skip places with spaces
NumReplaces++;
MaxReplaces--;
Source = FirstMatch + SearchSize + Skip;
}
return NumReplaces;
}
/** Global for storing KextBundleIdentifier */ /** Global for storing KextBundleIdentifier */
CHAR8 gKextBundleIdentifier[256]; CHAR8 gKextBundleIdentifier[256];

View File

@ -586,7 +586,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr)
integer = (integer * 16) + (*val++ - 'a' + 10); integer = (integer * 16) + (*val++ - 'a' + 10);
} }
else if ((*val >= 'A' && *val <= 'F')) { // A - F else if ((*val >= 'A' && *val <= 'F')) { // A - F
integer = (integer * 16) + (*val++ - 'a' + 10); integer = (integer * 16) + (*val++ - 'A' + 10);
} }
else { else {
MsgLog("ParseTagInteger hex error (0x%hhX) in buffer %s\n", *val, buffer); MsgLog("ParseTagInteger hex error (0x%hhX) in buffer %s\n", *val, buffer);

View File

@ -16,6 +16,8 @@
#include "XToolsCommon_test.h" #include "XToolsCommon_test.h"
#include "XBuffer_tests.h" #include "XBuffer_tests.h"
#include "plist_tests.h" #include "plist_tests.h"
#include "find_replace_mask_Clover_tests.h"
#include "find_replace_mask_OC_tests.h"
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD) #if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
#include "printlib-test.h" #include "printlib-test.h"
@ -33,12 +35,23 @@ bool all_tests()
bool all_ok = true; bool all_ok = true;
int ret; int ret;
// ret = XString_tests(); // ret = XString_tests();
// if ( ret != 0 ) { // if ( ret != 0 ) {
// printf("XString16_tests() failed at test %d\n", ret); // printf("XString16_tests() failed at test %d\n", ret);
// all_ok = false; // all_ok = false;
// } // }
#if defined(JIEF_DEBUG) #if defined(JIEF_DEBUG)
ret = find_replace_mask_Clover_tests();
if ( ret != 0 ) {
printf("xml_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = find_replace_mask_OC_tests();
if ( ret != 0 ) {
printf("xml_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
// return 1;
ret = printf_lite_tests(); ret = printf_lite_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("printf_lite_tests() failed at test %d\n", ret); printf("printf_lite_tests() failed at test %d\n", ret);
@ -57,59 +70,59 @@ bool all_tests()
// } // }
#endif #endif
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD) #if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
ret = printlib_tests(); ret = printlib_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("printlib_tests() failed at test %d\n", ret); printf("printlib_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
#endif #endif
#ifndef _MSC_VER #ifndef _MSC_VER
ret = printf_lite_tests(); ret = printf_lite_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("printf_lite_tests() failed at test %d\n", ret); printf("printf_lite_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
#endif #endif
ret = strlen_tests(); ret = strlen_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("strlen_tests() failed at test %d\n", ret); printf("strlen_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = strcmp_tests(); ret = strcmp_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("strcmp_tests() failed at test %d\n", ret); printf("strcmp_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = strncmp_tests(); ret = strncmp_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("strncmp_tests() failed at test %d\n", ret); printf("strncmp_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = XToolsCommon_tests(); ret = XToolsCommon_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("printlib_tests() failed at test %d\n", ret); printf("printlib_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = XArray_tests(); ret = XArray_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("XArray_tests() failed at test %d\n", ret); printf("XArray_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = XObjArray_tests(); ret = XObjArray_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("XObjArray_tests() failed at test %d\n", ret); printf("XObjArray_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = XString_tests(); ret = XString_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("XString_tests() failed at test %d\n", ret); printf("XString_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = XStringArray_tests(); ret = XStringArray_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("XStringArray_tests() failed at test %d\n", ret); printf("XStringArray_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = BootOptions_tests(); ret = BootOptions_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("BootOptions_tests() failed at test %d\n", ret); printf("BootOptions_tests() failed at test %d\n", ret);
@ -120,29 +133,34 @@ bool all_tests()
printf("XBuffer_tests() failed at test %d\n", ret); printf("XBuffer_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
ret = plist_tests(); ret = find_replace_mask_Clover_tests();
if ( ret != 0 ) { if ( ret != 0 ) {
printf("plist_tests() failed at test %d\n", ret); printf("xml_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = find_replace_mask_OC_tests();
if ( ret != 0 ) {
printf("xml_lite_tests() failed at test %d\n", ret);
all_ok = false; all_ok = false;
} }
if ( !all_ok ) { if ( !all_ok ) {
printf("A test failed\n"); printf("A test failed\n");
} }
#if defined(JIEF_DEBUG) #if defined(JIEF_DEBUG)
if ( all_ok ) { if ( all_ok ) {
printf("All tests succeeded\n"); printf("All tests succeeded\n");
} }
#endif #endif
#if defined(CLOVER_BUILD) && defined(JIEF_DEBUG) #if defined(CLOVER_BUILD) && defined(JIEF_DEBUG)
if ( all_ok ) { if ( all_ok ) {
// PauseForKey(L"press"); // PauseForKey(L"press");
}else{ }else{
PauseForKey(L"press"); PauseForKey(L"press");
} }
#endif #endif
return all_ok; return all_ok;
} }

View File

@ -0,0 +1,86 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include "../Platform/MemoryOperation.h"
static int breakpoint(int i)
{
return i;
}
int find_replace_mask_Clover_tests()
{
// int ret;
// INT32 int32;
UINTN uintn;
uintn = FindMemMask((UINT8*)"\x01\x11\x02", 3, (UINT8*)"\x11", 1, NULL, 0);
if ( uintn != 1 ) breakpoint(1);
uintn = FindMemMask((UINT8*)"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a", 10, (UINT8*)"\x13\x14", 2, NULL, 0);
if ( uintn != 2 ) breakpoint(1);
uintn = FindMemMask((UINT8*)"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a", 10, (UINT8*)"\x14\x00\x16", 3, (UINT8*)"\xFF\x00\xFF", 3);
if ( uintn != 3 ) breakpoint(1);
uintn = FindMemMask((UINT8*)"\x00\xCC\x00", 3, (UINT8*)"\xC0", 1, (UINT8*)"\xF0", 1);
if ( uintn != 1 ) breakpoint(1);
// Simple patch of 3 bytes
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uintn = SearchAndReplaceMask(buf, 10,
(UINT8*)"\x13\x14\x15", NULL, 3,
(UINT8*)"\x23\x24\x25", NULL,
0);
if ( uintn != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uintn = SearchAndReplaceMask(buf, 10,
(UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3,
(UINT8*)"\x23\x24\x25", NULL,
0);
if ( uintn != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask and replacemask. Mask replace bits same place as Mask find
// Find x13x00x15/0xFFx00xFF Replace x23x24x25/xFFx00xFF
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x14, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uintn = SearchAndReplaceMask(buf, 10,
(UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3,
(UINT8*)"\x23\x24\x25", (UINT8*)"\xFF\x00\xFF",
0);
if ( uintn != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask and replacemask. Mask replace bits NOT same place as Mask find
// Find x13x00x15/0xFFx00xFF Replace x23x24x25/xFFxFFx00
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
uintn = SearchAndReplaceMask(buf, 10,
(UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3,
(UINT8*)"\x23\x24\x25", (UINT8*)"\xFF\xFF\x00",
0);
if ( uintn != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch half a byte
{
UINT8 buf[] = { 0x11, 0xCC, 0x13 };
UINT8 expectedBuf[] = { 0x11, 0xC2, 0x13 };
uintn = SearchAndReplaceMask(buf, 3,
(UINT8*)"\xC0", (UINT8*)"\xF0", 1,
(UINT8*)"\x22", (UINT8*)"\x0F",
0);
if ( uintn != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 3) != 0 ) breakpoint(1);
}
return 0;
}

View File

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

View File

@ -0,0 +1,99 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
//#include "../../OpenCorePkg/Include/Acidanthera/Library/OcMiscLib.h"
INT32
FindPattern (
IN CONST UINT8 *Pattern,
IN CONST UINT8 *PatternMask OPTIONAL,
IN CONST UINT32 PatternSize,
IN CONST UINT8 *Data,
IN UINT32 DataSize,
IN INT32 DataOff
);
UINT32
ApplyPatch (
IN CONST UINT8 *Pattern,
IN CONST UINT8 *PatternMask OPTIONAL,
IN CONST UINT32 PatternSize,
IN CONST UINT8 *Replace,
IN CONST UINT8 *ReplaceMask OPTIONAL,
IN UINT8 *Data,
IN UINT32 DataSize,
IN UINT32 Count,
IN UINT32 Skip
);
static int breakpoint(int i)
{
return i;
}
int find_replace_mask_OC_tests()
{
// int ret;
INT32 int32;
UINT32 uint32;
int32 = FindPattern((UINT8*)"\x11", NULL, 1, (UINT8*)"\x01\x11\x02", 3, 0);
if ( int32 != 1 ) breakpoint(1);
int32 = FindPattern((UINT8*)"\x13\x14", NULL, 2, (UINT8*)"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a", 10, 0);
if ( int32 != 2 ) breakpoint(1);
int32 = FindPattern((UINT8*)"\x14\x00\x16", (UINT8*)"\xFF\x00\xFF", 3, (UINT8*)"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a", 10, 0);
if ( int32 != 3 ) breakpoint(1);
int32 = FindPattern((UINT8*)"\xC0", (UINT8*)"\xF0", 1, (UINT8*)"\x00\xCC\x00", 3, 0);
if ( int32 != 1 ) breakpoint(1);
// Simple patch of 3 bytes
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uint32 = ApplyPatch( (UINT8*)"\x13\x14\x15", NULL, 3, (UINT8*)"\x23\x24\x25", NULL, buf, 10, 0, 0);
if ( uint32 != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uint32 = ApplyPatch( (UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3, (UINT8*)"\x23\x24\x25", NULL, buf, 10, 0, 0);
if ( uint32 != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask and replacemask
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x14, 0x25, 0x16, 0x17, 0x18, 0x19, 0x20 };
uint32 = ApplyPatch( (UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3, (UINT8*)"\x23\x24\x25", (UINT8*)"\xFF\x00\xFF", buf, 10, 0, 0);
if ( uint32 != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch 3 bytes with find mask and replacemask
{
UINT8 buf[] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
UINT8 expectedBuf[] = { 0x11, 0x12, 0x23, 0x24, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 };
uint32 = ApplyPatch(
(UINT8*)"\x13\x00\x15", (UINT8*)"\xFF\x00\xFF", 3,
(UINT8*)"\x23\x24\x25", (UINT8*)"\xFF\xFF\x00",
buf, 10, 0, 0);
if ( uint32 != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 10) != 0 ) breakpoint(1);
}
// Patch half a byte
{
UINT8 buf[] = { 0x11, 0xCC, 0x13 };
UINT8 expectedBuf[] = { 0x11, 0xC2, 0x13 };
uint32 = ApplyPatch((UINT8*)"\xC0", (UINT8*)"\xF0", 1,
(UINT8*)"\x22", (UINT8*)"\x0F",
buf, 3, 0, 0);
if ( uint32 != 1 ) breakpoint(1);
if ( memcmp(buf, expectedBuf, 3) != 0 ) breakpoint(1);
}
return 0;
}

View File

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

View File

@ -180,6 +180,8 @@
Platform/LegacyBoot.h Platform/LegacyBoot.h
Platform/LegacyBoot.cpp Platform/LegacyBoot.cpp
Platform/memvendors.h Platform/memvendors.h
Platform/MemoryOperation.h
Platform/MemoryOperation.c
Platform/nvidia.h Platform/nvidia.h
Platform/nvidia.cpp Platform/nvidia.cpp
Platform/Net.h Platform/Net.h
@ -286,6 +288,10 @@
# cpp_foundation/XUINTN.h # cpp_foundation/XUINTN.h
cpp_unit_test/all_tests.h cpp_unit_test/all_tests.h
cpp_unit_test/all_tests.cpp cpp_unit_test/all_tests.cpp
cpp_unit_test/find_replace_mask_Clover_tests.h
cpp_unit_test/find_replace_mask_Clover_tests.cpp
cpp_unit_test/find_replace_mask_OC_tests.h
cpp_unit_test/find_replace_mask_OC_tests.cpp
cpp_unit_test/global_test.h cpp_unit_test/global_test.h
cpp_unit_test/global_test.cpp cpp_unit_test/global_test.cpp
cpp_unit_test/LoadOptions_test.cpp cpp_unit_test/LoadOptions_test.cpp

View File

@ -186,6 +186,7 @@ EFI_STATUS ReinitRefitLib(void)
self.reInitialize(); self.reInitialize();
selfOem.reInitialize(); selfOem.reInitialize();
ReinitVolumes();
ThemeX.openThemeDir(); ThemeX.openThemeDir();
return EFI_SUCCESS; return EFI_SUCCESS;