mirror of
https://github.com/huiyadanli/RevokeMsgPatcher.git
synced 2025-05-23 22:06:06 +08:00
This commit is contained in:
parent
4de179192d
commit
f734a67586
1
RevokeMsgPatcher.Assistant/Data/1.8/patch.json
Normal file
1
RevokeMsgPatcher.Assistant/Data/1.8/patch.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -16,8 +16,8 @@ namespace RevokeMsgPatcher
|
||||||
return new Bag
|
return new Bag
|
||||||
{
|
{
|
||||||
Apps = AppConfig(),
|
Apps = AppConfig(),
|
||||||
LatestVersion = "1.7",
|
LatestVersion = "1.8",
|
||||||
PatchVersion = 20240614,
|
PatchVersion = 20240615,
|
||||||
Notice = "",
|
Notice = "",
|
||||||
NoticeUrl = "",
|
NoticeUrl = "",
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,8 @@ namespace RevokeMsgPatcher
|
||||||
{ "Wechat" , Wechat() },
|
{ "Wechat" , Wechat() },
|
||||||
{ "QQ" , QQ() },
|
{ "QQ" , QQ() },
|
||||||
{ "TIM" , TIM() },
|
{ "TIM" , TIM() },
|
||||||
{ "QQLite" , QQLite() }
|
{ "QQLite" , QQLite() },
|
||||||
|
{ "QQNT" , QQNT() }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,5 +1345,49 @@ namespace RevokeMsgPatcher
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public App QQNT()
|
||||||
|
{
|
||||||
|
return new App
|
||||||
|
{
|
||||||
|
Name = "QQNT",
|
||||||
|
FileTargetInfos = new Dictionary<string, TargetInfo>
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"QQ.exe",
|
||||||
|
new TargetInfo
|
||||||
|
{
|
||||||
|
Name = "QQ.exe",
|
||||||
|
RelativePath = "QQ.exe"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FileCommonModifyInfos = new Dictionary<string, List<CommonModifyInfo>>
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"QQ.exe",
|
||||||
|
new List<CommonModifyInfo>
|
||||||
|
{
|
||||||
|
new CommonModifyInfo
|
||||||
|
{
|
||||||
|
Name="QQ.exe",
|
||||||
|
StartVersion="9.9.10.00000",
|
||||||
|
EndVersion="",
|
||||||
|
ReplacePatterns = new List<ReplacePattern>
|
||||||
|
{
|
||||||
|
new ReplacePattern
|
||||||
|
{
|
||||||
|
Search = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 E8 3F 3F 3F 3F"),
|
||||||
|
Replace = ByteUtil.HexStringToByteArray("48 89 CE 48 8B 11 4C 8B 41 08 49 29 D0 48 8B 49 18 B8 01 00 00 00"),
|
||||||
|
Category = "去校验"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
<None Include="Data\1.5\patch.json" />
|
<None Include="Data\1.5\patch.json" />
|
||||||
<None Include="Data\1.6\patch.json" />
|
<None Include="Data\1.6\patch.json" />
|
||||||
<None Include="Data\1.7\patch.json" />
|
<None Include="Data\1.7\patch.json" />
|
||||||
|
<None Include="Data\1.8\patch.json" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|
20
RevokeMsgPatcher/FormMain.Designer.cs
generated
20
RevokeMsgPatcher/FormMain.Designer.cs
generated
|
@ -63,6 +63,7 @@
|
||||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.panelNotice = new System.Windows.Forms.Panel();
|
this.panelNotice = new System.Windows.Forms.Panel();
|
||||||
this.labelNotice = new System.Windows.Forms.Label();
|
this.labelNotice = new System.Windows.Forms.Label();
|
||||||
|
this.rbtQQNT = new System.Windows.Forms.RadioButton();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.panelNotice.SuspendLayout();
|
this.panelNotice.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -185,7 +186,7 @@
|
||||||
// rbtQQ
|
// rbtQQ
|
||||||
//
|
//
|
||||||
this.rbtQQ.AutoSize = true;
|
this.rbtQQ.AutoSize = true;
|
||||||
this.rbtQQ.Location = new System.Drawing.Point(142, 36);
|
this.rbtQQ.Location = new System.Drawing.Point(190, 36);
|
||||||
this.rbtQQ.Name = "rbtQQ";
|
this.rbtQQ.Name = "rbtQQ";
|
||||||
this.rbtQQ.Size = new System.Drawing.Size(35, 16);
|
this.rbtQQ.Size = new System.Drawing.Size(35, 16);
|
||||||
this.rbtQQ.TabIndex = 13;
|
this.rbtQQ.TabIndex = 13;
|
||||||
|
@ -196,7 +197,7 @@
|
||||||
// rbtTIM
|
// rbtTIM
|
||||||
//
|
//
|
||||||
this.rbtTIM.AutoSize = true;
|
this.rbtTIM.AutoSize = true;
|
||||||
this.rbtTIM.Location = new System.Drawing.Point(188, 36);
|
this.rbtTIM.Location = new System.Drawing.Point(236, 36);
|
||||||
this.rbtTIM.Name = "rbtTIM";
|
this.rbtTIM.Name = "rbtTIM";
|
||||||
this.rbtTIM.Size = new System.Drawing.Size(41, 16);
|
this.rbtTIM.Size = new System.Drawing.Size(41, 16);
|
||||||
this.rbtTIM.TabIndex = 14;
|
this.rbtTIM.TabIndex = 14;
|
||||||
|
@ -216,7 +217,7 @@
|
||||||
// rbtQQLite
|
// rbtQQLite
|
||||||
//
|
//
|
||||||
this.rbtQQLite.AutoSize = true;
|
this.rbtQQLite.AutoSize = true;
|
||||||
this.rbtQQLite.Location = new System.Drawing.Point(237, 36);
|
this.rbtQQLite.Location = new System.Drawing.Point(285, 36);
|
||||||
this.rbtQQLite.Name = "rbtQQLite";
|
this.rbtQQLite.Name = "rbtQQLite";
|
||||||
this.rbtQQLite.Size = new System.Drawing.Size(71, 16);
|
this.rbtQQLite.Size = new System.Drawing.Size(71, 16);
|
||||||
this.rbtQQLite.TabIndex = 18;
|
this.rbtQQLite.TabIndex = 18;
|
||||||
|
@ -372,11 +373,23 @@
|
||||||
this.labelNotice.TabIndex = 0;
|
this.labelNotice.TabIndex = 0;
|
||||||
this.labelNotice.Text = "测试测试测试测试";
|
this.labelNotice.Text = "测试测试测试测试";
|
||||||
//
|
//
|
||||||
|
// rbtQQNT
|
||||||
|
//
|
||||||
|
this.rbtQQNT.AutoSize = true;
|
||||||
|
this.rbtQQNT.Location = new System.Drawing.Point(135, 36);
|
||||||
|
this.rbtQQNT.Name = "rbtQQNT";
|
||||||
|
this.rbtQQNT.Size = new System.Drawing.Size(47, 16);
|
||||||
|
this.rbtQQNT.TabIndex = 24;
|
||||||
|
this.rbtQQNT.Text = "QQNT";
|
||||||
|
this.rbtQQNT.UseVisualStyleBackColor = true;
|
||||||
|
this.rbtQQNT.CheckedChanged += new System.EventHandler(this.radioButtons_CheckedChanged);
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(490, 169);
|
this.ClientSize = new System.Drawing.Size(490, 169);
|
||||||
|
this.Controls.Add(this.rbtQQNT);
|
||||||
this.Controls.Add(this.panelNotice);
|
this.Controls.Add(this.panelNotice);
|
||||||
this.Controls.Add(this.panelCategories);
|
this.Controls.Add(this.panelCategories);
|
||||||
this.Controls.Add(this.lblCategory);
|
this.Controls.Add(this.lblCategory);
|
||||||
|
@ -445,6 +458,7 @@
|
||||||
private System.Windows.Forms.ToolTip toolTip1;
|
private System.Windows.Forms.ToolTip toolTip1;
|
||||||
private System.Windows.Forms.Panel panelNotice;
|
private System.Windows.Forms.Panel panelNotice;
|
||||||
private System.Windows.Forms.Label labelNotice;
|
private System.Windows.Forms.Label labelNotice;
|
||||||
|
private System.Windows.Forms.RadioButton rbtQQNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace RevokeMsgPatcher
|
||||||
private QQModifier qqModifier = null;
|
private QQModifier qqModifier = null;
|
||||||
private TIMModifier timModifier = null;
|
private TIMModifier timModifier = null;
|
||||||
private QQLiteModifier qqLiteModifier = null;
|
private QQLiteModifier qqLiteModifier = null;
|
||||||
|
private QQNTModifier qqntModifier = null;
|
||||||
|
|
||||||
private string thisVersion;
|
private string thisVersion;
|
||||||
private bool needUpdate = false;
|
private bool needUpdate = false;
|
||||||
|
@ -42,11 +43,13 @@ namespace RevokeMsgPatcher
|
||||||
qqModifier = new QQModifier(bag.Apps["QQ"]);
|
qqModifier = new QQModifier(bag.Apps["QQ"]);
|
||||||
timModifier = new TIMModifier(bag.Apps["TIM"]);
|
timModifier = new TIMModifier(bag.Apps["TIM"]);
|
||||||
qqLiteModifier = new QQLiteModifier(bag.Apps["QQLite"]);
|
qqLiteModifier = new QQLiteModifier(bag.Apps["QQLite"]);
|
||||||
|
qqntModifier = new QQNTModifier(bag.Apps["QQNT"]);
|
||||||
|
|
||||||
rbtWechat.Tag = wechatModifier;
|
rbtWechat.Tag = wechatModifier;
|
||||||
rbtQQ.Tag = qqModifier;
|
rbtQQ.Tag = qqModifier;
|
||||||
rbtTIM.Tag = timModifier;
|
rbtTIM.Tag = timModifier;
|
||||||
rbtQQLite.Tag = qqLiteModifier;
|
rbtQQLite.Tag = qqLiteModifier;
|
||||||
|
rbtQQNT.Tag = qqntModifier;
|
||||||
|
|
||||||
// 默认微信
|
// 默认微信
|
||||||
rbtWechat.Enabled = true;
|
rbtWechat.Enabled = true;
|
||||||
|
@ -368,6 +371,7 @@ namespace RevokeMsgPatcher
|
||||||
|
|
||||||
tips += "支持以下版本" + Environment.NewLine;
|
tips += "支持以下版本" + Environment.NewLine;
|
||||||
tips += " ➯ 微信:" + wechatModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
tips += " ➯ 微信:" + wechatModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||||
|
tips += " ➯ QQNT:" + qqntModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||||
tips += " ➯ QQ:" + qqModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
tips += " ➯ QQ:" + qqModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||||
tips += " ➯ QQ轻聊版:" + qqLiteModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
tips += " ➯ QQ轻聊版:" + qqLiteModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||||
tips += " ➯ TIM:" + timModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
tips += " ➯ TIM:" + timModifier.Config.GetSupportVersionStr() + Environment.NewLine;
|
||||||
|
@ -406,6 +410,10 @@ namespace RevokeMsgPatcher
|
||||||
{
|
{
|
||||||
modifier = (QQLiteModifier)rbtQQLite.Tag;
|
modifier = (QQLiteModifier)rbtQQLite.Tag;
|
||||||
}
|
}
|
||||||
|
else if (rbtQQNT.Checked)
|
||||||
|
{
|
||||||
|
modifier = (QQNTModifier)rbtQQNT.Tag;
|
||||||
|
}
|
||||||
|
|
||||||
EnableAllButton(true);
|
EnableAllButton(true);
|
||||||
// 触发了 txtPath_TextChanged 方法 已经调用了 InitEditorsAndUI(txtPath.Text);
|
// 触发了 txtPath_TextChanged 方法 已经调用了 InitEditorsAndUI(txtPath.Text);
|
||||||
|
@ -433,6 +441,10 @@ namespace RevokeMsgPatcher
|
||||||
{
|
{
|
||||||
return "qqlite";
|
return "qqlite";
|
||||||
}
|
}
|
||||||
|
else if (rbtQQNT.Checked)
|
||||||
|
{
|
||||||
|
return "qqnt";
|
||||||
|
}
|
||||||
|
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,11 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
protected App config;
|
protected App config;
|
||||||
|
|
||||||
public App Config { set { config = value; } get { return config; } }
|
public App Config
|
||||||
|
{
|
||||||
|
set { config = value; }
|
||||||
|
get { return config; }
|
||||||
|
}
|
||||||
|
|
||||||
protected List<FileHexEditor> editors;
|
protected List<FileHexEditor> editors;
|
||||||
|
|
||||||
|
@ -56,18 +60,22 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
foreach (FileHexEditor editor in editors) // 多种文件
|
foreach (FileHexEditor editor in editors) // 多种文件
|
||||||
{
|
{
|
||||||
// 精确版本匹配
|
// 精确版本匹配
|
||||||
bool haven = false;
|
if (config.FileModifyInfos != null && config.FileModifyInfos.Count > 0)
|
||||||
foreach (ModifyInfo modifyInfo in config.FileModifyInfos[editor.FileName]) // 多个版本信息
|
|
||||||
{
|
{
|
||||||
if (editor.FileVersion == modifyInfo.Version)
|
bool haven = false;
|
||||||
|
foreach (ModifyInfo modifyInfo in config.FileModifyInfos[editor.FileName]) // 多个版本信息
|
||||||
{
|
{
|
||||||
haven = true;
|
if (editor.FileVersion == modifyInfo.Version)
|
||||||
break;
|
{
|
||||||
|
haven = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haven)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (haven)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,16 +110,19 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
categories.Add(c);
|
categories.Add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取已经安装过的功能类型
|
// 获取已经安装过的功能类型
|
||||||
SortedSet<string> replaced = ModifyFinder.FindReplacedFunction(editor.FilePath, commonModifyInfo.ReplacePatterns);
|
SortedSet<string> replaced = ModifyFinder.FindReplacedFunction(editor.FilePath, commonModifyInfo.ReplacePatterns);
|
||||||
foreach (string c in replaced)
|
foreach (string c in replaced)
|
||||||
{
|
{
|
||||||
installed.Add(c);
|
installed.Add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
inRange = true;
|
inRange = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inRange)
|
if (inRange)
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
|
@ -132,7 +143,6 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
label.ForeColor = Color.Red;
|
label.ForeColor = Color.Red;
|
||||||
UIController.AddMsgToPanel(panel, "无功能选项");
|
UIController.AddMsgToPanel(panel, "无功能选项");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -146,6 +156,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int success = 0, count = 0;
|
int success = 0, count = 0;
|
||||||
foreach (TargetInfo info in config.FileTargetInfos.Values)
|
foreach (TargetInfo info in config.FileTargetInfos.Values)
|
||||||
{
|
{
|
||||||
|
@ -159,6 +170,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success == count && success >= 1)
|
if (success == count && success >= 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -189,6 +201,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
Console.WriteLine("判断版本范围时出错:" + e.Message);
|
Console.WriteLine("判断版本范围时出错:" + e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +220,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
return commonModifyInfo;
|
return commonModifyInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +239,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == editors.Count)
|
if (i == editors.Count)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -253,11 +268,13 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
editors.Add(editor);
|
editors.Add(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editors.Count == 0)
|
if (editors.Count == 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("当前版本没有对应的文件修改信息,请确认补丁信息是否正常!");
|
MessageBox.Show("当前版本没有对应的文件修改信息,请确认补丁信息是否正常!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,26 +289,30 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
// 通过SHA1和文件版本判断是否可以打补丁 根据不同结果返回不同的提示
|
// 通过SHA1和文件版本判断是否可以打补丁 根据不同结果返回不同的提示
|
||||||
ModifyInfo matchingSHA1Before = null, matchingSHA1After = null, matchingVersion = null;
|
ModifyInfo matchingSHA1Before = null, matchingSHA1After = null, matchingVersion = null;
|
||||||
foreach (ModifyInfo modifyInfo in config.FileModifyInfos[editor.FileName]) // 多个版本信息
|
if (config.FileModifyInfos != null && config.FileModifyInfos.Count > 0)
|
||||||
{
|
{
|
||||||
if (modifyInfo.Name == editor.FileName) // 保险用的无用判断
|
foreach (ModifyInfo modifyInfo in config.FileModifyInfos[editor.FileName]) // 多个版本信息
|
||||||
{
|
{
|
||||||
if (editor.FileSHA1 == modifyInfo.SHA1After)
|
if (modifyInfo.Name == editor.FileName) // 保险用的无用判断
|
||||||
{
|
{
|
||||||
matchingSHA1After = modifyInfo;
|
if (editor.FileSHA1 == modifyInfo.SHA1After)
|
||||||
}
|
{
|
||||||
else if (editor.FileSHA1 == modifyInfo.SHA1Before)
|
matchingSHA1After = modifyInfo;
|
||||||
{
|
}
|
||||||
matchingSHA1Before = modifyInfo;
|
else if (editor.FileSHA1 == modifyInfo.SHA1Before)
|
||||||
}
|
{
|
||||||
|
matchingSHA1Before = modifyInfo;
|
||||||
|
}
|
||||||
|
|
||||||
if (editor.FileVersion == modifyInfo.Version)
|
if (editor.FileVersion == modifyInfo.Version)
|
||||||
{
|
{
|
||||||
matchingVersion = modifyInfo;
|
matchingVersion = modifyInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 补丁前SHA1匹配上,肯定是正确的dll
|
// 补丁前SHA1匹配上,肯定是正确的dll
|
||||||
if (matchingSHA1Before != null)
|
if (matchingSHA1Before != null)
|
||||||
{
|
{
|
||||||
|
@ -299,6 +320,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
editor.TargetChanges = matchingSHA1Before.Changes;
|
editor.TargetChanges = matchingSHA1Before.Changes;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 补丁后SHA1匹配上,肯定已经打过补丁
|
// 补丁后SHA1匹配上,肯定已经打过补丁
|
||||||
if (matchingSHA1After != null)
|
if (matchingSHA1After != null)
|
||||||
{
|
{
|
||||||
|
@ -324,6 +346,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
replacePatterns = editor.FileCommonModifyInfo.ReplacePatterns.Where(info => categories.Contains(info.Category)).ToList();
|
replacePatterns = editor.FileCommonModifyInfo.ReplacePatterns.Where(info => categories.Contains(info.Category)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果能顺利得到 TargetChanges 不报错则可以使用特征替换方式
|
// 如果能顺利得到 TargetChanges 不报错则可以使用特征替换方式
|
||||||
editor.TargetChanges = ModifyFinder.FindChanges(editor.FilePath, replacePatterns);
|
editor.TargetChanges = ModifyFinder.FindChanges(editor.FilePath, replacePatterns);
|
||||||
continue;
|
continue;
|
||||||
|
@ -335,6 +358,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
throw new BusinessException("not_support", $"不支持的文件:名称 {editor.FileName} 版本 {editor.FileVersion}!");
|
throw new BusinessException("not_support", $"不支持的文件:名称 {editor.FileName} 版本 {editor.FileVersion}!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHA1不匹配,但是版本匹配,可能dll已经被其他补丁程序修改过
|
// SHA1不匹配,但是版本匹配,可能dll已经被其他补丁程序修改过
|
||||||
if (matchingVersion != null)
|
if (matchingVersion != null)
|
||||||
{
|
{
|
||||||
|
@ -357,6 +381,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
throw new Exception("补丁安装失败,原因:无对应的文件修改器");
|
throw new Exception("补丁安装失败,原因:无对应的文件修改器");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (FileHexEditor editor in editors)
|
foreach (FileHexEditor editor in editors)
|
||||||
{
|
{
|
||||||
if (editor == null)
|
if (editor == null)
|
||||||
|
@ -364,11 +389,13 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
throw new Exception("补丁安装失败,原因:文件修改器初始化失败!");
|
throw new Exception("补丁安装失败,原因:文件修改器初始化失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再备份所有文件
|
// 再备份所有文件
|
||||||
foreach (FileHexEditor editor in editors)
|
foreach (FileHexEditor editor in editors)
|
||||||
{
|
{
|
||||||
editor.Backup();
|
editor.Backup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打补丁!
|
// 打补丁!
|
||||||
List<FileHexEditor> done = new List<FileHexEditor>(); // 已经打上补丁的
|
List<FileHexEditor> done = new List<FileHexEditor>(); // 已经打上补丁的
|
||||||
try
|
try
|
||||||
|
@ -394,8 +421,10 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
{
|
{
|
||||||
editor.Restore();
|
editor.Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,6 +437,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,6 +470,7 @@ namespace RevokeMsgPatcher.Modifier
|
||||||
editor.Restore();
|
editor.Restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
79
RevokeMsgPatcher/Modifier/QQNTModifier.cs
Normal file
79
RevokeMsgPatcher/Modifier/QQNTModifier.cs
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
using RevokeMsgPatcher.Model;
|
||||||
|
using RevokeMsgPatcher.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace RevokeMsgPatcher.Modifier
|
||||||
|
{
|
||||||
|
class QQNTModifier : AppModifier
|
||||||
|
{
|
||||||
|
public QQNTModifier(App config)
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动寻找获取微信安装路径
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override string FindInstallPath()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string installPath = PathUtil.FindInstallPathFromRegistryWOW6432Node("QQ");
|
||||||
|
if (!string.IsNullOrEmpty(installPath))
|
||||||
|
{
|
||||||
|
installPath = Path.GetDirectoryName(installPath);
|
||||||
|
if (IsAllFilesExist(installPath))
|
||||||
|
{
|
||||||
|
return installPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
installPath = PathUtil.FindInstallPathFromRegistry("QQNT");
|
||||||
|
if (!IsAllFilesExist(installPath))
|
||||||
|
{
|
||||||
|
List<string> defaultPathList = PathUtil.GetDefaultInstallPaths(@"Tencent\QQNT");
|
||||||
|
foreach (string defaultPath in defaultPathList)
|
||||||
|
{
|
||||||
|
if (IsAllFilesExist(defaultPath))
|
||||||
|
{
|
||||||
|
return defaultPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return installPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 == "QQ.exe")
|
||||||
|
{
|
||||||
|
return editor.FileVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -81,6 +81,7 @@
|
||||||
<Compile Include="Modifier\AppModifier.cs" />
|
<Compile Include="Modifier\AppModifier.cs" />
|
||||||
<Compile Include="Modifier\FileHexEditor.cs" />
|
<Compile Include="Modifier\FileHexEditor.cs" />
|
||||||
<Compile Include="Modifier\QQLiteModifier.cs" />
|
<Compile Include="Modifier\QQLiteModifier.cs" />
|
||||||
|
<Compile Include="Modifier\QQNTModifier.cs" />
|
||||||
<Compile Include="Modifier\QQModifier.cs" />
|
<Compile Include="Modifier\QQModifier.cs" />
|
||||||
<Compile Include="Modifier\TIMModifier.cs" />
|
<Compile Include="Modifier\TIMModifier.cs" />
|
||||||
<Compile Include="Modifier\WechatModifier.cs" />
|
<Compile Include="Modifier\WechatModifier.cs" />
|
||||||
|
|
|
@ -57,6 +57,30 @@ namespace RevokeMsgPatcher.Utils
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string FindInstallPathFromRegistryWOW6432Node(string uninstallKeyName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey key = Registry.LocalMachine.OpenSubKey($@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{uninstallKeyName}");
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
object installLocation = key.GetValue("UninstallString");
|
||||||
|
key.Close();
|
||||||
|
if (installLocation != null && !string.IsNullOrEmpty(installLocation.ToString()))
|
||||||
|
{
|
||||||
|
return installLocation.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有可能的默认安装路径
|
/// 获取所有可能的默认安装路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user