WeChatFerry/WeChatFerry/com/util.h

38 lines
1.3 KiB
C
Raw Normal View History

2022-10-15 20:25:42 +08:00
#pragma once
#include <string>
2024-06-22 22:57:30 +08:00
#include <minwindef.h>
2022-10-15 20:25:42 +08:00
2024-04-17 00:35:43 +08:00
#define WECHAREXE L"WeChat.exe"
#define WECHATWINDLL L"WeChatWin.dll"
#define WCFSDKDLL L"sdk.dll"
#define WCFSPYDLL L"spy.dll"
#define WCFSPYDLL_DEBUG L"spy_debug.dll"
2022-10-15 20:25:42 +08:00
2024-04-28 09:16:09 +08:00
#define GET_UINT64(addr) ((UINT64) * (UINT64 *)(addr))
2024-06-03 23:06:02 +08:00
#define GET_DWORD(addr) ((DWORD) * (UINT64 *)(addr))
2024-04-28 09:16:09 +08:00
#define GET_QWORD(addr) ((UINT64) * (UINT64 *)(addr))
#define GET_STRING(addr) ((CHAR *)(*(UINT64 *)(addr)))
#define GET_WSTRING(addr) ((WCHAR *)(*(UINT64 *)(addr)))
2023-05-25 00:18:10 +08:00
#define GET_STRING_FROM_P(addr) ((CHAR *)(addr))
#define GET_WSTRING_FROM_P(addr) ((WCHAR *)(addr))
2022-10-15 20:25:42 +08:00
2023-05-21 20:29:21 +08:00
typedef struct PortPath {
int port;
char path[MAX_PATH];
} PortPath_t;
2024-05-02 16:05:58 +08:00
DWORD GetWeChatPid();
int OpenWeChat(DWORD *pid);
2022-10-15 20:25:42 +08:00
int GetWeChatVersion(wchar_t *version);
2024-04-28 09:16:09 +08:00
size_t GetWstringByAddress(UINT64 address, wchar_t *buffer, UINT64 buffer_size);
UINT32 GetMemoryIntByAddress(HANDLE hProcess, UINT64 address);
std::wstring GetUnicodeInfoByAddress(HANDLE hProcess, UINT64 address);
2022-10-15 20:25:42 +08:00
std::wstring String2Wstring(std::string s);
std::string Wstring2String(std::wstring ws);
2023-11-22 22:35:00 +08:00
std::string GB2312ToUtf8(const char *gb2312);
2024-04-28 09:16:09 +08:00
std::string GetStringByAddress(UINT64 address);
std::string GetStringByStrAddr(UINT64 addr);
std::string GetStringByWstrAddr(UINT64 addr);
2023-05-25 00:18:10 +08:00
void DbgMsg(const char *zcFormat, ...);