From 2f1793b2b1673400c8abf7635990a33d7b4ffa99 Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Wed, 1 Feb 2023 11:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E4=B8=80=E6=8B=8D=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pat.cc | 34 ++++++++++++++++++++++++++++++++++ src/pat.h | 4 ++++ 2 files changed, 38 insertions(+) create mode 100644 src/pat.cc create mode 100644 src/pat.h diff --git a/src/pat.cc b/src/pat.cc new file mode 100644 index 0000000..551927c --- /dev/null +++ b/src/pat.cc @@ -0,0 +1,34 @@ +#include "pch.h" +#include "pat.h" + +#include "common.h" +#include "wechat_data.h" + +#define WX_PAT_MGR_OFFSET 0x7e91c0 +#define WX_SEND_PAT_MSG_OFFSET 0x1228510 +#define WX_RET_OFFSET 0x1AE4A45 + +int SendPatMsg(wchar_t* chat_room_id, wchar_t* wxid) { + int success = -1; + WeChatString chat_room(chat_room_id); + WeChatString self_wxid(wxid); + DWORD base = GetWeChatWinBase(); + DWORD get_pat_mgr_addr = base + WX_PAT_MGR_OFFSET; + DWORD send_pat_msg_addr = base + WX_SEND_PAT_MSG_OFFSET; + DWORD ret_addr = base + WX_RET_OFFSET; + __asm { + PUSHAD + CALL get_pat_mgr_addr + PUSH ret_addr + PUSH 0x0 + PUSH EAX + LEA ECX,chat_room + LEA EDX,self_wxid + CALL send_pat_msg_addr + ADD ESP,0xc + MOVZX EAX,AL + MOV success,EAX + POPAD + } + return success; +} \ No newline at end of file diff --git a/src/pat.h b/src/pat.h new file mode 100644 index 0000000..7893f9e --- /dev/null +++ b/src/pat.h @@ -0,0 +1,4 @@ +#ifndef PAT_H_ +#define PAT_H_ +int SendPatMsg(wchar_t* chat_room_id,wchar_t* wxid); +#endif \ No newline at end of file