mirror of
				https://github.com/huiyadanli/RevokeMsgPatcher.git
				synced 2025-10-31 19:36:08 +08:00 
			
		
		
		
	Merge pull request #330 from huiyadanli/multi-feat-for-wechat-abtest
Multi feat for wechat abtest
This commit is contained in:
		
						commit
						11e348b80a
					
				
							
								
								
									
										1
									
								
								RevokeMsgPatcher.Assistant/Data/1.4/patch.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								RevokeMsgPatcher.Assistant/Data/1.4/patch.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -16,8 +16,8 @@ namespace RevokeMsgPatcher | |||
|             return new Bag | ||||
|             { | ||||
|                 Apps = AppConfig(), | ||||
|                 LatestVersion = "1.3", | ||||
|                 PatchVersion = 20220430, | ||||
|                 LatestVersion = "1.4", | ||||
|                 PatchVersion = 20220514, | ||||
|                 Notice = "" | ||||
|             }; | ||||
|         } | ||||
|  | @ -70,14 +70,35 @@ namespace RevokeMsgPatcher | |||
|                             new CommonModifyInfo | ||||
|                             { | ||||
|                                 Name="WeChatWin.dll", | ||||
|                                 StartVersion="3.6.5.0", | ||||
|                                 StartVersion="3.7.0.0", | ||||
|                                 EndVersion="", | ||||
|                                 ReplacePatterns = new List<ReplacePattern> | ||||
|                                 { | ||||
|                                     new ReplacePattern | ||||
|                                     { | ||||
|                                         Search = ByteUtil.HexStringToByteArray("F0 00 85 C0 74 32 B9 3F 3F 3F 11 8A"), | ||||
|                                         Replace = ByteUtil.HexStringToByteArray("F0 00 85 C0 EB 32 B9 3F 3F 3F 11 8A"), | ||||
|                                         Search = ByteUtil.HexStringToByteArray("00 85 C0 74 32 B9 3F 3F 3F 3F 8A"), | ||||
|                                         Replace = ByteUtil.HexStringToByteArray("00 85 C0 EB 32 B9 3F 3F 3F 3F 8A"), | ||||
|                                         Category = "防撤回" | ||||
|                                     }, | ||||
|                                     new ReplacePattern | ||||
|                                     { | ||||
|                                         Search = ByteUtil.HexStringToByteArray("83 C4 04 80 BD 3F FC FF FF 00 74 58 8B 3D"), | ||||
|                                         Replace = ByteUtil.HexStringToByteArray("83 C4 04 80 BD 3F FC FF FF 00 EB 58 8B 3D"), | ||||
|                                         Category = "多开" | ||||
|                                     } | ||||
|                                 } | ||||
|                             }, | ||||
|                             new CommonModifyInfo | ||||
|                             { | ||||
|                                 Name="WeChatWin.dll", | ||||
|                                 StartVersion="3.6.5.0", | ||||
|                                 EndVersion="3.7.0.0", | ||||
|                                 ReplacePatterns = new List<ReplacePattern> | ||||
|                                 { | ||||
|                                     new ReplacePattern | ||||
|                                     { | ||||
|                                         Search = ByteUtil.HexStringToByteArray("00 85 C0 74 32 B9 3F 3F 3F 11 8A"), | ||||
|                                         Replace = ByteUtil.HexStringToByteArray("00 85 C0 EB 32 B9 3F 3F 3F 11 8A"), | ||||
|                                         Category = "防撤回" | ||||
|                                     }, | ||||
|                                     new ReplacePattern | ||||
|  |  | |||
|  | @ -91,6 +91,7 @@ | |||
|     <None Include="Data\1.1\patch.json" /> | ||||
|     <None Include="Data\1.2\patch.json" /> | ||||
|     <None Include="Data\1.3\patch.json" /> | ||||
|     <None Include="Data\1.4\patch.json" /> | ||||
|     <None Include="Properties\Settings.settings"> | ||||
|       <Generator>SettingsSingleFileGenerator</Generator> | ||||
|       <LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||||
|  |  | |||
|  | @ -76,7 +76,7 @@ namespace RevokeMsgPatcher | |||
|             // 自动获取应用安装路径 | ||||
|             txtPath.Text = modifier.FindInstallPath(); | ||||
|             // 显示是否能够备份还原、版本和功能 | ||||
|             InitEditorsAndUI(txtPath.Text); | ||||
|             //InitEditorsAndUI(txtPath.Text); | ||||
|         } | ||||
| 
 | ||||
|         private void InitEditorsAndUI(string path) | ||||
|  | @ -362,7 +362,7 @@ namespace RevokeMsgPatcher | |||
|             EnableAllButton(true); | ||||
| 
 | ||||
|             // 重新计算显示是否能够备份还原、版本和功能 | ||||
|             InitEditorsAndUI(txtPath.Text); | ||||
|             //InitEditorsAndUI(txtPath.Text); | ||||
|             ga.RequestPageView($"{GetCheckedRadioButtonNameEn()}/{lblVersion.Text}/switch", "切换标签页"); | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,9 @@ | |||
| using RevokeMsgPatcher.Model; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Diagnostics; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| 
 | ||||
| namespace RevokeMsgPatcher.Matcher | ||||
| { | ||||
|  | @ -10,8 +12,11 @@ namespace RevokeMsgPatcher.Matcher | |||
|         // TODO 该逻辑需要优化! | ||||
|         public static List<Change> FindChanges(string path, List<ReplacePattern> replacePatterns) | ||||
|         { | ||||
|             Stopwatch sw = new Stopwatch(); | ||||
|             sw.Start(); | ||||
|             // 读取整个文件(dll) | ||||
|             byte[] fileByteArray = File.ReadAllBytes(path); | ||||
|             Console.WriteLine("读取文件耗时:{0}ms.", sw.Elapsed.TotalMilliseconds); | ||||
| 
 | ||||
|             List<Change> changes = new List<Change>(); // 匹配且需要替换的地方 | ||||
| 
 | ||||
|  | @ -21,19 +26,23 @@ namespace RevokeMsgPatcher.Matcher | |||
|             { | ||||
|                 // 所有的匹配点位 | ||||
|                 int[] matchIndexs = FuzzyMatcher.MatchAll(fileByteArray, pattern.Search); | ||||
|                 if (matchIndexs.Length == 1) | ||||
|                 Console.WriteLine("匹配{0}耗时:{1}ms.", pattern.Category, sw.Elapsed.TotalMilliseconds); | ||||
|                 if (matchIndexs.Length >= 1) | ||||
|                 { | ||||
|                     for (int i = 0; i < matchIndexs.Length; i++) | ||||
|                     { | ||||
|                         matchNum++; | ||||
|                         // 与要替换的串不一样才需要替换(当前的特征肯定不一样) | ||||
|                     if (!FuzzyMatcher.IsEqual(fileByteArray, matchIndexs[0], pattern.Replace)) | ||||
|                         if (!FuzzyMatcher.IsEqual(fileByteArray, matchIndexs[i], pattern.Replace)) | ||||
|                         { | ||||
|                         changes.Add(new Change(matchIndexs[0], pattern.Replace)); | ||||
|                             changes.Add(new Change(matchIndexs[i], pattern.Replace)); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             // 匹配数和期望的匹配数不一致时报错(当前一个特征只会出现一次) | ||||
|             if (matchNum != replacePatterns.Count) | ||||
|             // 匹配数和期望的匹配数不一致时报错(当前一个特征会出现多次) | ||||
|             if (matchNum < replacePatterns.Count) | ||||
|             { | ||||
|                 Tuple<bool, SortedSet<string>> res = IsAllReplaced(fileByteArray, replacePatterns); | ||||
|                 if (res.Item1) | ||||
|  | @ -81,26 +90,30 @@ namespace RevokeMsgPatcher.Matcher | |||
| 
 | ||||
|         public static SortedSet<string> FindReplacedFunction(string path, List<ReplacePattern> replacePatterns) | ||||
|         { | ||||
|             Stopwatch sw = new Stopwatch(); | ||||
|             sw.Start(); | ||||
|             byte[] fileByteArray = File.ReadAllBytes(path); | ||||
|             Console.WriteLine("读取文件耗时:{0}ms.", sw.Elapsed.TotalMilliseconds); | ||||
|             Tuple<bool, SortedSet<string>> res = IsAllReplaced(fileByteArray, replacePatterns); | ||||
|             Console.WriteLine("匹配耗时:{0}ms.", sw.Elapsed.TotalMilliseconds); | ||||
|             return res.Item2; | ||||
|         } | ||||
| 
 | ||||
|         private static Tuple<bool, SortedSet<string>> IsAllReplaced(byte[] fileByteArray, List<ReplacePattern> replacePatterns) | ||||
|         private static Tuple<bool, SortedSet<string>> IsAllReplaced(byte[] partByteArray, List<ReplacePattern> replacePatterns) | ||||
|         { | ||||
|             int matchNum = 0; | ||||
|             SortedSet<string> alreadyReplaced = new SortedSet<string>(); // 已经被替换特征的功能 | ||||
|             foreach (ReplacePattern pattern in replacePatterns) | ||||
|             { | ||||
|                 // 所有的匹配点位 | ||||
|                 int[] matchIndexs = FuzzyMatcher.MatchAll(fileByteArray, pattern.Replace); | ||||
|                 if (matchIndexs.Length == 1) | ||||
|                 int[] searchMatchIndexs = FuzzyMatcher.MatchAll(partByteArray, pattern.Search); | ||||
|                 int[] replaceMatchIndexs = FuzzyMatcher.MatchAll(partByteArray, pattern.Replace); | ||||
|                 // 查找串没有,但是替换串存在,也就是说明这个功能已经完全完成替换 | ||||
|                 if (searchMatchIndexs.Length == 0 && replaceMatchIndexs.Length > 0) | ||||
|                 { | ||||
|                     matchNum++; | ||||
|                     alreadyReplaced.Add(pattern.Category); | ||||
|                 } | ||||
|             } | ||||
|             return new Tuple<bool, SortedSet<string>>(matchNum == replacePatterns.Count, alreadyReplaced); | ||||
|             return new Tuple<bool, SortedSet<string>>(matchNum >= replacePatterns.Count, alreadyReplaced); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -32,5 +32,5 @@ using System.Runtime.InteropServices; | |||
| // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 | ||||
| // 方法是按如下所示使用“*”: : | ||||
| //[assembly: AssemblyVersion("1.0.*")] | ||||
| [assembly: AssemblyVersion("1.3")] | ||||
| [assembly: AssemblyFileVersion("1.3")] | ||||
| [assembly: AssemblyVersion("1.4")] | ||||
| [assembly: AssemblyFileVersion("1.4")] | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 辉鸭蛋
						辉鸭蛋