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