Merge pull request #1 from lich0821/master

update
This commit is contained in:
hcaihao 2023-04-11 16:09:02 +08:00 committed by GitHub
commit 5503831ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 27 deletions

View File

@ -61,14 +61,13 @@ class Wcf():
self.sender = msg.sender self.sender = msg.sender
self.roomid = msg.roomid self.roomid = msg.roomid
self.content = msg.content self.content = msg.content
self.extra_data = msg.extra_data self.extra = msg.extra
def __str__(self) -> str: def __str__(self) -> str:
s = f"{'自己发的:' if self._is_self else ''}" s = f"{'自己发的:' if self._is_self else ''}"
s += f"{self.sender}[{self.roomid}]:{self.id}:{self.type}:{self.xml.replace(chr(10), '').replace(chr(9),'')}\n" s += f"{self.sender}[{self.roomid}]:{self.id}:{self.type}:{self.xml.replace(chr(10), '').replace(chr(9),'')}\n"
s += self.content s += self.content
s += "\n" s += f"\n{self.extra}" if self.extra else ""
s += self.extra_data
return s return s
def from_self(self) -> bool: def from_self(self) -> bool:

View File

@ -43,5 +43,5 @@ typedef struct {
string sender; string sender;
string roomid; string roomid;
string content; string content;
string extra_data; string extra;
} WxMsg_t; } WxMsg_t;

View File

@ -3,23 +3,6 @@ syntax = "proto3";
package wcf; package wcf;
option java_package = "com.iamteer"; option java_package = "com.iamteer";
/*
service Wcf {
rpc RpcIsLogin(Empty) returns (Response) {}
rpc RpcGetSelfWxid(Empty) returns (String) {}
rpc RpcEnableRecvMsg(Empty) returns (stream WxMsg) {}
rpc RpcDisableRecvMsg(Empty) returns (Response) {}
rpc RpcSendTextMsg(TextMsg) returns (Response) {}
rpc RpcSendPathMsg(PathMsg) returns (Response) {}
rpc RpcGetMsgTypes(Empty) returns (MsgTypes) {}
rpc RpcGetContacts(Empty) returns (Contacts) {}
rpc RpcGetDbNames(Empty) returns (DbNames) {}
rpc RpcGetDbTables(String) returns (DbTables) {}
rpc RpcExecDbQuery(DbQuery) returns (DbRows) {}
rpc RpcAcceptNewFriend(Verification) returns (Response) {}
}
*/
enum Functions { enum Functions {
FUNC_RESERVED = 0x00; FUNC_RESERVED = 0x00;
FUNC_IS_LOGIN = 0x01; FUNC_IS_LOGIN = 0x01;
@ -84,7 +67,7 @@ message WxMsg
string sender = 6; // string sender = 6; //
string roomid = 7; // id string roomid = 7; // id
string content = 8; // string content = 8; //
string extra_data = 9; // string extra = 9; //
} }
message TextMsg message TextMsg

View File

@ -6,10 +6,10 @@
#define SUPPORT_VERSION L"3.7.0.30" #define SUPPORT_VERSION L"3.7.0.30"
WxCalls_t wxCalls = { WxCalls_t wxCalls = {
0x2366538, // Login Status 0x2366538, // Login Status
{ 0x236607C, 0x23660F4, 0x2366128 }, // User Info: wxid, nickname, mobile { 0x236607C, 0x23660F4, 0x2366128, 0x2386F7C }, // User Info: wxid, nickname, mobile, home
0x521D30, // Send Message 0x521D30, // Send Message
/* Receive Message: /* Receive Message:
Hook, call, type, self, id, msgXml, roomId, wxId, content, extra_data */ Hook, call, type, self, id, msgXml, roomId, wxId, content, extra */
{ 0x550F4C, 0xA96350, 0x38, 0x3C, 0x184, 0x1EC, 0x48, 0x170, 0x70, 0x1AC }, { 0x550F4C, 0xA96350, 0x38, 0x3C, 0x184, 0x1EC, 0x48, 0x170, 0x70, 0x1AC },
{ 0xBD780, 0x771980, 0x521640 }, // Send Image Message { 0xBD780, 0x771980, 0x521640 }, // Send Image Message
{ 0xC3B70, 0x771980, 0x3ED8C0 }, // Send File Message { 0xC3B70, 0x771980, 0x3ED8C0 }, // Send File Message

View File

@ -7,6 +7,7 @@
#include "load_calls.h" #include "load_calls.h"
#include "receive_msg.h" #include "receive_msg.h"
#include "user_info.h"
#include "util.h" #include "util.h"
// Defined in rpc_server.cpp // Defined in rpc_server.cpp
@ -89,6 +90,10 @@ void DispatchMsg(DWORD reg)
wxMsg.sender = GetStringByAddress(*p + g_WxCalls.recvMsg.roomId); wxMsg.sender = GetStringByAddress(*p + g_WxCalls.recvMsg.roomId);
} }
wxMsg.content = GetStringByAddress(*p + g_WxCalls.recvMsg.content); wxMsg.content = GetStringByAddress(*p + g_WxCalls.recvMsg.content);
wxMsg.extra = GetStringByAddress(*p + g_WxCalls.recvMsg.extra);
if (!wxMsg.extra.empty()) {
wxMsg.extra = GetHomePath() + "\\" + wxMsg.extra;
}
{ {
unique_lock<mutex> lock(gMutex); unique_lock<mutex> lock(gMutex);

View File

@ -330,6 +330,7 @@ static void PushMessage()
rsp.msg.wxmsg.sender = (char *)wxmsg.sender.c_str(); rsp.msg.wxmsg.sender = (char *)wxmsg.sender.c_str();
rsp.msg.wxmsg.roomid = (char *)wxmsg.roomid.c_str(); rsp.msg.wxmsg.roomid = (char *)wxmsg.roomid.c_str();
rsp.msg.wxmsg.content = (char *)wxmsg.content.c_str(); rsp.msg.wxmsg.content = (char *)wxmsg.content.c_str();
rsp.msg.wxmsg.extra = (char *)wxmsg.extra.c_str();
gMsgQueue.pop(); gMsgQueue.pop();
LOG_DEBUG("Recv msg: {}", wxmsg.content); LOG_DEBUG("Recv msg: {}", wxmsg.content);
pb_ostream_t stream = pb_ostream_from_buffer(buffer, G_BUF_SIZE); pb_ostream_t stream = pb_ostream_from_buffer(buffer, G_BUF_SIZE);

View File

@ -6,6 +6,7 @@ typedef struct UserInfoCall {
DWORD wxid; DWORD wxid;
DWORD nickName; DWORD nickName;
DWORD mobile; DWORD mobile;
DWORD home;
} UserInfoCall_t; } UserInfoCall_t;
typedef struct RecvMsg { typedef struct RecvMsg {
@ -18,7 +19,7 @@ typedef struct RecvMsg {
DWORD roomId; // 群聊时为群ID私聊时为微信ID DWORD roomId; // 群聊时为群ID私聊时为微信ID
DWORD wxId; // 私聊时为空群聊时为发送者微信ID DWORD wxId; // 私聊时为空群聊时为发送者微信ID
DWORD content; // 消息内容地址 DWORD content; // 消息内容地址
DWORD extra_data; // 附加数据 DWORD extra; // 附加数据
} RecvMsg_t; } RecvMsg_t;
typedef struct Sendfile { typedef struct Sendfile {

View File

@ -6,7 +6,9 @@
extern WxCalls_t g_WxCalls; extern WxCalls_t g_WxCalls;
extern DWORD g_WeChatWinDllAddr; extern DWORD g_WeChatWinDllAddr;
std::string GetSelfWxid() string GetHomePath() { return GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.home); }
string GetSelfWxid()
{ {
DWORD wxidType = 0; DWORD wxidType = 0;
try { try {

View File

@ -2,4 +2,7 @@
#include <string> #include <string>
std::string GetSelfWxid(); using namespace std;
string GetHomePath();
string GetSelfWxid();