Impl GetContactByWxid
This commit is contained in:
@@ -24,6 +24,7 @@ enum Functions {
|
||||
FUNC_RECV_TRANSFER = 0x52;
|
||||
FUNC_REFRESH_PYQ = 0x53;
|
||||
FUNC_DOWNLOAD_ATTACH = 0x54;
|
||||
FUNC_GET_CONTACT_INFO = 0x55;
|
||||
FUNC_DECRYPT_IMAGE = 0x60;
|
||||
FUNC_ADD_ROOM_MEMBERS = 0x70;
|
||||
FUNC_DEL_ROOM_MEMBERS = 0x71;
|
||||
|
||||
@@ -141,3 +141,45 @@ int AcceptNewFriend(string v3, string v4, int scene)
|
||||
|
||||
return success; // 成功返回 1
|
||||
}
|
||||
|
||||
/*没啥用,非好友获取不到*/
|
||||
RpcContact_t GetContactByWxid(string wxid)
|
||||
{
|
||||
RpcContact_t contact;
|
||||
char buff[0x440] = { 0 };
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
WxString pri(wsWxid);
|
||||
DWORD contact_mgr_addr = g_WeChatWinDllAddr + 0x75A4A0;
|
||||
DWORD get_contact_addr = g_WeChatWinDllAddr + 0xC04E00;
|
||||
DWORD free_contact_addr = g_WeChatWinDllAddr + 0xEA7880;
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
CALL contact_mgr_addr
|
||||
LEA ECX,buff
|
||||
PUSH ECX
|
||||
LEA ECX,pri
|
||||
PUSH ECX
|
||||
MOV ECX,EAX
|
||||
CALL get_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
|
||||
contact.wxid = wxid;
|
||||
contact.code = GetStringByWstrAddr((DWORD)buff + g_WxCalls.contact.wxCode);
|
||||
contact.remark = GetStringByWstrAddr((DWORD)buff + g_WxCalls.contact.wxRemark);
|
||||
contact.name = GetStringByWstrAddr((DWORD)buff + g_WxCalls.contact.wxName);
|
||||
contact.gender = GET_DWORD((DWORD)buff + 0x148);
|
||||
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,buff
|
||||
CALL free_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
|
||||
return contact;
|
||||
}
|
||||
|
||||
@@ -7,3 +7,5 @@
|
||||
|
||||
vector<RpcContact_t> GetContacts();
|
||||
int AcceptNewFriend(std::string v3, std::string v4, int scene);
|
||||
int AddFriendByWxid(std::string wxid, std::string msg);
|
||||
RpcContact_t GetContactByWxid(std::string wxid);
|
||||
|
||||
@@ -534,6 +534,29 @@ bool func_download_attach(AttachMsg att, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_get_contact_info(string wxid, uint8_t *out, size_t *len)
|
||||
{
|
||||
/*借用 Functions_FUNC_GET_CONTACTS */
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_GET_CONTACT_INFO;
|
||||
rsp.which_msg = Response_contacts_tag;
|
||||
|
||||
vector<RpcContact_t> contacts;
|
||||
contacts.push_back(GetContactByWxid(wxid));
|
||||
|
||||
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
|
||||
rsp.msg.contacts.contacts.arg = &contacts;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool func_decrypt_image(char *src, char *dst, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@@ -711,6 +734,11 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_download_attach(req.msg.att, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_GET_CONTACT_INFO: {
|
||||
LOG_DEBUG("[Functions_FUNC_GET_CONTACT_INFO]");
|
||||
ret = func_get_contact_info(req.msg.str, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_DECRYPT_IMAGE: {
|
||||
LOG_DEBUG("[FUNCTIONS_FUNC_DECRYPT_IMAGE]");
|
||||
ret = func_decrypt_image(req.msg.dec.src, req.msg.dec.dst, out, out_len);
|
||||
|
||||
Reference in New Issue
Block a user