[+] 修复1.4版本不兼容3.7以下微信防撤回的问题

This commit is contained in:
huiyadanli 2022-05-15 13:03:22 +08:00
parent 527d53eddc
commit 1af0b53999
6 changed files with 27 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ namespace RevokeMsgPatcher
{ {
Apps = AppConfig(), Apps = AppConfig(),
LatestVersion = "1.4", LatestVersion = "1.4",
PatchVersion = 20220514, PatchVersion = 20220515,
Notice = "" Notice = ""
}; };
} }
@ -57,7 +57,8 @@ namespace RevokeMsgPatcher
new TargetInfo new TargetInfo
{ {
Name = "WeChatWin.dll", Name = "WeChatWin.dll",
RelativePath = "WeChatWin.dll" RelativePath = "WeChatWin.dll",
StartVersion = "1.0.0.0"
} }
}, },
{ {
@ -65,7 +66,8 @@ namespace RevokeMsgPatcher
new TargetInfo new TargetInfo
{ {
Name = "WeChat.exe", Name = "WeChat.exe",
RelativePath = "../WeChat.exe" RelativePath = "../WeChat.exe",
StartVersion = "3.7.0.0"
} }
} }
}, },

View File

@ -14,6 +14,10 @@ namespace RevokeMsgPatcher.Model
public string Memo { get; set; } public string Memo { get; set; }
public string StartVersion { get; set; }
public string EndVersion { get; set; }
public TargetInfo Clone() public TargetInfo Clone()
{ {
TargetInfo o = new TargetInfo(); TargetInfo o = new TargetInfo();

View File

@ -242,9 +242,16 @@ namespace RevokeMsgPatcher.Modifier
foreach (TargetInfo info in config.FileTargetInfos.Values) foreach (TargetInfo info in config.FileTargetInfos.Values)
{ {
FileHexEditor editor = new FileHexEditor(installPath, info); FileHexEditor editor = new FileHexEditor(installPath, info);
editors.Add(editor); // editor.FileVersion 在 StartVersion 和 EndVersion 之间
if (IsInVersionRange(editor.FileVersion, info.StartVersion, info.EndVersion))
{
editors.Add(editor);
}
}
if(editors.Count == 0)
{
throw new BusinessException("no_support_editor", "当前版本没有对应的文件修改信息,请确认补丁信息是否正常!");
} }
} }
/// <summary> /// <summary>
@ -319,12 +326,12 @@ namespace RevokeMsgPatcher.Modifier
// SHA1不匹配连版本也不匹配说明完全不支持 // SHA1不匹配连版本也不匹配说明完全不支持
if (matchingVersion == null) if (matchingVersion == null)
{ {
throw new BusinessException("not_support", $"不支持此版本:{editor.FileVersion}"); throw new BusinessException("not_support", $"不支持的文件:名称 {editor.FileName} 版本 {editor.FileVersion}");
} }
// SHA1不匹配但是版本匹配可能dll已经被其他补丁程序修改过 // SHA1不匹配但是版本匹配可能dll已经被其他补丁程序修改过
if (matchingVersion != null) if (matchingVersion != null)
{ {
throw new BusinessException("maybe_modified", $"程序支持此版本:{editor.FileVersion}。但是文件校验不通过,请确认是否使用过其他补丁程序!"); throw new BusinessException("maybe_modified", $"程序支持此文件版本: {editor.FileName} - {editor.FileVersion}。但是文件校验不通过,请确认是否使用过其他补丁程序!");
} }
} }
} }
@ -339,6 +346,10 @@ namespace RevokeMsgPatcher.Modifier
public bool Patch() public bool Patch()
{ {
// 首先验证文件修改器是否没问题 // 首先验证文件修改器是否没问题
if(editors.Count == 0)
{
throw new Exception("补丁安装失败,原因:无对应的文件修改器");
}
foreach (FileHexEditor editor in editors) foreach (FileHexEditor editor in editors)
{ {
if (editor == null) if (editor == null)

View File

@ -61,7 +61,7 @@ namespace RevokeMsgPatcher.Properties {
} }
/// <summary> /// <summary>
/// 查找类似 {&quot;Apps&quot;:{&quot;Wechat&quot;:{&quot;Name&quot;:&quot;WeChat&quot;,&quot;FileTargetInfos&quot;:{&quot;WeChatWin.dll&quot;:{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;RelativePath&quot;:&quot;WeChatWin.dll&quot;,&quot;Memo&quot;:null},&quot;WeChat.exe&quot;:{&quot;Name&quot;:&quot;WeChat.exe&quot;,&quot;RelativePath&quot;:&quot;../WeChat.exe&quot;,&quot;Memo&quot;:null}},&quot;FileModifyInfos&quot;:{&quot;WeChat.exe&quot;:[],&quot;WeChatWin.dll&quot;:[{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;3.3.5.25&quot;,&quot;SHA1Before&quot;:&quot;3e94753ccbc2799d98f3c741377e99bdae33b4cf&quot;,&quot;SHA1After&quot;:&quot;ab98f83fc16674ac4911380882c79c3ca4c2fd71&quot;,&quot;Changes&quot;:[{&quot;Position&quot;:3413977,&quot;Content&quot;:[235]},{&quot;Position&quot;:12159591,&quot;Content&quot;:[235]}]} [字符串的其余部分被截断]&quot;; 的本地化字符串。 /// 查找类似 {&quot;Apps&quot;:{&quot;Wechat&quot;:{&quot;Name&quot;:&quot;WeChat&quot;,&quot;FileTargetInfos&quot;:{&quot;WeChatWin.dll&quot;:{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;RelativePath&quot;:&quot;WeChatWin.dll&quot;,&quot;Memo&quot;:null,&quot;StartVersion&quot;:&quot;1.0.0.0&quot;,&quot;EndVersion&quot;:null},&quot;WeChat.exe&quot;:{&quot;Name&quot;:&quot;WeChat.exe&quot;,&quot;RelativePath&quot;:&quot;../WeChat.exe&quot;,&quot;Memo&quot;:null,&quot;StartVersion&quot;:&quot;3.7.0.0&quot;,&quot;EndVersion&quot;:null}},&quot;FileModifyInfos&quot;:{&quot;WeChat.exe&quot;:[],&quot;WeChatWin.dll&quot;:[{&quot;Name&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;3.3.5.25&quot;,&quot;SHA1Before&quot;:&quot;3e94753ccbc2799d98f3c741377e99bdae33b4cf&quot;,&quot;SHA1After&quot;:&quot;ab98f83fc16674ac4911380882c79c3ca4c2fd71&quot;,&quot; [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary> /// </summary>
internal static string PatchJson { internal static string PatchJson {
get { get {

File diff suppressed because one or more lines are too long