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.roomid = msg.roomid
self.content = msg.content
self.extra_data = msg.extra_data
self.extra = msg.extra
def __str__(self) -> str:
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 += self.content
s += "\n"
s += self.extra_data
s += f"\n{self.extra}" if self.extra else ""
return s
def from_self(self) -> bool:

View File

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

View File

@ -3,23 +3,6 @@ syntax = "proto3";
package wcf;
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 {
FUNC_RESERVED = 0x00;
FUNC_IS_LOGIN = 0x01;
@ -84,7 +67,7 @@ message WxMsg
string sender = 6; //
string roomid = 7; // id
string content = 8; //
string extra_data = 9; //
string extra = 9; //
}
message TextMsg

View File

@ -6,10 +6,10 @@
#define SUPPORT_VERSION L"3.7.0.30"
WxCalls_t wxCalls = {
0x2366538, // Login Status
{ 0x236607C, 0x23660F4, 0x2366128 }, // User Info: wxid, nickname, mobile
{ 0x236607C, 0x23660F4, 0x2366128, 0x2386F7C }, // User Info: wxid, nickname, mobile, home
0x521D30, // Send 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 },
{ 0xBD780, 0x771980, 0x521640 }, // Send Image Message
{ 0xC3B70, 0x771980, 0x3ED8C0 }, // Send File Message

View File

@ -7,6 +7,7 @@
#include "load_calls.h"
#include "receive_msg.h"
#include "user_info.h"
#include "util.h"
// Defined in rpc_server.cpp
@ -89,6 +90,10 @@ void DispatchMsg(DWORD reg)
wxMsg.sender = GetStringByAddress(*p + g_WxCalls.recvMsg.roomId);
}
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);

View File

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

View File

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

View File

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

View File

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