Impl add chatroom member

This commit is contained in:
Changhua 2024-06-26 22:37:52 +08:00
parent 1724009d5b
commit 02030a4af0
2 changed files with 24 additions and 38 deletions

View File

@ -10,23 +10,22 @@
using namespace std; using namespace std;
extern WxCalls_t g_WxCalls; extern WxCalls_t g_WxCalls;
extern UINT64 g_WeChatWinDllAddr; extern QWORD g_WeChatWinDllAddr;
#if 0
typedef QWORD (*funcGetChatRoomMgr_t)();
typedef QWORD (*funcAddMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD);
int AddChatroomMember(string roomid, string wxids) int AddChatroomMember(string roomid, string wxids)
{ {
int status = -1;
if (roomid.empty() || wxids.empty()) { if (roomid.empty() || wxids.empty()) {
LOG_ERROR("Empty roomid or wxids."); LOG_ERROR("Empty roomid or wxids.");
return -1; return status;
} }
int rv = 0; funcGetChatRoomMgr_t funcGetChatRoomMgr = (funcGetChatRoomMgr_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call1);
DWORD armCall1 = g_WeChatWinDllAddr + g_WxCalls.arm.call1; funcAddMemberToChatRoom_t funcAddMemberToChatRoom = (funcAddMemberToChatRoom_t)(g_WeChatWinDllAddr + g_WxCalls.arm.call2);
DWORD armCall2 = g_WeChatWinDllAddr + g_WxCalls.arm.call2;
DWORD armCall3 = g_WeChatWinDllAddr + g_WxCalls.arm.call3;
DWORD temp = 0;
wstring wsRoomid = String2Wstring(roomid);
WxString wxRoomid(wsRoomid);
vector<wstring> vMembers; vector<wstring> vMembers;
vector<WxString> vWxMembers; vector<WxString> vWxMembers;
@ -35,37 +34,20 @@ int AddChatroomMember(string roomid, string wxids)
wstring wstr; wstring wstr;
getline(wss, wstr, L','); getline(wss, wstr, L',');
vMembers.push_back(wstr); vMembers.push_back(wstr);
WxString txtMember(vMembers.back()); WxString wxMember(vMembers.back());
vWxMembers.push_back(txtMember); vWxMembers.push_back(wxMember);
} }
LOG_DEBUG("Adding {} members[{}] to {}", vWxMembers.size(), wxids.c_str(), roomid.c_str()); QWORD temp[2] = { 0 };
__asm { WxString *pWxRoomid = NewWxStringFromStr(roomid);
pushad; QWORD pMembers = (QWORD) & ((RawVector_t *)&vWxMembers)->start;
pushfd;
call armCall1; QWORD mgr = funcGetChatRoomMgr();
sub esp, 0x8; status = (int)funcAddMemberToChatRoom(mgr, pMembers, (QWORD)pWxRoomid, (QWORD)temp);
mov temp, eax; return status;
mov ecx, esp;
mov dword ptr[ecx], 0x0;
mov dword ptr[ecx + 4], 0x0;
test esi, esi;
sub esp, 0x14;
mov ecx, esp;
lea eax, wxRoomid;
push eax;
call armCall2;
mov ecx, temp;
lea eax, vWxMembers;
push eax;
call armCall3;
mov rv, eax;
popfd;
popad;
}
return rv;
} }
#if 0
int DelChatroomMember(string roomid, string wxids) int DelChatroomMember(string roomid, string wxids)
{ {
if (roomid.empty() || wxids.empty()) { if (roomid.empty() || wxids.empty()) {

View File

@ -768,6 +768,7 @@ bool func_exec_ocr(char *path, uint8_t *out, size_t *len)
*len = stream.bytes_written; *len = stream.bytes_written;
return true; return true;
} }
#endif
bool func_add_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len) bool func_add_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
{ {
@ -793,6 +794,7 @@ bool func_add_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
return true; return true;
} }
#if 0
bool func_del_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len) bool func_del_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
{ {
Response rsp = Response_init_default; Response rsp = Response_init_default;
@ -973,10 +975,12 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
ret = func_exec_ocr(req.msg.str, out, out_len); ret = func_exec_ocr(req.msg.str, out, out_len);
break; break;
} }
#endif
case Functions_FUNC_ADD_ROOM_MEMBERS: { case Functions_FUNC_ADD_ROOM_MEMBERS: {
ret = func_add_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len); ret = func_add_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
break; break;
} }
#if 0
case Functions_FUNC_DEL_ROOM_MEMBERS: { case Functions_FUNC_DEL_ROOM_MEMBERS: {
ret = func_del_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len); ret = func_del_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
break; break;