Impl invite chatroom member. Close #69
This commit is contained in:
parent
350d426fee
commit
d0b8cc2305
@ -32,6 +32,7 @@ enum Functions {
|
||||
FUNC_DECRYPT_IMAGE = 0x60;
|
||||
FUNC_ADD_ROOM_MEMBERS = 0x70;
|
||||
FUNC_DEL_ROOM_MEMBERS = 0x71;
|
||||
FUNC_INV_ROOM_MEMBERS = 0x72;
|
||||
}
|
||||
|
||||
message Request
|
||||
@ -45,7 +46,7 @@ message Request
|
||||
PathMsg file = 5;
|
||||
DbQuery query = 6;
|
||||
Verification v = 7;
|
||||
AddMembers m = 8;
|
||||
MemberMgmt m = 8; // 群成员管理,添加、删除、邀请
|
||||
XmlMsg xml = 9;
|
||||
DecPath dec = 10;
|
||||
Transfer tf = 11;
|
||||
@ -160,7 +161,7 @@ message Verification
|
||||
int32 scene = 3; // 添加方式:17 名片,30 扫码
|
||||
}
|
||||
|
||||
message AddMembers
|
||||
message MemberMgmt
|
||||
{
|
||||
string roomid = 1; // 要加的群ID
|
||||
string wxids = 2; // 要加群的人列表,逗号分隔
|
||||
|
@ -114,3 +114,67 @@ int DelChatroomMember(string roomid, string wxids)
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int InviteChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
wstring wsRoomid = String2Wstring((roomid));
|
||||
WxString wxRoomid(wsRoomid);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
WxString wxMember(vMembers.back());
|
||||
vWxMembers.push_back(wxMember);
|
||||
}
|
||||
|
||||
LOG_DEBUG("Inviting {} members[{}] to {}", vWxMembers.size(), wxids.c_str(), roomid.c_str());
|
||||
|
||||
DWORD irmCall1 = g_WeChatWinDllAddr + g_WxCalls.irm.call1;
|
||||
DWORD irmCall2 = g_WeChatWinDllAddr + g_WxCalls.irm.call2;
|
||||
DWORD irmCall3 = g_WeChatWinDllAddr + g_WxCalls.irm.call3;
|
||||
DWORD irmCall4 = g_WeChatWinDllAddr + g_WxCalls.irm.call4;
|
||||
DWORD irmCall5 = g_WeChatWinDllAddr + g_WxCalls.irm.call5;
|
||||
DWORD irmCall6 = g_WeChatWinDllAddr + g_WxCalls.irm.call6;
|
||||
DWORD irmCall7 = g_WeChatWinDllAddr + g_WxCalls.irm.call7;
|
||||
DWORD irmCall8 = g_WeChatWinDllAddr + g_WxCalls.irm.call8;
|
||||
|
||||
DWORD sys_addr = (DWORD)GetModuleHandleA("win32u.dll") + 0x116C;
|
||||
DWORD addr[2] = { sys_addr, 0 };
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call irmCall1;
|
||||
lea ecx, addr;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call irmCall2;
|
||||
call irmCall3;
|
||||
sub esp, 0x8;
|
||||
lea eax, addr;
|
||||
mov ecx, esp;
|
||||
push eax;
|
||||
call irmCall4;
|
||||
sub esp, 0x14;
|
||||
mov ecx, esp;
|
||||
lea eax, wxRoomid;
|
||||
push eax;
|
||||
call irmCall5;
|
||||
lea eax, vWxMembers;
|
||||
push eax;
|
||||
call irmCall6;
|
||||
call irmCall1;
|
||||
push 0x0;
|
||||
push 0x1;
|
||||
mov ecx, eax;
|
||||
call irmCall7;
|
||||
lea ecx, addr;
|
||||
call irmCall8;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -4,3 +4,4 @@
|
||||
|
||||
int AddChatroomMember(std::string roomid, std::string wxids);
|
||||
int DelChatroomMember(std::string roomid, std::string wxids);
|
||||
int InviteChatroomMember(std::string roomid, std::string wxids);
|
||||
|
@ -35,7 +35,9 @@ WxCalls_t wxCalls = {
|
||||
/* call1, call2, call3, call4, call5*/
|
||||
{0x76E630, 0x76AE20, 0xF59E40, 0xB73000, 0x76E350},
|
||||
/* call1, call2, call3 */
|
||||
{0x931730, 0x1D58751, 0x1421940}
|
||||
{0x931730, 0x1D58751, 0x1421940},
|
||||
/* call1, call2, call3, call4, call5, call6, call7, call8*/
|
||||
{0x78CB40, 0x7F99D0, 0x78CF20, 0x78CEF0, 0xF59E40, 0xBD1A00, 0x7FA980, 0x755060}
|
||||
};
|
||||
|
||||
int LoadCalls(const wchar_t *version, WxCalls_t *calls)
|
||||
|
@ -717,6 +717,30 @@ bool func_del_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_invite_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_INV_ROOM_MEMBERS;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
rsp.msg.status = 0;
|
||||
|
||||
if ((roomid == NULL) || (wxids == NULL)) {
|
||||
LOG_ERROR("Empty roomid or wxids.");
|
||||
rsp.msg.status = -1;
|
||||
} else {
|
||||
rsp.msg.status = InviteChatroomMember(roomid, wxids);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
|
||||
{
|
||||
bool ret = false;
|
||||
@ -868,6 +892,11 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_del_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_INV_ROOM_MEMBERS: {
|
||||
LOG_DEBUG("[Functions_FUNC_INV_ROOM_MEMBERS]");
|
||||
ret = func_invite_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_ERROR("[UNKNOW FUNCTION]");
|
||||
break;
|
||||
|
Binary file not shown.
@ -51,7 +51,7 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 39,0,9,0
|
||||
FILEVERSION 39,0,10,0
|
||||
PRODUCTVERSION 3,9,2,23
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
@ -69,7 +69,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "WeChatFerry"
|
||||
VALUE "FileDescription", "WeChatFerry"
|
||||
VALUE "FileVersion", "39.0.9.0"
|
||||
VALUE "FileVersion", "39.0.10.0"
|
||||
VALUE "InternalName", "spy.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2023"
|
||||
VALUE "OriginalFilename", "spy.dll"
|
||||
|
@ -134,6 +134,17 @@ typedef struct CallPatMsg {
|
||||
DWORD call3;
|
||||
} CallPatMsg_t;
|
||||
|
||||
typedef struct CallInviteCM {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD call5;
|
||||
DWORD call6;
|
||||
DWORD call7;
|
||||
DWORD call8;
|
||||
} CallInviteCM_t;
|
||||
|
||||
typedef struct WxCalls {
|
||||
DWORD login; // 登录状态
|
||||
UserInfoCall_t ui; // 用户信息
|
||||
@ -154,6 +165,7 @@ typedef struct WxCalls {
|
||||
RevokeMsg_t rm; // 撤回消息
|
||||
CallRichText_t rt; // 发送消息卡片
|
||||
CallPatMsg_t pm; // 发送拍一拍消息
|
||||
CallInviteCM_t irm; // 邀请群成员
|
||||
} WxCalls_t;
|
||||
|
||||
struct WxString {
|
||||
|
@ -815,6 +815,23 @@ class Wcf():
|
||||
rsp = self._send_request(req)
|
||||
return rsp.status
|
||||
|
||||
def invite_chatroom_members(self, roomid: str, wxids: str) -> int:
|
||||
"""邀请群成员
|
||||
|
||||
Args:
|
||||
roomid (str): 群的 id
|
||||
wxids (str): 要邀请成员的 wxid, 多个用逗号`,`分隔
|
||||
|
||||
Returns:
|
||||
int: 1 为成功,其他失败
|
||||
"""
|
||||
req = wcf_pb2.Request()
|
||||
req.func = wcf_pb2.FUNC_INV_ROOM_MEMBERS # FUNC_INV_ROOM_MEMBERS
|
||||
req.m.roomid = roomid
|
||||
req.m.wxids = wxids.replace(" ", "")
|
||||
rsp = self._send_request(req)
|
||||
return rsp.status
|
||||
|
||||
def get_chatroom_members(self, roomid: str) -> Dict:
|
||||
"""获取群成员
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user