This commit is contained in:
huiyadanli 2019-07-21 23:20:34 +08:00
parent 295eab9f4c
commit 3f2512d711
17 changed files with 1106 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
.vs/
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Mine
Tmp/
/packages/

25
RevokeMsgPatcher.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2016
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevokeMsgPatcher", "RevokeMsgPatcher\RevokeMsgPatcher.csproj", "{977BF781-CED8-4389-9404-0FA08FDF21DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{977BF781-CED8-4389-9404-0FA08FDF21DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{977BF781-CED8-4389-9404-0FA08FDF21DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{977BF781-CED8-4389-9404-0FA08FDF21DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{977BF781-CED8-4389-9404-0FA08FDF21DF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {56DAEA8C-77F7-4E55-A7AF-CE9F23F2C1A6}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

142
RevokeMsgPatcher/FormMain.Designer.cs generated Normal file
View File

@ -0,0 +1,142 @@
namespace RevokeMsgPatcher
{
partial class FormMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
this.label2 = new System.Windows.Forms.Label();
this.btnPatch = new System.Windows.Forms.Button();
this.txtPath = new System.Windows.Forms.TextBox();
this.btnChoosePath = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btnRestore = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(17, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1;
this.label2.Text = "微信路径:";
//
// btnPatch
//
this.btnPatch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnPatch.Location = new System.Drawing.Point(409, 10);
this.btnPatch.Name = "btnPatch";
this.btnPatch.Size = new System.Drawing.Size(102, 23);
this.btnPatch.TabIndex = 3;
this.btnPatch.Text = "点我防撤回!";
this.btnPatch.UseVisualStyleBackColor = true;
this.btnPatch.Click += new System.EventHandler(this.btnPatch_Click);
//
// txtPath
//
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtPath.Location = new System.Drawing.Point(88, 12);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(275, 21);
this.txtPath.TabIndex = 4;
//
// btnChoosePath
//
this.btnChoosePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnChoosePath.Location = new System.Drawing.Point(369, 10);
this.btnChoosePath.Name = "btnChoosePath";
this.btnChoosePath.Size = new System.Drawing.Size(34, 23);
this.btnChoosePath.TabIndex = 5;
this.btnChoosePath.Text = "...";
this.btnChoosePath.UseVisualStyleBackColor = true;
this.btnChoosePath.Click += new System.EventHandler(this.btnChoosePath_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 44);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.TabIndex = 6;
this.label1.Text = "软件主页(开源)";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(112, 44);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(41, 12);
this.linkLabel1.TabIndex = 7;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "GitHub";
//
// btnRestore
//
this.btnRestore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRestore.Location = new System.Drawing.Point(409, 39);
this.btnRestore.Name = "btnRestore";
this.btnRestore.Size = new System.Drawing.Size(102, 23);
this.btnRestore.TabIndex = 8;
this.btnRestore.Text = "备份还原";
this.btnRestore.UseVisualStyleBackColor = true;
this.btnRestore.Click += new System.EventHandler(this.btnRestore_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(523, 69);
this.Controls.Add(this.btnRestore);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnChoosePath);
this.Controls.Add(this.txtPath);
this.Controls.Add(this.btnPatch);
this.Controls.Add(this.label2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "微信防撤回补丁";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnPatch;
private System.Windows.Forms.TextBox txtPath;
private System.Windows.Forms.Button btnChoosePath;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Button btnRestore;
}
}

View File

@ -0,0 +1,117 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace RevokeMsgPatcher
{
public partial class FormMain : Form
{
Patcher patcher = null;
public FormMain()
{
InitializeComponent();
patcher = new Patcher();
txtPath.Text = Util.AutoFindInstallPath();
if (!string.IsNullOrEmpty(txtPath.Text))
{
patcher.IntallPath = txtPath.Text;
btnRestore.Enabled = File.Exists(patcher.BakPath);
}
}
private void btnPatch_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtPath.Text) || !Util.IsWechatInstallPath(txtPath.Text))
{
MessageBox.Show("请选择微信安装路径!");
return;
}
patcher.IntallPath = txtPath.Text;
try
{
btnPatch.Enabled = false;
string version = patcher.JudgeVersion();
if (!string.IsNullOrEmpty(version))
{
if (version == "done")
{
MessageBox.Show("已经安装过防撤回补丁了");
btnPatch.Enabled = true;
return;
}
if (patcher.Patch())
{
MessageBox.Show("成功安装防撤回补丁!原 WeChatWin.dll 文件已经备份到 " + patcher.BakPath + " ,如果有问题可以手动覆盖恢复");
}
else
{
MessageBox.Show("防撤回补丁安装失败!");
}
btnRestore.Enabled = File.Exists(patcher.BakPath);
}
else
{
MessageBox.Show("当前微信版本不被支持:" + Util.GetFileVersion(patcher.DllPath));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
}
btnPatch.Enabled = true;
}
private void txtPath_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtPath.Text))
{
patcher.IntallPath = txtPath.Text;
btnRestore.Enabled = File.Exists(patcher.BakPath);
}
}
private void btnChoosePath_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择微信安装路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
if (string.IsNullOrEmpty(dialog.SelectedPath) || !Util.IsWechatInstallPath(dialog.SelectedPath))
{
MessageBox.Show("无法找到微信关键文件,请选择正确的微信安装路径!");
}
else
{
txtPath.Text = dialog.SelectedPath;
}
}
}
private void btnRestore_Click(object sender, EventArgs e)
{
btnRestore.Enabled = false;
try
{
if (File.Exists(patcher.BakPath))
{
File.Copy(patcher.BakPath, patcher.DllPath, true);
MessageBox.Show("还原成功");
}
else
{
MessageBox.Show("备份文件不存在");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
}
btnRestore.Enabled = File.Exists(patcher.BakPath);
}
}
}

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA
AADn7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft
8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v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y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft
8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft
8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft8v/n7fL/5+3y/+ft
8v/n7fL/5+3y/+ft8v/n7fL/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root>

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RevokeMsgPatcher.Model
{
public class TargetFile
{
public string FileName { get; set; }
public string Version { get; set; }
public string SHA1Before { get; set; }
public string SHA1After { get; set; }
public long Position { get; set; }
public byte Content { get; set; }
}
}

View File

@ -0,0 +1,86 @@
using RevokeMsgPatcher.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Web.Script.Serialization;
namespace RevokeMsgPatcher
{
public class Patcher
{
private string intallPath;
public string IntallPath
{
get { return intallPath; }
set
{
intallPath = value;
if (!string.IsNullOrEmpty(intallPath) && Util.IsWechatInstallPath(intallPath))
{
dllPath = Path.Combine(intallPath, "WeChatWin.dll");
bakPath = Path.Combine(intallPath, "WeChatWin.dll.h.bak");
}
else
{
intallPath = null;
dllPath = null;
bakPath = null;
}
}
}
private string dllPath;
private string bakPath;
public string DllPath { get => dllPath; }
public string BakPath { get => bakPath; }
private List<TargetFile> targetFiles;
private TargetFile currentFile;
public Patcher()
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
targetFiles = serializer.Deserialize<List<TargetFile>>(Properties.Resources.PatchJson);
}
public string JudgeVersion()
{
string sha1 = Util.ComputeFileSHA1(dllPath);
Debug.WriteLine(sha1);
foreach (TargetFile t in targetFiles)
{
if (sha1 == t.SHA1After)
{
return "done";
}
if (sha1 == t.SHA1Before)
{
currentFile = t;
return t.Version;
}
}
return null;
}
public bool Patch()
{
if (currentFile != null)
{
File.Copy(dllPath, bakPath, true);
bool done = Util.EditHex(dllPath, currentFile.Position, currentFile.Content);
if (!done)
{
File.Copy(bakPath, dllPath, true);
}
return done;
}
return false;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RevokeMsgPatcher
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("RevokeMsgPatcher")]
[assembly: AssemblyDescription("微信防撤回补丁")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("huiyadanli")]
[assembly: AssemblyProduct("RevokeMsgPatcher")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("977bf781-ced8-4389-9404-0fa08fdf21df")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
//[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace RevokeMsgPatcher.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RevokeMsgPatcher.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找类似 [{&quot;FileName&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.6.8.52&quot;,&quot;SHA1Before&quot;:&quot;88131302f664df6a657c9ca49d152da536fe5729&quot;,&quot;SHA1After&quot;:&quot;8d1454b73831644181e962c1fa0ea4e2da4124a3&quot;,&quot;Position&quot;:2453049,&quot;Content&quot;:117},{&quot;FileName&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.6.8.51&quot;,&quot;SHA1Before&quot;:&quot;d0a5517b1292a751501b00b4b1f0702db2d9fc30&quot;,&quot;SHA1After&quot;:&quot;53e7b1525d49bf2c3250a8131ff0ba2510779b78&quot;,&quot;Position&quot;:2452614,&quot;Content&quot;:116},{&quot;FileName&quot;:&quot;WeChatWin.dll&quot;,&quot;Version&quot;:&quot;2.6.8.37&quot;,&quot;SHA1Before&quot;:&quot;7e01f8b04a158a4a50bc5a6e67c2fb8b02233170&quot;,&quot;SHA1After&quot;:&quot;a1895 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string PatchJson {
get {
return ResourceManager.GetString("PatchJson", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PatchJson" xml:space="preserve">
<value>[{"FileName":"WeChatWin.dll","Version":"2.6.8.52","SHA1Before":"88131302f664df6a657c9ca49d152da536fe5729","SHA1After":"8d1454b73831644181e962c1fa0ea4e2da4124a3","Position":2453049,"Content":117},{"FileName":"WeChatWin.dll","Version":"2.6.8.51","SHA1Before":"d0a5517b1292a751501b00b4b1f0702db2d9fc30","SHA1After":"53e7b1525d49bf2c3250a8131ff0ba2510779b78","Position":2452614,"Content":116},{"FileName":"WeChatWin.dll","Version":"2.6.8.37","SHA1Before":"7e01f8b04a158a4a50bc5a6e67c2fb8b02233170","SHA1After":"a1895004415fe9bcd7e690bd6e482b833b515599","Position":2452614,"Content":116},{"FileName":"WeChatWin.dll","Version":"2.6.7.57","SHA1Before":"80a91aaf941bcb1c24a7d672838ac73e9ebb2e40","SHA1After":"a0d3f9a45a835f97aef7fe0872387d8cfb5c25a4","Position":2433413,"Content":116},{"FileName":"WeChatWin.dll","Version":"2.6.7.40","SHA1Before":"04bd0cb28df6630b518f42a3f9c2caa4a9359fbc","SHA1After":"13c91cf1d4609959771fd137b9a86a5ca365e1b6","Position":2432934,"Content":116},{"FileName":"WeChatWin.dll","Version":"2.6.7.32","SHA1Before":"a02519c1007ee6723947c262c720d63c619f633e","SHA1After":"f3007471ca8734c29783c25f0bb49949a783a44","Position":2432806,"Content":116},{"FileName":"WeChatWin.dll","Version":"2.6.6.28","SHA1Before":"0b19cb17a62c3ea0efce0fb675a1d3b17845cba3","SHA1After":"260948656725446b818ea668273ceff02ddfb44d","Position":2401678,"Content":116}]</value>
</data>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RevokeMsgPatcher.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{977BF781-CED8-4389-9404-0FA08FDF21DF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>RevokeMsgPatcher</RootNamespace>
<AssemblyName>RevokeMsgPatcher</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Model\TargetFile.cs" />
<Compile Include="Patcher.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
<EmbeddedResource Include="FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

102
RevokeMsgPatcher/Util.cs Normal file
View File

@ -0,0 +1,102 @@
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace RevokeMsgPatcher
{
public class Util
{
/// <summary>
/// 自动查找安装路径
/// </summary>
/// <returns>安装路径</returns>
public static string AutoFindInstallPath()
{
// 微信的注册表路径
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\WeChat");
object installLocation = key.GetValue("InstallLocation");
key.Close();
if (installLocation == null || string.IsNullOrEmpty(installLocation.ToString()) || !IsWechatInstallPath(installLocation.ToString()))
{
// 从默认安装目录查找
string[] drives = Environment.GetLogicalDrives(); //获取当前计算机逻辑磁盘名称列表
foreach (string d in drives)
{
string assertPath = Path.Combine(d, @"Program Files (x86)\Tencent\WeChat");
if (IsWechatInstallPath(assertPath))
{
return assertPath;
}
}
}
else
{
return installLocation.ToString();
}
return null;
}
/// <summary>
/// 通过文件是否存在判断是否是安装目录
/// </summary>
/// <param name="path">安装目录</param>
/// <returns></returns>
public static bool IsWechatInstallPath(string path)
{
return File.Exists(Path.Combine(path, "WeChatWin.dll")) && File.Exists(Path.Combine(path, "WeChat.exe"));
}
/// <summary>
/// 获取文件版本
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static string GetFileVersion(string path)
{
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(path);
return fileVersionInfo.FileVersion;
}
/// <summary>
/// 计算文件SHA1
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string ComputeFileSHA1(string s)
{
FileStream file = new FileStream(s, FileMode.Open);
SHA1 sha1 = new SHA1CryptoServiceProvider();
byte[] retval = sha1.ComputeHash(file);
file.Close();
StringBuilder sc = new StringBuilder();
for (int i = 0; i < retval.Length; i++)
{
sc.Append(retval[i].ToString("x2"));
}
return sc.ToString();
}
/// <summary>
/// 修改文件指定位置的字节
/// </summary>
/// <param name="path">WeChatWin.dll 的路径</param>
/// <param name="position">偏移位置</param>
/// <param name="after">修改后的值</param>
/// <returns></returns>
public static bool EditHex(string path, long position, byte after)
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite))
{
stream.Position = position;
stream.WriteByte(after);
}
return true;
}
}
}

BIN
RevokeMsgPatcher/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB