[+] 添加对QQ轻聊版的支持

This commit is contained in:
huiyadanli 2019-11-03 17:01:45 +08:00
parent a9f41478f6
commit 703fbbdbb3
7 changed files with 170 additions and 8 deletions

View File

@ -15,7 +15,7 @@ namespace RevokeMsgPatcher
return new Bag
{
Apps = AppConfig(),
LatestVersion = "0.5",
LatestVersion = "0.6",
Notice = "公告"
};
}
@ -32,7 +32,8 @@ namespace RevokeMsgPatcher
{
{ "Wechat" , Wechat() },
{ "QQ" , QQ() },
{ "TIM" , TIM() }
{ "TIM" , TIM() },
{ "QQLite" , QQLite() }
};
}
@ -347,5 +348,73 @@ namespace RevokeMsgPatcher
}
};
}
public App QQLite()
{
return new App
{
Name = "QQLite",
FileTargetInfos = new Dictionary<string, TargetInfo>
{
{
"IM.dll",
new TargetInfo
{
Name = "IM.dll",
RelativePath = @"Bin\IM.dll"
}
}
},
FileModifyInfos = new Dictionary<string, List<ModifyInfo>>
{
{
"IM.dll",
new List<ModifyInfo>
{
new ModifyInfo
{
Name = "IM.dll",
Version = "7.9.14314.0",
SHA1Before = "2e97d7671963fa148a1beeda6ce4964314310593",
SHA1After = "723c008fb53435ead20fa6f2e951c9a4a8ff46da",
Changes = new List<Change>
{
new Change
{
Position = 0x00024505,
Content = new byte[] { 0xEB, 0x02, 0x90, 0x90 }
},
new Change
{
Position = 0x000248B9,
Content = new byte[] { 0xEB, 0x02, 0x90, 0x90 }
}
}
},
new ModifyInfo
{
Name = "IM.dll",
Version = "7.9.14308.0",
SHA1Before = "b8a7a873178706b97be11c25f13bcf09e9e578a2",
SHA1After = "c5bf533c7af6996b42d1fb2a0fb3f26dfd52f8bf",
Changes = new List<Change>
{
new Change
{
Position = 0x00024505,
Content = new byte[] { 0xEB, 0x02, 0x90, 0x90 }
},
new Change
{
Position = 0x000248B9,
Content = new byte[] { 0xEB, 0x02, 0x90, 0x90 }
}
}
}
}
}
}
};
}
}
}

View File

@ -44,6 +44,7 @@
this.rbtTIM = new System.Windows.Forms.RadioButton();
this.label5 = new System.Windows.Forms.Label();
this.panelMask = new System.Windows.Forms.Panel();
this.rbtQQLite = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// lblPathTag
@ -136,9 +137,8 @@
this.lblVersion.AutoSize = true;
this.lblVersion.Location = new System.Drawing.Point(83, 61);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(35, 12);
this.lblVersion.Size = new System.Drawing.Size(0, 12);
this.lblVersion.TabIndex = 10;
this.lblVersion.Text = "0.0.1";
//
// lblVersionTag
//
@ -201,11 +201,22 @@
this.panelMask.TabIndex = 17;
this.panelMask.Visible = false;
//
// rbtQQLite
//
this.rbtQQLite.AutoSize = true;
this.rbtQQLite.Location = new System.Drawing.Point(235, 7);
this.rbtQQLite.Name = "rbtQQLite";
this.rbtQQLite.Size = new System.Drawing.Size(71, 16);
this.rbtQQLite.TabIndex = 18;
this.rbtQQLite.Text = "QQ轻聊版";
this.rbtQQLite.UseVisualStyleBackColor = true;
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(490, 110);
this.Controls.Add(this.rbtQQLite);
this.Controls.Add(this.lblUpdatePachJson);
this.Controls.Add(this.panelMask);
this.Controls.Add(this.lblVersion);
@ -248,6 +259,7 @@
private System.Windows.Forms.RadioButton rbtTIM;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Panel panelMask;
private System.Windows.Forms.RadioButton rbtQQLite;
}
}

View File

@ -19,6 +19,7 @@ namespace RevokeMsgPatcher
private WechatModifier wechatModifier = null;
private QQModifier qqModifier = null;
private TIMModifier timModifier = null;
private QQLiteModifier qqLiteModifier = null;
private string thisVersion;
private bool needUpdate = false;
@ -35,10 +36,12 @@ namespace RevokeMsgPatcher
wechatModifier = new WechatModifier(bag.Apps["Wechat"]);
qqModifier = new QQModifier(bag.Apps["QQ"]);
timModifier = new TIMModifier(bag.Apps["TIM"]);
qqLiteModifier = new QQLiteModifier(bag.Apps["QQLite"]);
rbtWechat.Tag = wechatModifier;
rbtQQ.Tag = qqModifier;
rbtTIM.Tag = timModifier;
rbtQQLite.Tag = qqLiteModifier;
// 默认微信
rbtWechat.Enabled = true;
@ -68,11 +71,12 @@ namespace RevokeMsgPatcher
{
// 自动获取应用安装路径
txtPath.Text = modifier.FindInstallPath();
lblVersion.Text = modifier.GetVersion();
btnRestore.Enabled = false;
// 显示是否能够备份还原
if (!string.IsNullOrEmpty(txtPath.Text))
{
modifier.InitEditors(txtPath.Text);
lblVersion.Text = modifier.GetVersion();
btnRestore.Enabled = modifier.BackupExists();
}
}
@ -169,6 +173,14 @@ namespace RevokeMsgPatcher
else
{
txtPath.Text = dialog.SelectedPath;
btnRestore.Enabled = false;
// 显示是否能够备份还原
if (!string.IsNullOrEmpty(txtPath.Text))
{
modifier.InitEditors(txtPath.Text);
lblVersion.Text = modifier.GetVersion();
btnRestore.Enabled = modifier.BackupExists();
}
}
}
}
@ -214,6 +226,7 @@ namespace RevokeMsgPatcher
wechatModifier.Config = bag.Apps["Wechat"];
qqModifier.Config = bag.Apps["QQ"];
timModifier.Config = bag.Apps["TIM"];
qqLiteModifier.Config = bag.Apps["QQLite"];
if (Convert.ToDecimal(bag.LatestVersion) > Convert.ToDecimal(thisVersion))
{
@ -266,6 +279,7 @@ namespace RevokeMsgPatcher
tips += "支持以下版本" + Environment.NewLine;
tips += " ➯ 微信:" + wechatModifier.Config.GetSupportVersionStr() + Environment.NewLine;
tips += " ➯ QQ" + qqModifier.Config.GetSupportVersionStr() + Environment.NewLine;
tips += " ➯ QQ轻聊版" + qqLiteModifier.Config.GetSupportVersionStr() + Environment.NewLine;
tips += " ➯ TIM" + timModifier.Config.GetSupportVersionStr() + Environment.NewLine;
DialogResult dr = MessageBox.Show(tips, "当前支持防撤回的版本", MessageBoxButtons.OKCancel);
@ -292,14 +306,20 @@ namespace RevokeMsgPatcher
{
modifier = (TIMModifier)rbtTIM.Tag;
}
else if (rbtQQLite.Checked)
{
modifier = (QQLiteModifier)rbtQQLite.Tag;
}
txtPath.Text = modifier.FindInstallPath();
lblVersion.Text = modifier.GetVersion();
ga.RequestPageView($"{GetCheckedRadioButtonNameEn()}/{lblVersion.Text}/switch", "切换标签页");
EnableAllButton(true);
lblVersion.Text = "";
btnRestore.Enabled = false;
// 显示是否能够备份还原
if (!string.IsNullOrEmpty(txtPath.Text))
{
modifier.InitEditors(txtPath.Text);
lblVersion.Text = modifier.GetVersion();
btnRestore.Enabled = modifier.BackupExists();
}
}
@ -318,6 +338,10 @@ namespace RevokeMsgPatcher
{
return "tim";
}
else if (rbtQQLite.Checked)
{
return "qqlite";
}
return "none";
}

View File

@ -0,0 +1,56 @@
using RevokeMsgPatcher.Model;
using RevokeMsgPatcher.Utils;
namespace RevokeMsgPatcher.Modifier
{
class QQLiteModifier : AppModifier
{
public QQLiteModifier(App config)
{
this.config = config;
}
/// <summary>
/// 自动寻找获取微信安装路径
/// </summary>
/// <returns></returns>
public override string FindInstallPath()
{
string installPath = PathUtil.FindInstallPathFromRegistry("QQLite");
if (!IsAllFilesExist(installPath))
{
foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\QQLite"))
{
if (IsAllFilesExist(defaultPath))
{
return defaultPath;
}
}
}
else
{
return installPath;
}
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 == "IM.dll")
{
return editor.FileVersion;
}
}
}
return "";
}
}
}

View File

@ -16,7 +16,7 @@ namespace RevokeMsgPatcher.Modifier
/// <returns></returns>
public override string FindInstallPath()
{
string installPath = PathUtil.FindInstallPathFromRegistry("{052CFB79-9D62-42E3-8A15-DE66C2C97C3E} ");
string installPath = PathUtil.FindInstallPathFromRegistry("{052CFB79-9D62-42E3-8A15-DE66C2C97C3E}");
if (!IsAllFilesExist(installPath))
{
foreach (string defaultPath in PathUtil.GetDefaultInstallPaths(@"Tencent\QQ"))

File diff suppressed because one or more lines are too long

View File

@ -64,6 +64,7 @@
<Compile Include="Model\TargetInfo.cs" />
<Compile Include="Modifier\AppModifier.cs" />
<Compile Include="Modifier\FileHexEditor.cs" />
<Compile Include="Modifier\QQLiteModifier.cs" />
<Compile Include="Modifier\QQModifier.cs" />
<Compile Include="Modifier\TIMModifier.cs" />
<Compile Include="Modifier\WechatModifier.cs" />