Refatoring
This commit is contained in:
parent
e012efc682
commit
1cbd3a3ebe
@ -18,8 +18,8 @@
|
||||
namespace util
|
||||
{
|
||||
|
||||
constexpr std::wstring_view WECHATEXE = L"WeChat.exe";
|
||||
constexpr std::string_view WECHATWINDLL = "WeChatWin.dll";
|
||||
constexpr char WECHATEXE[] = "WeChat.exe";
|
||||
constexpr char WECHATWINDLL[] = "WeChatWin.dll";
|
||||
|
||||
std::wstring s2w(const std::string &s)
|
||||
{
|
||||
@ -63,7 +63,7 @@ static DWORD get_wechat_pid()
|
||||
|
||||
PROCESSENTRY32 pe32 = { sizeof(PROCESSENTRY32) };
|
||||
while (Process32Next(hSnapshot, &pe32)) {
|
||||
if (pe32.szExeFile == WECHATEXE) {
|
||||
if (pe32.szExeFile == s2w(WECHATEXE)) {
|
||||
pid = pe32.th32ProcessID;
|
||||
break;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ struct PortPath {
|
||||
};
|
||||
|
||||
DWORD get_wechat_pid();
|
||||
int open_wechat(DWORD *pid);
|
||||
int open_wechat(DWORD &pid);
|
||||
std::string get_wechat_version();
|
||||
uint32_t get_memory_int_by_address(HANDLE hProcess, uint64_t addr);
|
||||
std::wstring get_unicode_info_by_address(HANDLE hProcess, uint64_t addr);
|
||||
|
@ -19,9 +19,10 @@ static HANDLE wcProcess = NULL;
|
||||
static HMODULE spyBase = NULL;
|
||||
static std::string spyDllPath;
|
||||
|
||||
constexpr std::string_view WCFSDKDLL = "sdk.dll";
|
||||
constexpr std::string_view WCFSPYDLL = "spy.dll";
|
||||
constexpr std::string_view WCFSPYDLL_DEBUG = "spy_debug.dll";
|
||||
constexpr char WCFSDKDLL[] = "sdk.dll";
|
||||
constexpr char WCFSPYDLL[] = "spy.dll";
|
||||
constexpr char WCFSPYDLL_DEBUG[] = "spy_debug.dll";
|
||||
|
||||
constexpr std::string_view DISCLAIMER_FLAG = ".license_accepted.flag";
|
||||
constexpr std::string_view DISCLAIMER_TEXT_FILE = "DISCLAIMER.md";
|
||||
|
||||
@ -95,7 +96,7 @@ int WxInitSDK(bool debug, int port)
|
||||
return ERROR_FILE_NOT_FOUND; // DLL 文件路径不存在
|
||||
}
|
||||
|
||||
status = util::open_wechat(&wcPid);
|
||||
status = util::open_wechat(wcPid);
|
||||
if (status != 0) {
|
||||
MessageBoxA(NULL, "打开微信失败", "WxInitSDK", 0);
|
||||
return status;
|
||||
@ -112,7 +113,7 @@ int WxInitSDK(bool debug, int port)
|
||||
pp.port = port;
|
||||
snprintf(pp.path, MAX_PATH, "%s", std::filesystem::current_path().string().c_str());
|
||||
|
||||
if (!call_dll_func_ex(wcProcess, spyDllPath, spyBase, "InitSpy", (LPVOID)&pp, sizeof(PortPath_t), NULL)) {
|
||||
if (!call_dll_func_ex(wcProcess, spyDllPath, spyBase, "InitSpy", (LPVOID)&pp, sizeof(util::PortPath), NULL)) {
|
||||
MessageBoxA(NULL, "初始化失败", "WxInitSDK", 0);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user