From d22aa9de2df35049714dba7ed62cdf070f4e62dd Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Sat, 3 Jun 2023 17:06:48 +0800 Subject: [PATCH] fix: sendAppMsg update free addr --- src/send_message_mgr.cc | 27 ++++++++++++++++++--------- src/wechat_function.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/send_message_mgr.cc b/src/send_message_mgr.cc index 74f9a1b..12f417c 100644 --- a/src/send_message_mgr.cc +++ b/src/send_message_mgr.cc @@ -391,11 +391,16 @@ int SendMessageMgr::SendAppletMsg(wchar_t* wxid, wchar_t* appletid){ receiver_list.push_back(wwxid); VectorInner* list = (VectorInner*)&receiver_list; DWORD receiver_list_ptr = (DWORD)&list->start; - + WeChatString wapplet(appletid); - char req[0x268]={0}; + char req[0x268] = {0}; char temp[0x4] = {0}; - char buff[0x88]={0}; + char buff[0x88] = {0}; + DWORD flag = 0xF; + DWORD zero = 0; + WeChatStr clean; + WeChatStr app_id(c_applet_id); + __asm{ PUSHAD PUSHFD @@ -406,7 +411,8 @@ int SendMessageMgr::SendAppletMsg(wchar_t* wxid, wchar_t* appletid){ } // 0x40 gh // 0xE8 img - memcpy(&req[0x4], &c_applet_id, sizeof(c_applet_id)); + memcpy(&req[0x4], &app_id, sizeof(app_id)); + __asm{ PUSHAD PUSHFD @@ -442,15 +448,18 @@ int SendMessageMgr::SendAppletMsg(wchar_t* wxid, wchar_t* appletid){ POPAD } - __asm{ +// no need for WeChat to release memory +memcpy(&req[0x4], &clean, sizeof(clean)); +memcpy(&req[0xC8], &zero, sizeof(zero)); +memcpy(&req[0xCC], &flag, sizeof(flag)); +__asm { PUSHAD PUSHFD LEA ECX,req - PUSH 0x0 CALL free_share_app_msg_req_addr POPFD POPAD - } - return success; } -} // namespace wxhelper \ No newline at end of file +return success; +} +} // namespace wxhelperg \ No newline at end of file diff --git a/src/wechat_function.h b/src/wechat_function.h index b8751d3..5d88a93 100644 --- a/src/wechat_function.h +++ b/src/wechat_function.h @@ -200,7 +200,8 @@ // send app msg #define NEW_SHARE_APP_MSG_REQ_OFFSET 0xfbae50 -#define FREE_SHARE_APP_MSG_REQ_OFFSET 0xfbc0d0 +// #define FREE_SHARE_APP_MSG_REQ_OFFSET 0xfbc0d0 +#define FREE_SHARE_APP_MSG_REQ_OFFSET 0xfbc100 #define NEW_WA_UPDATABLE_MSG_INFO_OFFSET 0x7b3d30 #define FREE_WA_UPDATABLE_MSG_INFO_OFFSET 0x79d4c0 #define SEND_APP_MSG_OFFSET 0xfe8e40 @@ -808,4 +809,30 @@ struct ContactProfile{ std::wstring nickname; std::wstring head_image; }; + +struct WeChatStr{ + char * ptr; + DWORD field1; + DWORD field2; + DWORD field3; + DWORD len; + DWORD maxlen; + + WeChatStr(const char* p) { + ptr = (char *)p; + field1 = 0; + field2 = 0; + field3 = 0; + len = strlen(p); + maxlen = len | 0xF; + } + WeChatStr() { + ptr = NULL; + field1 = 0; + field2 = 0; + field3 = 0; + len = 0; + maxlen = 0xF; + } +}; #endif \ No newline at end of file