拍一拍实现

This commit is contained in:
hugy 2023-02-01 11:57:32 +08:00
parent 6b36287c4d
commit 2f1793b2b1
2 changed files with 38 additions and 0 deletions

34
src/pat.cc Normal file
View File

@ -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;
}

4
src/pat.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef PAT_H_
#define PAT_H_
int SendPatMsg(wchar_t* chat_room_id,wchar_t* wxid);
#endif