Support wechat.dylib patching for wx 36559

This commit is contained in:
renjiangtao 2026-03-14 17:00:38 +08:00
parent 69bfe8b953
commit a23b120468
4 changed files with 49 additions and 3 deletions

View File

@ -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/)

View File

@ -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 {

View File

@ -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)
}
}

View File

@ -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"
}
]
}
]