From 8630dc83df4741ae3bdda52491292fe09fade1bc Mon Sep 17 00:00:00 2001 From: huiyadanli Date: Wed, 1 Jan 2020 15:20:55 +0800 Subject: [PATCH] =?UTF-8?q?[+]=20=E6=B7=BB=E5=8A=A0=E7=89=B9=E5=BE=81?= =?UTF-8?q?=E7=A0=81=E8=AF=86=E5=88=AB=E6=9B=BF=E6=8D=A2=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=8C=83=E5=9B=B4=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/0.6/patch.json | 2 +- .../Matcher/BoyerMooreMatcher.cs | 8 +--- .../Matcher/FuzzyMatcher.cs | 2 +- RevokeMsgPatcher/Modifier/AppModifier.cs | 45 +++++++++++++++++++ RevokeMsgPatcher/Modifier/FileHexEditor.cs | 23 ++++++++++ RevokeMsgPatcher/RevokeMsgPatcher.csproj | 2 + 6 files changed, 73 insertions(+), 9 deletions(-) rename {RevokeMsgPatcher.Assistant => RevokeMsgPatcher}/Matcher/BoyerMooreMatcher.cs (97%) rename {RevokeMsgPatcher.Assistant => RevokeMsgPatcher}/Matcher/FuzzyMatcher.cs (98%) diff --git a/RevokeMsgPatcher.Assistant/Data/0.6/patch.json b/RevokeMsgPatcher.Assistant/Data/0.6/patch.json index 53dcb63..1fcc924 100644 --- a/RevokeMsgPatcher.Assistant/Data/0.6/patch.json +++ b/RevokeMsgPatcher.Assistant/Data/0.6/patch.json @@ -1 +1 @@ -{"Apps":{"Wechat":{"Name":"Wechat","FileTargetInfos":{"WeChatWin.dll":{"Name":"WeChatWin.dll","RelativePath":"WeChatWin.dll","Memo":null}},"FileModifyInfos":{"WeChatWin.dll":[{"Name":"WeChatWin.dll","Version":"2.8.0.82","SHA1Before":"c359cc1a391441d261753f2844f9156638df8631","SHA1After":"d1b4dee8f7f91e34d68501987fd0675b33fe85da","Changes":[{"Position":2645961,"Content":[235]},{"Position":8263344,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.2.78","SHA1Before":"26a5c5503f1e176676da5657c12812da8aaa0243","SHA1After":"d338215a815c09755c04949995ec3e4eab8dce60","Changes":[{"Position":2645673,"Content":[235]},{"Position":8262528,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.2.76","SHA1Before":"0003c7b2c0136a0eb2a6cfc2c694cb57b04b5517","SHA1After":"88af6055a0f4d3bdaa6f717ec8b263d4418487b6","Changes":[{"Position":2644905,"Content":[235]},{"Position":8261024,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.88","SHA1Before":"034059bad50dd793140952391bfa7936133e69b4","SHA1After":"dd6d80c30ca9e0ea9f7d2f1add498fc9aa4bc7a0","Changes":[{"Position":2499465,"Content":[235]},{"Position":7952304,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.85","SHA1Before":"de0df4e138b72460450f66c029e33f4510f5e2df","SHA1After":"fbd35720aaff3cdcfd3ff18ea503dc06450e5c99","Changes":[{"Position":2499465,"Content":[235]},{"Position":7952000,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.82","SHA1Before":"20e111a18872bf6c7148a897c11da26c1ec95520","SHA1After":"1e0741d325ca6b1cd2402b829a3d13a2524af617","Changes":[{"Position":2499465,"Content":[235]},{"Position":7951952,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.74","SHA1Before":"b1eaf7edc074a88be5d0f89230436cc2084d24d2","SHA1After":"eb3d74ccd87a09059a005f4972861898fc3de463","Changes":[{"Position":2499465,"Content":[235]},{"Position":7951696,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.65","SHA1Before":"8346b97d264725da924d240c6eb77df3e693385e","SHA1After":"42bab2c9c79ef4f2088c00ea6d817973e14a5e6e","Changes":[{"Position":2495545,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.59","SHA1Before":"df954d403edaca89cd5394927a325a0023e93281","SHA1After":"6aa22460c91bb5c5e2f0ec1af99b8a5f6d4318c0","Changes":[{"Position":2496073,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.43","SHA1Before":"39cd9e09e1a3eac09e6808749bff525c9e3216ce","SHA1After":"7b829f1ff0217e346a80f9510fdd7634ddd49445","Changes":[{"Position":2494169,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.0.70","SHA1Before":"3b0601864aff3c1d792f812ad1ca05f02aa761e3","SHA1After":"1e8734d32b0a8c12758e30f99c77f729991fb071","Changes":[{"Position":2475657,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.0.65","SHA1Before":"063c2e05a0df1bdb8987c2d978d93499bd2052ba","SHA1After":"5ed4c09a4f18643b967f063a824d7e65d0567f8a","Changes":[{"Position":2475449,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.68","SHA1Before":"2e9417f4276b12fe32ca7b4fee49272a4a2af334","SHA1After":"699602ee3cbb9ae5714f6e6ebc658c875a6c66e6","Changes":[{"Position":2454006,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.65","SHA1Before":"e01f6855a96c12c30808960903ed199a33e4952c","SHA1After":"d9120569cfd0433aebea107d7b90805cbbac7518","Changes":[{"Position":2454265,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.52","SHA1Before":"88131302f664df6a657c9ca49d152da536fe5729","SHA1After":"8d1454b73831644181e962c1fa0ea4e2da4124a3","Changes":[{"Position":2453049,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.51","SHA1Before":"d0a5517b1292a751501b00b4b1f0702db2d9fc30","SHA1After":"53e7b1525d49bf2c3250a8131ff0ba2510779b78","Changes":[{"Position":2452614,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.37","SHA1Before":"7e01f8b04a158a4a50bc5a6e67c2fb8b02233170","SHA1After":"a1895004415fe9bcd7e690bd6e482b833b515599","Changes":[{"Position":2452614,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.57","SHA1Before":"80a91aaf941bcb1c24a7d672838ac73e9ebb2e40","SHA1After":"a0d3f9a45a835f97aef7fe0872387d8cfb5c25a4","Changes":[{"Position":2433413,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.40","SHA1Before":"04bd0cb28df6630b518f42a3f9c2caa4a9359fbc","SHA1After":"13c91cf1d4609959771fd137b9a86a5ca365e1b6","Changes":[{"Position":2432934,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.32","SHA1Before":"a02519c1007ee6723947c262c720d63c619f633e","SHA1After":"f3007471ca8734c29783c25f0bb49949a783a44","Changes":[{"Position":2432806,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.6.28","SHA1Before":"0b19cb17a62c3ea0efce0fb675a1d3b17845cba3","SHA1After":"260948656725446b818ea668273ceff02ddfb44d","Changes":[{"Position":2401678,"Content":[116]}]}]},"FileCommonModifyInfos":null},"QQ":{"Name":"QQ","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"9.2.2.26569","SHA1Before":"434254e76c520789558e075af677821258536311","SHA1After":"237c9e489a97858a175f0f7c72ade4ebcbac7a69","Changes":[{"Position":371146,"Content":[235,9,144,144,144]},{"Position":371687,"Content":[235,9,144,144,144]},{"Position":372117,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.1.26546","SHA1Before":"8d8ea2c2cbf43f5acf8d684b153e90035352d5f5","SHA1After":"7d194dd5be03982b533d7375c93d9a72587fe28d","Changes":[{"Position":369545,"Content":[235,9,144,144,144]},{"Position":370086,"Content":[235,9,144,144,144]},{"Position":370516,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.0.26453","SHA1Before":"c1935ca6347b0c2a7e6108a7f8ee0643d39deb66","SHA1After":"42811188a7e7b346a6a3c1066936b98c747acaf6","Changes":[{"Position":353794,"Content":[235,9,144,144,144]},{"Position":354335,"Content":[235,9,144,144,144]},{"Position":354767,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.0.26389","SHA1Before":"6f8855fb80acfa456f8f69989fe949308fe4d154","SHA1After":"f6b8e05a178b9b10ba17c597fa0a44b7a2a966a8","Changes":[{"Position":356808,"Content":[235,9,144,144,144]},{"Position":357349,"Content":[235,9,144,144,144]},{"Position":357781,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.9.26361","SHA1Before":"022d3433d13d07a354c38816f61cb0b7ac60d3fd","SHA1After":"873a57c1fb51cdd099c8cb7108b5ab5cb4459557","Changes":[{"Position":354270,"Content":[235,9,144,144,144]},{"Position":354811,"Content":[235,9,144,144,144]},{"Position":355243,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.9.26346","SHA1Before":"895eb70f707b8222e6460c91492b1281e525059b","SHA1After":"0bb83990e2b5b5f23b7b43249941ff638201af54","Changes":[{"Position":354270,"Content":[235,9,144,144,144]},{"Position":354811,"Content":[235,9,144,144,144]},{"Position":355243,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.8.26211","SHA1Before":"a950d3cf5e8925f7775624271105ef78d9c5cb57","SHA1After":"dffc1cb87b91e6467e13c935611f2f7fd76b9a8d","Changes":[{"Position":337135,"Content":[235,9,144,144,144]},{"Position":337676,"Content":[235,9,144,144,144]},{"Position":338108,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.7.25980","SHA1Before":"c6632339fbe675312a70ae4620e70699c258cd36","SHA1After":"e9ddc5cc681950796fc8fe4c55f580428c890b51","Changes":[{"Position":327839,"Content":[235,9,144,144,144]},{"Position":328380,"Content":[235,9,144,144,144]},{"Position":328812,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.0.4.23786","SHA1Before":"69a714f4eadb09f1453f6f022d4adbcd801cfab8","SHA1After":"b48e77a924076b3ebdffc4af514c868c551d2bca","Changes":[{"Position":318321,"Content":[235,7,144,144,144]},{"Position":318862,"Content":[235,7,144,144,144]},{"Position":319379,"Content":[235,7,144,144,144]}]}]},"FileCommonModifyInfos":null},"TIM":{"Name":"TIM","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"2.3.2.21173","SHA1Before":"ecf3e69f3fb100ffe2fee095ffded591b9781024","SHA1After":"0514d1304e7ac46b4d33386ec3313888f5ae7171","Changes":[{"Position":317322,"Content":[235,9,144,144,144]},{"Position":317863,"Content":[235,9,144,144,144]},{"Position":318295,"Content":[235,8,144,144,144,144]}]}]},"FileCommonModifyInfos":null},"QQLite":{"Name":"QQLite","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"7.9.14314.0","SHA1Before":"2e97d7671963fa148a1beeda6ce4964314310593","SHA1After":"723c008fb53435ead20fa6f2e951c9a4a8ff46da","Changes":[{"Position":148741,"Content":[235,2,144,144]},{"Position":149689,"Content":[235,2,144,144]}]},{"Name":"IM.dll","Version":"7.9.14308.0","SHA1Before":"b8a7a873178706b97be11c25f13bcf09e9e578a2","SHA1After":"c5bf533c7af6996b42d1fb2a0fb3f26dfd52f8bf","Changes":[{"Position":148741,"Content":[235,2,144,144]},{"Position":149689,"Content":[235,2,144,144]}]}]},"FileCommonModifyInfos":null}},"LatestVersion":"0.6","Notice":""} \ No newline at end of file +{"Apps":{"Wechat":{"Name":"Wechat","FileTargetInfos":{"WeChatWin.dll":{"Name":"WeChatWin.dll","RelativePath":"WeChatWin.dll","Memo":null}},"FileModifyInfos":{"WeChatWin.dll":[{"Name":"WeChatWin.dll","Version":"2.8.0.82","SHA1Before":"c359cc1a391441d261753f2844f9156638df8631","SHA1After":"d1b4dee8f7f91e34d68501987fd0675b33fe85da","Changes":[{"Position":2645961,"Content":[235]},{"Position":8263344,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.2.78","SHA1Before":"26a5c5503f1e176676da5657c12812da8aaa0243","SHA1After":"d338215a815c09755c04949995ec3e4eab8dce60","Changes":[{"Position":2645673,"Content":[235]},{"Position":8262528,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.2.76","SHA1Before":"0003c7b2c0136a0eb2a6cfc2c694cb57b04b5517","SHA1After":"88af6055a0f4d3bdaa6f717ec8b263d4418487b6","Changes":[{"Position":2644905,"Content":[235]},{"Position":8261024,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.88","SHA1Before":"034059bad50dd793140952391bfa7936133e69b4","SHA1After":"dd6d80c30ca9e0ea9f7d2f1add498fc9aa4bc7a0","Changes":[{"Position":2499465,"Content":[235]},{"Position":7952304,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.85","SHA1Before":"de0df4e138b72460450f66c029e33f4510f5e2df","SHA1After":"fbd35720aaff3cdcfd3ff18ea503dc06450e5c99","Changes":[{"Position":2499465,"Content":[235]},{"Position":7952000,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.82","SHA1Before":"20e111a18872bf6c7148a897c11da26c1ec95520","SHA1After":"1e0741d325ca6b1cd2402b829a3d13a2524af617","Changes":[{"Position":2499465,"Content":[235]},{"Position":7951952,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.74","SHA1Before":"b1eaf7edc074a88be5d0f89230436cc2084d24d2","SHA1After":"eb3d74ccd87a09059a005f4972861898fc3de463","Changes":[{"Position":2499465,"Content":[235]},{"Position":7951696,"Content":[195]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.65","SHA1Before":"8346b97d264725da924d240c6eb77df3e693385e","SHA1After":"42bab2c9c79ef4f2088c00ea6d817973e14a5e6e","Changes":[{"Position":2495545,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.59","SHA1Before":"df954d403edaca89cd5394927a325a0023e93281","SHA1After":"6aa22460c91bb5c5e2f0ec1af99b8a5f6d4318c0","Changes":[{"Position":2496073,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.1.43","SHA1Before":"39cd9e09e1a3eac09e6808749bff525c9e3216ce","SHA1After":"7b829f1ff0217e346a80f9510fdd7634ddd49445","Changes":[{"Position":2494169,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.0.70","SHA1Before":"3b0601864aff3c1d792f812ad1ca05f02aa761e3","SHA1After":"1e8734d32b0a8c12758e30f99c77f729991fb071","Changes":[{"Position":2475657,"Content":[235]}]},{"Name":"WeChatWin.dll","Version":"2.7.0.65","SHA1Before":"063c2e05a0df1bdb8987c2d978d93499bd2052ba","SHA1After":"5ed4c09a4f18643b967f063a824d7e65d0567f8a","Changes":[{"Position":2475449,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.68","SHA1Before":"2e9417f4276b12fe32ca7b4fee49272a4a2af334","SHA1After":"699602ee3cbb9ae5714f6e6ebc658c875a6c66e6","Changes":[{"Position":2454006,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.65","SHA1Before":"e01f6855a96c12c30808960903ed199a33e4952c","SHA1After":"d9120569cfd0433aebea107d7b90805cbbac7518","Changes":[{"Position":2454265,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.52","SHA1Before":"88131302f664df6a657c9ca49d152da536fe5729","SHA1After":"8d1454b73831644181e962c1fa0ea4e2da4124a3","Changes":[{"Position":2453049,"Content":[117]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.51","SHA1Before":"d0a5517b1292a751501b00b4b1f0702db2d9fc30","SHA1After":"53e7b1525d49bf2c3250a8131ff0ba2510779b78","Changes":[{"Position":2452614,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.8.37","SHA1Before":"7e01f8b04a158a4a50bc5a6e67c2fb8b02233170","SHA1After":"a1895004415fe9bcd7e690bd6e482b833b515599","Changes":[{"Position":2452614,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.57","SHA1Before":"80a91aaf941bcb1c24a7d672838ac73e9ebb2e40","SHA1After":"a0d3f9a45a835f97aef7fe0872387d8cfb5c25a4","Changes":[{"Position":2433413,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.40","SHA1Before":"04bd0cb28df6630b518f42a3f9c2caa4a9359fbc","SHA1After":"13c91cf1d4609959771fd137b9a86a5ca365e1b6","Changes":[{"Position":2432934,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.7.32","SHA1Before":"a02519c1007ee6723947c262c720d63c619f633e","SHA1After":"f3007471ca8734c29783c25f0bb49949a783a44","Changes":[{"Position":2432806,"Content":[116]}]},{"Name":"WeChatWin.dll","Version":"2.6.6.28","SHA1Before":"0b19cb17a62c3ea0efce0fb675a1d3b17845cba3","SHA1After":"260948656725446b818ea668273ceff02ddfb44d","Changes":[{"Position":2401678,"Content":[116]}]}]},"FileCommonModifyInfos":{"WeChatWin.dll":[{"Name":"WeChatWin.dll","StartVersion":"2.7.0.0","EndVersion":"","ReplacePatterns":[{"Search":[0,133,192,116,50,185],"Replace":[0,133,192,235,50,185]},{"Search":[192,195,204,204,204,204,204,204,204,204,204,204,204,204,204,204,85,139,236,131,236,20,83,86,87,106,255,15,87,192,199],"Replace":[192,195,204,204,204,204,204,204,204,204,204,204,204,204,204,204,195,139,236,131,236,20,83,86,87,106,255,15,87,192,199]}]}]}},"QQ":{"Name":"QQ","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"9.2.2.26569","SHA1Before":"434254e76c520789558e075af677821258536311","SHA1After":"237c9e489a97858a175f0f7c72ade4ebcbac7a69","Changes":[{"Position":371146,"Content":[235,9,144,144,144]},{"Position":371687,"Content":[235,9,144,144,144]},{"Position":372117,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.1.26546","SHA1Before":"8d8ea2c2cbf43f5acf8d684b153e90035352d5f5","SHA1After":"7d194dd5be03982b533d7375c93d9a72587fe28d","Changes":[{"Position":369545,"Content":[235,9,144,144,144]},{"Position":370086,"Content":[235,9,144,144,144]},{"Position":370516,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.0.26453","SHA1Before":"c1935ca6347b0c2a7e6108a7f8ee0643d39deb66","SHA1After":"42811188a7e7b346a6a3c1066936b98c747acaf6","Changes":[{"Position":353794,"Content":[235,9,144,144,144]},{"Position":354335,"Content":[235,9,144,144,144]},{"Position":354767,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.2.0.26389","SHA1Before":"6f8855fb80acfa456f8f69989fe949308fe4d154","SHA1After":"f6b8e05a178b9b10ba17c597fa0a44b7a2a966a8","Changes":[{"Position":356808,"Content":[235,9,144,144,144]},{"Position":357349,"Content":[235,9,144,144,144]},{"Position":357781,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.9.26361","SHA1Before":"022d3433d13d07a354c38816f61cb0b7ac60d3fd","SHA1After":"873a57c1fb51cdd099c8cb7108b5ab5cb4459557","Changes":[{"Position":354270,"Content":[235,9,144,144,144]},{"Position":354811,"Content":[235,9,144,144,144]},{"Position":355243,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.9.26346","SHA1Before":"895eb70f707b8222e6460c91492b1281e525059b","SHA1After":"0bb83990e2b5b5f23b7b43249941ff638201af54","Changes":[{"Position":354270,"Content":[235,9,144,144,144]},{"Position":354811,"Content":[235,9,144,144,144]},{"Position":355243,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.8.26211","SHA1Before":"a950d3cf5e8925f7775624271105ef78d9c5cb57","SHA1After":"dffc1cb87b91e6467e13c935611f2f7fd76b9a8d","Changes":[{"Position":337135,"Content":[235,9,144,144,144]},{"Position":337676,"Content":[235,9,144,144,144]},{"Position":338108,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.1.7.25980","SHA1Before":"c6632339fbe675312a70ae4620e70699c258cd36","SHA1After":"e9ddc5cc681950796fc8fe4c55f580428c890b51","Changes":[{"Position":327839,"Content":[235,9,144,144,144]},{"Position":328380,"Content":[235,9,144,144,144]},{"Position":328812,"Content":[235,8,144,144,144,144]}]},{"Name":"IM.dll","Version":"9.0.4.23786","SHA1Before":"69a714f4eadb09f1453f6f022d4adbcd801cfab8","SHA1After":"b48e77a924076b3ebdffc4af514c868c551d2bca","Changes":[{"Position":318321,"Content":[235,7,144,144,144]},{"Position":318862,"Content":[235,7,144,144,144]},{"Position":319379,"Content":[235,7,144,144,144]}]}]},"FileCommonModifyInfos":{"IM.dll":[{"Name":"IM.dll","StartVersion":"9.1.7.00000","EndVersion":"","ReplacePatterns":[{"Search":[28,233,157,0,0,0,139,69,232,141,85,236,82,137,93,236,104,63,63,63,84,139,8,80,255,81,120,133,192,121,45,141,69,12,199,69,12],"Replace":[28,233,157,0,0,0,139,69,232,141,85,236,82,137,93,236,235,9,144,144,144,139,8,80,255,81,120,133,192,121,45,141,69,12,199,69,12]},{"Search":[28,233,157,0,0,0,139,69,240,141,85,236,82,137,93,236,104,63,63,63,84,139,8,80,255,81,120,133,192,121,45,141,69,12,199,69,12],"Replace":[28,233,157,0,0,0,139,69,240,141,85,236,82,137,93,236,235,9,144,144,144,139,8,80,255,81,120,133,192,121,45,141,69,12,199,69,12]},{"Search":[139,117,20,141,77,244,131,196,32,51,255,137,125,244,139,6,81,104,63,63,63,84,86,255,80,120,133,192,121,57,141,69,12,199,69,12],"Replace":[139,117,20,141,77,244,131,196,32,51,255,137,125,244,139,6,235,8,144,144,144,144,86,255,80,120,133,192,121,57,141,69,12,199,69,12]}]}]}},"TIM":{"Name":"TIM","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"2.3.2.21173","SHA1Before":"ecf3e69f3fb100ffe2fee095ffded591b9781024","SHA1After":"0514d1304e7ac46b4d33386ec3313888f5ae7171","Changes":[{"Position":317322,"Content":[235,9,144,144,144]},{"Position":317863,"Content":[235,9,144,144,144]},{"Position":318295,"Content":[235,8,144,144,144,144]}]}]},"FileCommonModifyInfos":null},"QQLite":{"Name":"QQLite","FileTargetInfos":{"IM.dll":{"Name":"IM.dll","RelativePath":"Bin\\IM.dll","Memo":null}},"FileModifyInfos":{"IM.dll":[{"Name":"IM.dll","Version":"7.9.14314.0","SHA1Before":"2e97d7671963fa148a1beeda6ce4964314310593","SHA1After":"723c008fb53435ead20fa6f2e951c9a4a8ff46da","Changes":[{"Position":148741,"Content":[235,2,144,144]},{"Position":149689,"Content":[235,2,144,144]}]},{"Name":"IM.dll","Version":"7.9.14308.0","SHA1Before":"b8a7a873178706b97be11c25f13bcf09e9e578a2","SHA1After":"c5bf533c7af6996b42d1fb2a0fb3f26dfd52f8bf","Changes":[{"Position":148741,"Content":[235,2,144,144]},{"Position":149689,"Content":[235,2,144,144]}]}]},"FileCommonModifyInfos":null}},"LatestVersion":"0.6","Notice":""} \ No newline at end of file diff --git a/RevokeMsgPatcher.Assistant/Matcher/BoyerMooreMatcher.cs b/RevokeMsgPatcher/Matcher/BoyerMooreMatcher.cs similarity index 97% rename from RevokeMsgPatcher.Assistant/Matcher/BoyerMooreMatcher.cs rename to RevokeMsgPatcher/Matcher/BoyerMooreMatcher.cs index 9233a0c..d60385e 100644 --- a/RevokeMsgPatcher.Assistant/Matcher/BoyerMooreMatcher.cs +++ b/RevokeMsgPatcher/Matcher/BoyerMooreMatcher.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace RevokeMsgPatcher.Assistant.Matcher +namespace RevokeMsgPatcher.Matcher { public class BoyerMooreMatcher { diff --git a/RevokeMsgPatcher.Assistant/Matcher/FuzzyMatcher.cs b/RevokeMsgPatcher/Matcher/FuzzyMatcher.cs similarity index 98% rename from RevokeMsgPatcher.Assistant/Matcher/FuzzyMatcher.cs rename to RevokeMsgPatcher/Matcher/FuzzyMatcher.cs index f1fc46a..bdae586 100644 --- a/RevokeMsgPatcher.Assistant/Matcher/FuzzyMatcher.cs +++ b/RevokeMsgPatcher/Matcher/FuzzyMatcher.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace RevokeMsgPatcher.Assistant.Matcher +namespace RevokeMsgPatcher.Matcher { /// /// 对16进制数据进行通配符查找 diff --git a/RevokeMsgPatcher/Modifier/AppModifier.cs b/RevokeMsgPatcher/Modifier/AppModifier.cs index 827520e..78a144e 100644 --- a/RevokeMsgPatcher/Modifier/AppModifier.cs +++ b/RevokeMsgPatcher/Modifier/AppModifier.cs @@ -69,6 +69,40 @@ namespace RevokeMsgPatcher.Modifier } } + /// + /// 判断版本是否处于版本范围,特殊版本的可以重载此方法 + /// + /// 当前版本 + /// 起始版本 + /// 结束版本,为空为不限制 + /// + public bool IsInVersionRange(string version, string start, string end) + { + try + { + int v = Convert.ToInt32(version.Replace(".", "")); + int s = Convert.ToInt32(start.Replace(".", "")); + int e = 0; + if (string.IsNullOrEmpty(end)) + { + e = int.MaxValue; + } + else + { + e = Convert.ToInt32(end.Replace(".", "")); + } + if (v >= s && v <= e) + { + return true; + } + } + catch (Exception e) + { + Console.WriteLine("判断版本范围时出错:" + e.Message); + } + return false; + } + /// /// a.初始化修改器 /// @@ -115,6 +149,17 @@ namespace RevokeMsgPatcher.Modifier } } + // 多个版本范围,匹配通用的补丁替换方式 + foreach (CommonModifyInfo commonModifyInfo in config.FileCommonModifyInfos[editor.FileName]) + { + // editor.FileVersion 在 StartVersion 和 EndVersion 之间 + if (IsInVersionRange(editor.FileVersion, commonModifyInfo.StartVersion, commonModifyInfo.EndVersion)) + { + editor.FileCommonModifyInfo = commonModifyInfo; + break; + } + } + // 补丁前SHA1匹配上,肯定是正确的dll if (matchingSHA1Before != null) { diff --git a/RevokeMsgPatcher/Modifier/FileHexEditor.cs b/RevokeMsgPatcher/Modifier/FileHexEditor.cs index d4ecb16..6973970 100644 --- a/RevokeMsgPatcher/Modifier/FileHexEditor.cs +++ b/RevokeMsgPatcher/Modifier/FileHexEditor.cs @@ -17,6 +17,8 @@ namespace RevokeMsgPatcher.Modifier public string FileBakPath { get; set; } + private string fileReplacedPath; + private string version; public string FileVersion { @@ -45,27 +47,48 @@ namespace RevokeMsgPatcher.Modifier public TargetInfo FileTargetInfo { get; set; } + /// + /// 通过比对SHA1得到的特定版本的修改信息 + /// public ModifyInfo FileModifyInfo { get; set; } + /// + /// 通过比对版本范围得到的通用查找替换的修改信息 + /// + public CommonModifyInfo FileCommonModifyInfo { get; set; } + public FileHexEditor(string installPath, TargetInfo target) { FileTargetInfo = target.Clone(); FileName = FileTargetInfo.Name; FilePath = Path.Combine(installPath, FileTargetInfo.RelativePath); FileBakPath = FilePath + ".h.bak"; + fileReplacedPath = FilePath + ".h.process"; } + /// + /// 备份 + /// public void Backup() { File.Copy(FilePath, FileBakPath, true); } + /// + /// 打补丁 + /// 优先使用特定的补丁信息(存在对应SHA1信息) + /// 不存在补丁信息,使用通用版本替换方法 + /// + /// public bool Patch() { FileUtil.EditMultiHex(FilePath, FileModifyInfo.Changes); return true; } + /// + /// 还原 + /// public void Restore() { File.Copy(FileBakPath, FilePath, true); diff --git a/RevokeMsgPatcher/RevokeMsgPatcher.csproj b/RevokeMsgPatcher/RevokeMsgPatcher.csproj index e996139..078272a 100644 --- a/RevokeMsgPatcher/RevokeMsgPatcher.csproj +++ b/RevokeMsgPatcher/RevokeMsgPatcher.csproj @@ -57,6 +57,8 @@ FormMain.cs + +