Browse by type
Windows 微信 Hook DLL,当前版本以 version.dll 代理方式加载,在微信主进程中启动本地 HTTP 服务,提供消息发送、XML 转发、图片解码、个人资料读取和数据库查询接口。
4.1.10.27version.dll0.0.0.0:30001version.dll。version.dll 放到微信安装目录下,我这里是:C:\Program Files\Tencent\Weixin
30001。http://127.0.0.1:30001
postman/WeChat-Hook.postman_collection.json
dllmain.cpp:DLL 入口,解析启动参数,加载真实系统 version.dll,只在微信主进程初始化。src/version_proxy.cpp:代理系统 version.dll 导出函数。src/inline_weixin_dll_load.cpp:等待并初始化 Weixin.dll 相关逻辑,启动 HTTP 服务。src/http_routes.cpp:HTTP 路由注册入口。src/SendTextMsg.cpp:文本发送和图片解码接口。src/SendImageMsg.cpp:图片发送接口。src/ForwardXMLMsg.cpp:XML 消息转发接口。src/GetSelfProfile.cpp:当前账号资料接口。src/QueryDB.cpp、xdb/:微信进程内 SQLite 数据库查询接口。使用 Visual Studio / MSBuild 编译:
MSBuild.exe x64_Version_dll.vcxproj /m /t:Build /p:Configuration=Release /p:Platform=x64
Release 输出:
x64\Release\version.dll
Debug 输出:
x64\Debug\version.dll
项目生成的 DLL 文件名为 version.dll。加载后会代理系统 version.dll 的导出函数,并在微信主进程内初始化 Hook 与 HTTP 服务。
支持的命令行参数:
| 参数 | 默认值 | 说明 |
|---|---|---|
StartPort= |
30001 |
HTTP 服务监听端口 |
RecvType= |
1 |
接收回调类型参数,当前保留解析 |
CallBackURL= |
空 | 接收回调地址,当前用于保存配置和端口解析 |
示例:
WeChat.exe StartPort=30001 CallBackURL="http://127.0.0.1:8080/callback"
所有接口默认基地址:
http://127.0.0.1:30001
POST /SendTextMsg
请求:
{
"wxidorgid": "wxid_xxx",
"msg": "hello"
}
响应:
{
"ret": 0,
"retmsg": "success"
}
curl:
curl -X POST http://127.0.0.1:30001/SendTextMsg \
-H "Content-Type: application/json" \
-d "{\"wxidorgid\":\"wxid_xxx\",\"msg\":\"hello\"}"
POST /SendImgMsg
请求:
{
"wxidorgid": "wxid_xxx",
"path": "C:\\path\\image.jpg"
}
响应:
{
"ret": 0,
"retmsg": "success"
}
POST /ForwardXMLMsg
请求:
{
"to_wxid": "wxid_xxx",
"content": "<msg>...</msg>"
}
响应:
{
"ret": 0,
"retmsg": "success"
}
失败时:
{
"ret": 1,
"retmsg": "fail"
}
POST /Decode_Pic
请求:
{
"src_path": "C:\\path\\source.dat",
"dst_path": "C:\\path\\output.jpg"
}
响应:
{
"ret": 0,
"retmsg": "success"
}
POST /GetSelfProfile
请求体可为空。
响应字段:
{
"wxid": "",
"alias": "",
"nickname": "",
"email": "",
"qq": 0,
"phone": "",
"proiv": "",
"area": "",
"signinfo": ""
}
POST /QueryDB/execute
请求:
{
"optDbName": "MicroMsg.db",
"SQL": "SELECT * FROM ChatRoom LIMIT 10"
}
响应:
{
"status": 0,
"desc": "",
"data": []
}
POST /QueryDB/GetAllDBName
请求体需要是合法 JSON,可传空对象:
{}
响应:
[
{
"dbName": "MicroMsg.db",
"dbHandle": 123456789
}
]
GET /QueryDB/status
响应:
{
"IsLogin": 1,
"hWeixin": 123456789
}
{
"ret": -1,
"msg": "invalid json"
}
status / desc / data 作为返回字段。ret / retmsg 作为返回字段。本项目依赖微信内部偏移,微信升级后需要重新核对偏移和调用约定。当前 README 与 Release DLL 对应微信 4.1.10.27。
$ claude mcp add WeChat-Hook \
-- python -m otcore.mcp_server <graph>