Skip to content

Commit 3db47a8

Browse files
committed
feat(message): impl send xml
1 parent 3e441fa commit 3db47a8

2 files changed

Lines changed: 22 additions & 25 deletions

File tree

WeChatFerry/spy/message_sender.cpp

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,30 +126,26 @@ void Sender::send_file(const std::string &wxid, const std::string &path)
126126

127127
void Sender::send_xml(const std::string &receiver, const std::string &xml, const std::string &path, uint64_t type)
128128
{
129-
#if 0
130-
std::unique_ptr<char[]> buff(new char[0x500]());
131-
std::unique_ptr<char[]> buff2(new char[0x500]());
132-
char nullBuf[0x1C] = { 0 };
133-
134-
func_new_chat_msg(reinterpret_cast<QWORD>(buff.get()));
135-
func_new_chat_msg(reinterpret_cast<QWORD>(buff2.get()));
136-
137-
QWORD sbuf[4] = { 0, 0, 0, 0 };
138-
QWORD sign = func_xml_buf_sign(reinterpret_cast<QWORD>(buff2.get()), reinterpret_cast<QWORD>(sbuf), 0x1);
139-
140-
auto wxReceiver = new_wx_string(receiver);
141-
auto wxXml = new_wx_string(xml);
142-
auto wxPath = new_wx_string(path);
143-
auto wxSender = new_wx_string(account::get_self_wxid());
144-
145-
func_send_xml(reinterpret_cast<QWORD>(buff.get()), reinterpret_cast<QWORD>(wxSender.get()),
146-
reinterpret_cast<QWORD>(wxReceiver.get()), reinterpret_cast<QWORD>(wxXml.get()),
147-
reinterpret_cast<QWORD>(wxPath.get()), reinterpret_cast<QWORD>(nullBuf), type, 0x4, sign,
148-
reinterpret_cast<QWORD>(buff2.get()));
149-
150-
func_free_chat_msg(reinterpret_cast<QWORD>(buff.get()));
151-
func_free_chat_msg(reinterpret_cast<QWORD>(buff2.get()));
152-
#endif
129+
char buff1[0x500] = { 0 };
130+
char buff2[0x500] = { 0 };
131+
char buff3[0x1C] = { 0 };
132+
133+
auto pBuff1 = func_new_chat_msg(reinterpret_cast<QWORD>(buff1));
134+
auto pBuff2 = func_new_chat_msg(reinterpret_cast<QWORD>(buff2));
135+
auto pBuff3 = reinterpret_cast<QWORD>(&buff3);
136+
137+
QWORD array[4] = { 0 };
138+
139+
auto sign = func_xml_buf_sign(pBuff2, reinterpret_cast<QWORD>(&array), 0x1);
140+
141+
util::WxStringHolder<std::string> to(receiver);
142+
util::WxStringHolder<std::string> body(xml);
143+
util::WxStringHolder<std::string> thumb(path);
144+
util::WxStringHolder<std::string> from(account::get_self_wxid());
145+
146+
func_send_xml(pBuff1, &from.wx, &to.wx, &body.wx, &thumb.wx, pBuff3, type, 0x4, sign, pBuff2);
147+
func_free_chat_msg(pBuff1);
148+
func_free_chat_msg(pBuff2);
153149
}
154150

155151
void Sender::send_emotion(const std::string &wxid, const std::string &path)

WeChatFerry/spy/message_sender.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class Sender
5656
using GetEmotionMgr_t = QWORD (*)();
5757
using SendEmotion_t = QWORD (*)(QWORD, WxString *, QWORD *, WxString *, QWORD, QWORD *, QWORD, QWORD *);
5858
using XmlBufSign_t = QWORD (*)(QWORD, QWORD, QWORD);
59-
using SendXml_t = QWORD (*)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD);
59+
using SendXml_t
60+
= QWORD (*)(QWORD, WxString *, WxString *, WxString *, WxString *, QWORD, QWORD, QWORD, QWORD, QWORD);
6061

6162
New_t func_new_chat_msg;
6263
Free_t func_free_chat_msg;

0 commit comments

Comments
 (0)