mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2025-05-23 22:06:06 +08:00
[+] 支持 Weixin 4.0
This commit is contained in:
parent
0f29f67708
commit
39bc37717e
1
RevokeMsgPatcher.Assistant/Data/2.0/patch.json
Normal file
1
RevokeMsgPatcher.Assistant/Data/2.0/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.9",
|
||||
PatchVersion = 20240929,
|
||||
LatestVersion = "2.0",
|
||||
PatchVersion = 20241106,
|
||||
Notice = "",
|
||||
NoticeUrl = "",
|
||||
};
|
||||
|
@ -34,6 +34,7 @@ namespace RevokeMsgPatcher
|
|||
return new Dictionary<string, App>
|
||||
{
|
||||
{ "Wechat" , Wechat() },
|
||||
{ "Weixin" , Weixin() },
|
||||
{ "QQ" , QQ() },
|
||||
{ "TIM" , TIM() },
|
||||
{ "QQLite" , QQLite() },
|
||||
|
@ -1389,5 +1390,49 @@ namespace RevokeMsgPatcher
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public App Weixin()
|
||||
{
|
||||
return new App
|
||||
{
|
||||
Name = "Weixin",
|
||||
FileTargetInfos = new Dictionary<string, TargetInfo>
|
||||
{
|
||||
{
|
||||
"Weixin.dll",
|
||||
new TargetInfo
|
||||
{
|
||||
Name = "Weixin.dll",
|
||||
RelativePath = "Weixin.dll",
|
||||
StartVersion = "1.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
FileCommonModifyInfos = new Dictionary<string, List<CommonModifyInfo>>
|
||||
{
|
||||
{
|
||||
"Weixin.dll",
|
||||
new List<CommonModifyInfo>
|
||||
{
|
||||
new CommonModifyInfo
|
||||
{
|
||||
Name="Weixin.dll",
|
||||
StartVersion="4.0.0.0",
|
||||
EndVersion="",
|
||||
ReplacePatterns = new List<ReplacePattern>
|
||||
{
|
||||
new ReplacePattern
|
||||
{
|
||||
Search = ByteUtil.HexStringToByteArray("57 53 48 83 EC 20 48 89 CE 80 3D D1 F7 DC 05 00 75 21 48 B8"),
|
||||
Replace = ByteUtil.HexStringToByteArray("57 53 48 83 EC 20 48 89 CE 80 3D D1 F7 DC 05 00 EB 21 48 B8"),
|
||||
Category = "防撤回"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
<None Include="Data\1.7\patch.json" />
|
||||
<None Include="Data\1.8\patch.json" />
|
||||
<None Include="Data\1.9\patch.json" />
|
||||
<None Include="Data\2.0\patch.json" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
23
RevokeMsgPatcher/FormMain.Designer.cs
generated
23
RevokeMsgPatcher/FormMain.Designer.cs
generated
|
@ -64,6 +64,7 @@
|
|||
this.panelNotice = new System.Windows.Forms.Panel();
|
||||
this.labelNotice = new System.Windows.Forms.Label();
|
||||
this.rbtQQNT = new System.Windows.Forms.RadioButton();
|
||||
this.rbtWeixin = new System.Windows.Forms.RadioButton();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panelNotice.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -178,7 +179,6 @@
|
|||
this.rbtWechat.Name = "rbtWechat";
|
||||
this.rbtWechat.Size = new System.Drawing.Size(47, 16);
|
||||
this.rbtWechat.TabIndex = 12;
|
||||
this.rbtWechat.TabStop = true;
|
||||
this.rbtWechat.Text = "微信";
|
||||
this.rbtWechat.UseVisualStyleBackColor = true;
|
||||
this.rbtWechat.CheckedChanged += new System.EventHandler(this.radioButtons_CheckedChanged);
|
||||
|
@ -186,7 +186,7 @@
|
|||
// rbtQQ
|
||||
//
|
||||
this.rbtQQ.AutoSize = true;
|
||||
this.rbtQQ.Location = new System.Drawing.Point(190, 36);
|
||||
this.rbtQQ.Location = new System.Drawing.Point(254, 36);
|
||||
this.rbtQQ.Name = "rbtQQ";
|
||||
this.rbtQQ.Size = new System.Drawing.Size(35, 16);
|
||||
this.rbtQQ.TabIndex = 13;
|
||||
|
@ -197,7 +197,7 @@
|
|||
// rbtTIM
|
||||
//
|
||||
this.rbtTIM.AutoSize = true;
|
||||
this.rbtTIM.Location = new System.Drawing.Point(236, 36);
|
||||
this.rbtTIM.Location = new System.Drawing.Point(300, 36);
|
||||
this.rbtTIM.Name = "rbtTIM";
|
||||
this.rbtTIM.Size = new System.Drawing.Size(41, 16);
|
||||
this.rbtTIM.TabIndex = 14;
|
||||
|
@ -217,7 +217,7 @@
|
|||
// rbtQQLite
|
||||
//
|
||||
this.rbtQQLite.AutoSize = true;
|
||||
this.rbtQQLite.Location = new System.Drawing.Point(285, 36);
|
||||
this.rbtQQLite.Location = new System.Drawing.Point(349, 36);
|
||||
this.rbtQQLite.Name = "rbtQQLite";
|
||||
this.rbtQQLite.Size = new System.Drawing.Size(71, 16);
|
||||
this.rbtQQLite.TabIndex = 18;
|
||||
|
@ -376,7 +376,7 @@
|
|||
// rbtQQNT
|
||||
//
|
||||
this.rbtQQNT.AutoSize = true;
|
||||
this.rbtQQNT.Location = new System.Drawing.Point(135, 36);
|
||||
this.rbtQQNT.Location = new System.Drawing.Point(199, 36);
|
||||
this.rbtQQNT.Name = "rbtQQNT";
|
||||
this.rbtQQNT.Size = new System.Drawing.Size(47, 16);
|
||||
this.rbtQQNT.TabIndex = 24;
|
||||
|
@ -384,6 +384,17 @@
|
|||
this.rbtQQNT.UseVisualStyleBackColor = true;
|
||||
this.rbtQQNT.CheckedChanged += new System.EventHandler(this.radioButtons_CheckedChanged);
|
||||
//
|
||||
// rbtWeixin
|
||||
//
|
||||
this.rbtWeixin.AutoSize = true;
|
||||
this.rbtWeixin.Location = new System.Drawing.Point(134, 36);
|
||||
this.rbtWeixin.Name = "rbtWeixin";
|
||||
this.rbtWeixin.Size = new System.Drawing.Size(65, 16);
|
||||
this.rbtWeixin.TabIndex = 25;
|
||||
this.rbtWeixin.Text = "微信4.0";
|
||||
this.rbtWeixin.UseVisualStyleBackColor = true;
|
||||
this.rbtWeixin.CheckedChanged += new System.EventHandler(this.radioButtons_CheckedChanged);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
@ -409,6 +420,7 @@
|
|||
this.Controls.Add(this.linkLabel1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Controls.Add(this.rbtWeixin);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MinimumSize = new System.Drawing.Size(504, 144);
|
||||
|
@ -459,6 +471,7 @@
|
|||
private System.Windows.Forms.Panel panelNotice;
|
||||
private System.Windows.Forms.Label labelNotice;
|
||||
private System.Windows.Forms.RadioButton rbtQQNT;
|
||||
private System.Windows.Forms.RadioButton rbtWeixin;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace RevokeMsgPatcher
|
|||
private AppModifier modifier = null;
|
||||
|
||||
private WechatModifier wechatModifier = null;
|
||||
private WeixinModifier weixinModifier = null;
|
||||
private QQModifier qqModifier = null;
|
||||
private TIMModifier timModifier = null;
|
||||
private QQLiteModifier qqLiteModifier = null;
|
||||
|
@ -42,12 +43,14 @@ namespace RevokeMsgPatcher
|
|||
|
||||
// 初始化每个应用对应的修改者
|
||||
wechatModifier = new WechatModifier(bag.Apps["Wechat"]);
|
||||
weixinModifier = new WeixinModifier(bag.Apps["Weixin"]);
|
||||
qqModifier = new QQModifier(bag.Apps["QQ"]);
|
||||
timModifier = new TIMModifier(bag.Apps["TIM"]);
|
||||
qqLiteModifier = new QQLiteModifier(bag.Apps["QQLite"]);
|
||||
qqntModifier = new QQNTModifier(bag.Apps["QQNT"]);
|
||||
|
||||
rbtWechat.Tag = wechatModifier;
|
||||
rbtWeixin.Tag = weixinModifier;
|
||||
rbtQQ.Tag = qqModifier;
|
||||
rbtTIM.Tag = timModifier;
|
||||
rbtQQLite.Tag = qqLiteModifier;
|
||||
|
@ -347,6 +350,7 @@ namespace RevokeMsgPatcher
|
|||
lblUpdatePachJson.ForeColor = Color.RoyalBlue;
|
||||
|
||||
wechatModifier.Config = newBag.Apps["Wechat"];
|
||||
weixinModifier.Config = newBag.Apps["Weixin"];
|
||||
qqModifier.Config = newBag.Apps["QQ"];
|
||||
timModifier.Config = newBag.Apps["TIM"];
|
||||
qqLiteModifier.Config = newBag.Apps["QQLite"];
|
||||
|
@ -384,6 +388,7 @@ namespace RevokeMsgPatcher
|
|||
|
||||
tips += "支持以下版本" + Environment.NewLine;
|
||||
tips += " ➯ 微信:" + wechatModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||
tips += " ➯ 微信4.0:" + weixinModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||
tips += " ➯ QQNT:" + qqntModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||
tips += " ➯ QQ:" + qqModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||
tips += " ➯ QQ轻聊版:" + qqLiteModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||
|
@ -411,6 +416,10 @@ namespace RevokeMsgPatcher
|
|||
{
|
||||
modifier = (WechatModifier)rbtWechat.Tag;
|
||||
}
|
||||
else if (rbtWeixin.Checked)
|
||||
{
|
||||
modifier = (WeixinModifier)rbtWeixin.Tag;
|
||||
}
|
||||
else if (rbtQQ.Checked)
|
||||
{
|
||||
modifier = (QQModifier)rbtQQ.Tag;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace RevokeMsgPatcher.Modifier
|
|||
string realPath = GetRealInstallPath(installPath);
|
||||
if (string.IsNullOrEmpty(realPath))
|
||||
{
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\QQ");
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\Wechat");
|
||||
foreach (string defaultPath in defaultPathList)
|
||||
{
|
||||
realPath = GetRealInstallPath(defaultPath);
|
||||
|
|
122
RevokeMsgPatcher/Modifier/WeixinModifier.cs
Normal file
122
RevokeMsgPatcher/Modifier/WeixinModifier.cs
Normal file
|
@ -0,0 +1,122 @@
|
|||
using RevokeMsgPatcher.Model;
|
||||
using RevokeMsgPatcher.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace RevokeMsgPatcher.Modifier
|
||||
{
|
||||
class WeixinModifier : AppModifier
|
||||
{
|
||||
|
||||
public WeixinModifier(App config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public override void AfterPatchSuccess()
|
||||
{
|
||||
}
|
||||
|
||||
public override void AfterPatchFail()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动寻找获取微信安装路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string FindInstallPath()
|
||||
{
|
||||
try
|
||||
{
|
||||
string installPath = PathUtil.FindInstallPathFromRegistryWOW6432Node("Weixin");
|
||||
string realPath = null;
|
||||
if (!string.IsNullOrEmpty(installPath))
|
||||
{
|
||||
installPath = Path.GetDirectoryName(installPath);
|
||||
realPath = GetRealInstallPath(installPath);
|
||||
}
|
||||
if (string.IsNullOrEmpty(realPath))
|
||||
{
|
||||
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\Weixin");
|
||||
foreach (string defaultPath in defaultPathList)
|
||||
{
|
||||
realPath = GetRealInstallPath(defaultPath);
|
||||
if (!string.IsNullOrEmpty(realPath))
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return realPath;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 微信目录结构
|
||||
/// </summary>
|
||||
/// <param name="basePath"></param>
|
||||
/// <returns></returns>
|
||||
private string GetRealInstallPath(string basePath)
|
||||
{
|
||||
if (basePath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DirectoryInfo[] directories = new DirectoryInfo(basePath).GetDirectories();
|
||||
PathUtil.SortByLastWriteTimeDesc(ref directories); // 按修改时间倒序
|
||||
foreach (DirectoryInfo folder in directories)
|
||||
{
|
||||
if (IsAllFilesExist(folder.FullName))
|
||||
{
|
||||
return folder.FullName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取整个APP的当前版本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string GetVersion()
|
||||
{
|
||||
if (editors != null && editors.Count > 0)
|
||||
{
|
||||
foreach (FileHexEditor editor in editors)
|
||||
{
|
||||
if (editor.FileName == "Weixin.dll")
|
||||
{
|
||||
return editor.FileVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//public override bool ValidateAndInitialize(string installPath)
|
||||
//{
|
||||
// // 判断是否是安装路径
|
||||
// if (!IsAllBinaryFilesExist(installPath))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// // 初始化十六进制文件编辑器
|
||||
// // 并寻找与之配对的版本修改信息
|
||||
// InitEditors(installPath);
|
||||
|
||||
// return true;
|
||||
//}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -99,6 +99,7 @@
|
|||
<Compile Include="Modifier\QQNTModifier.cs" />
|
||||
<Compile Include="Modifier\QQModifier.cs" />
|
||||
<Compile Include="Modifier\TIMModifier.cs" />
|
||||
<Compile Include="Modifier\WeixinModifier.cs" />
|
||||
<Compile Include="Modifier\WechatModifier.cs" />
|
||||
<Compile Include="Utils\ByteUtil.cs" />
|
||||
<Compile Include="Utils\Device.cs" />
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace RevokeMsgPatcher.Utils
|
|||
Console.WriteLine(keyName + " , " + programKey.GetValue("DisplayName") + " , " + programKey.GetValue("InstallLocation"));
|
||||
programKey.Close();
|
||||
}
|
||||
|
||||
uninstallKey.Close();
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,7 @@ namespace RevokeMsgPatcher.Utils
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
object installLocation = key.GetValue("InstallLocation");
|
||||
key.Close();
|
||||
if (installLocation != null && !string.IsNullOrEmpty(installLocation.ToString()))
|
||||
|
@ -54,6 +56,7 @@ namespace RevokeMsgPatcher.Utils
|
|||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -67,17 +70,19 @@ namespace RevokeMsgPatcher.Utils
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
object installLocation = key.GetValue("UninstallString");
|
||||
key.Close();
|
||||
if (installLocation != null && !string.IsNullOrEmpty(installLocation.ToString()))
|
||||
{
|
||||
return installLocation.ToString();
|
||||
return installLocation.ToString().Replace("\"","");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -98,7 +103,16 @@ namespace RevokeMsgPatcher.Utils
|
|||
{
|
||||
list.Add(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
path = Path.Combine(d, $@"Program Files\{relativePath}");
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
list.Add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -108,8 +122,7 @@ namespace RevokeMsgPatcher.Utils
|
|||
/// <param name="dirs"></param>
|
||||
public static void SortByLastWriteTimeDesc(ref DirectoryInfo[] dirs)
|
||||
{
|
||||
Array.Sort(dirs, delegate (DirectoryInfo x, DirectoryInfo y) { return y.LastWriteTime.CompareTo(x.LastWriteTime); });
|
||||
Array.Sort(dirs, delegate(DirectoryInfo x, DirectoryInfo y) { return y.LastWriteTime.CompareTo(x.LastWriteTime); });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user