WeChatFerry/Spy/monitor.cpp

53 lines
1.2 KiB
C++
Raw Normal View History

2021-02-12 23:21:57 +08:00
#include <atlstr.h>
#include <stdio.h>
#include "load_calls.h"
#include "monitor.h"
#include "receive_msg.h"
#include "util.h"
HANDLE g_hEvent = NULL;
WxCalls_t g_WxCalls = { 0 };
DWORD g_WeChatWinDllAddr = 0;
int InitDLL(void)
{
wchar_t version[16] = { 0 };
g_WeChatWinDllAddr = (DWORD)LoadLibrary(L"WeChatWin.dll"); //获取wechatWin模块地址
if (g_WeChatWinDllAddr == 0) {
2022-08-06 16:49:37 +08:00
MessageBox(NULL, L"获取wechatWin.dll模块地址失败", L"错误", 0);
2021-02-12 23:21:57 +08:00
return -1;
}
if (!GetWeChatVersion(version)) { //获取微信版本
MessageBox(NULL, L"获取微信版本失败", L"错误", 0);
return -2;
}
if (LoadCalls(version, &g_WxCalls) != 0) { //加载微信版本对应的Call地址
MessageBox(NULL, L"不支持当前版本", L"错误", 0);
return -3;
}
g_hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
return 0;
}
DWORD WINAPI Monitor(HMODULE hModule)
{
2022-08-06 17:26:32 +08:00
ListenMessage();
2021-02-12 23:21:57 +08:00
return TRUE;
}
int IsLogin(void)
{
if (g_WeChatWinDllAddr == 0) {
return 0;
}
return (int)GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.login);
}