From a23b120468a8586a1b5edbd5bbe850bac8a88fc8 Mon Sep 17 00:00:00 2001 From: renjiangtao Date: Sat, 14 Mar 2026 17:00:38 +0800 Subject: [PATCH] Support wechat.dylib patching for wx 36559 --- README.md | 12 ++++++++++-- Sources/WeChatTweak/Command.swift | 10 +++++++++- Sources/WeChatTweak/Config.swift | 3 +++ config.json | 27 +++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1dfee6..6403990 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ A command-line tool for tweaking WeChat. ```bash # 安装 -brew install sunnyyoung/tap/wechattweak +brew install tanranv5/tap/wechattweak # 更新 -brew upgrade wechattweak +brew upgrade tanranv5/tap/wechattweak # 执行 Patch wechattweak patch @@ -28,6 +28,14 @@ wechattweak patch wechattweak versions ``` +## 最新适配 + +- `wx.app 4.1.8.27 (36559)` 下载地址: + `https://dldir1v6.qq.com/weixin/Universal/Mac/xWeChatMac_universal_4.1.8.27_36559.dmg?t=1770782406` +- 本次变更仅做了两类最小补充: + - `config.json` 新增 `36559` 的 x86_64 防撤回和多开配置 + - patch 流程新增 `target.binary` 支持,可直接对 `Contents/Frameworks/wechat.dylib` 打补丁;旧版构建产物只会 patch `Contents/MacOS/WeChat`,不适用于这一版 + ## 参考 - [微信 macOS 客户端无限多开功能实践](https://blog.sunnyyoung.net/wei-xin-macos-ke-hu-duan-wu-xian-duo-kai-gong-neng-shi-jian/) diff --git a/Sources/WeChatTweak/Command.swift b/Sources/WeChatTweak/Command.swift index f0642b3..ba958a7 100644 --- a/Sources/WeChatTweak/Command.swift +++ b/Sources/WeChatTweak/Command.swift @@ -24,7 +24,15 @@ struct Command { } static func patch(app: URL, config: Config) async throws { - try Patcher.patch(binary: app.appendingPathComponent("Contents/MacOS/WeChat"), config: config) + let defaultBinary = "Contents/MacOS/WeChat" + let grouped = Dictionary(grouping: config.targets) { target in + target.binary ?? defaultBinary + } + + for (binary, targets) in grouped { + let subConfig = Config(version: config.version, targets: targets) + try Patcher.patch(binary: app.appendingPathComponent(binary), config: subConfig) + } } static func resign(app: URL) async throws { diff --git a/Sources/WeChatTweak/Config.swift b/Sources/WeChatTweak/Config.swift index 375ba59..9d1952a 100644 --- a/Sources/WeChatTweak/Config.swift +++ b/Sources/WeChatTweak/Config.swift @@ -65,16 +65,19 @@ struct Config: Decodable { struct Target: Decodable { let identifier: String let entries: [Entry] + let binary: String? private enum CodingKeys: CodingKey { case identifier case entries + case binary } init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.identifier = try container.decode(String.self, forKey: .identifier) self.entries = try container.decode([Entry].self, forKey: .entries) + self.binary = try container.decodeIfPresent(String.self, forKey: .binary) } } diff --git a/config.json b/config.json index dd45a4b..a5722d8 100644 --- a/config.json +++ b/config.json @@ -328,5 +328,32 @@ ] } ] + }, + { + "version": "36559", + "targets": [ + { + "identifier": "revoke", + "entries": [ + { + "arch": "x86_64", + "addr": "4B51260", + "asm": "B801000000C3" + } + ], + "binary": "Contents/Frameworks/wechat.dylib" + }, + { + "identifier": "multiInstance", + "entries": [ + { + "arch": "x86_64", + "addr": "21f008", + "asm": "909090909090" + } + ], + "binary": "Contents/Frameworks/wechat.dylib" + } + ] } ]