From 7e89c6ef2d0091193902645818d4f494ce950f3a Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Wed, 1 Mar 2023 17:02:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/self_info.cc | 106 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 31 deletions(-) diff --git a/src/self_info.cc b/src/self_info.cc index 8980a83..3dd47bf 100644 --- a/src/self_info.cc +++ b/src/self_info.cc @@ -20,10 +20,10 @@ using namespace std; #define WX_APP_DATA_SAVE_PATH_OFFSET 0x2E52DB0 #define WX_CURRENT_DATA_PATH_OFFSET 0x2E4F290 -#define WX_LOGOUT_OFFSET 0xdd5c90 +#define WX_LOGOUT_OFFSET 0xdd5c90 #define WX_ACCOUNT_SERVICE_OFFSET 0x707960 #define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xeb4b00 -#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc11140 +#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc11140 int GetSelfInfo(SelfInfoInner &out) { DWORD base = GetWeChatWinBase(); DWORD accout_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET; @@ -41,72 +41,117 @@ int GetSelfInfo(SelfInfoInner &out) { *(DWORD *)(service_addr + 0x44 + 0x10) == 0) { out.wxid = string(); } else { - out.wxid = string(*(char **)(service_addr + 0x44), - *(DWORD *)(service_addr + 0x44 + 0x10)); + if (*(DWORD *)(service_addr + 0x44 + 0x14) == 0xF) { + out.wxid = string((char *)(service_addr + 0x44), + *(DWORD *)(service_addr + 0x44 + 0x10)); + } else { + out.wxid = string(*(char **)(service_addr + 0x44), + *(DWORD *)(service_addr + 0x44 + 0x10)); + } } if (*(DWORD *)(service_addr + 0xA8) == 0 || *(DWORD *)(service_addr + 0xA8 + 0x10) == 0) { out.account = string(); } else { - out.account = string(*(char **)(service_addr + 0xA8), - *(DWORD *)(service_addr + 0xA8 + 0x10)); + if (*(DWORD *)(service_addr + 0xA8 + 0x14) == 0xF) { + out.account = string((char *)(service_addr + 0xA8), + *(DWORD *)(service_addr + 0xA8 + 0x10)); + } else { + out.account = string(*(char **)(service_addr + 0xA8), + *(DWORD *)(service_addr + 0xA8 + 0x10)); + } } if (*(DWORD *)(service_addr + 0xC0) == 0 || *(DWORD *)(service_addr + 0xC0 + 0x10) == 0) { out.mobile = string(); } else { - out.mobile = string((char *)(service_addr + 0xC0), - *(DWORD *)(service_addr + 0xC0 + 0x10)); + if (*(DWORD *)(service_addr + 0xC0 + 0x14) == 0xF) { + out.mobile = string((char *)(service_addr + 0xC0), + *(DWORD *)(service_addr + 0xC0 + 0x10)); + } else { + out.mobile = string(*(char **)(service_addr + 0xC0), + *(DWORD *)(service_addr + 0xC0 + 0x10)); + } } if (*(DWORD *)(service_addr + 0xD8) == 0 || *(DWORD *)(service_addr + 0xD8 + 0x10) == 0) { out.signature = string(); } else { - out.signature = string((char *)(service_addr + 0xD8), - *(DWORD *)(service_addr + 0xD8 + 0x10)); + if (*(DWORD *)(service_addr + 0xD8 + 0x14) == 0xF) { + out.signature = string((char *)(service_addr + 0xD8), + *(DWORD *)(service_addr + 0xD8 + 0x10)); + } else { + out.signature = string(*(char **)(service_addr + 0xD8), + *(DWORD *)(service_addr + 0xD8 + 0x10)); + } } if (*(DWORD *)(service_addr + 0xF0) == 0 || *(DWORD *)(service_addr + 0xF0 + 0x10) == 0) { out.country = string(); } else { - out.country = string((char *)(service_addr + 0xF0), - *(DWORD *)(service_addr + 0xF0 + 0x10)); + if (*(DWORD *)(service_addr + 0xF0 + 0x14) == 0xF) { + out.country = string((char *)(service_addr + 0xF0), + *(DWORD *)(service_addr + 0xF0 + 0x10)); + } else { + out.country = string(*(char **)(service_addr + 0xF0), + *(DWORD *)(service_addr + 0xF0 + 0x10)); + } } if (*(DWORD *)(service_addr + 0x108) == 0 || *(DWORD *)(service_addr + 0x108 + 0x10) == 0) { out.province = string(); } else { - out.province = string((char *)(service_addr + 0x108), - *(DWORD *)(service_addr + 0x108 + 0x10)); + if (*(DWORD *)(service_addr + 0x108 + 0x14) == 0xF) { + out.province = string((char *)(service_addr + 0x108), + *(DWORD *)(service_addr + 0x108 + 0x10)); + } else { + out.province = string(*(char **)(service_addr + 0x108), + *(DWORD *)(service_addr + 0x108 + 0x10)); + } } if (*(DWORD *)(service_addr + 0x120) == 0 || *(DWORD *)(service_addr + 0x120 + 0x10) == 0) { out.city = string(); } else { - out.city = string((char *)(service_addr + 0x120), - *(DWORD *)(service_addr + 0x120 + 0x10)); + if (*(DWORD *)(service_addr + 0x120 + 0x14) == 0xF) { + out.city = string((char *)(service_addr + 0x120), + *(DWORD *)(service_addr + 0x120 + 0x10)); + } else { + out.city = string(*(char **)(service_addr + 0x120), + *(DWORD *)(service_addr + 0x120 + 0x10)); + } } if (*(DWORD *)(service_addr + 0x150) == 0 || *(DWORD *)(service_addr + 0x150 + 0x10) == 0) { out.name = string(); } else { - out.name = string((char *)(service_addr + 0x150), - *(DWORD *)(service_addr + 0x150 + 0x10)); + if (*(DWORD *)(service_addr + 0x150 + 0x14) == 0xF) { + out.name = string((char *)(service_addr + 0x150), + *(DWORD *)(service_addr + 0x150 + 0x10)); + } else { + out.name = string(*(char **)(service_addr + 0x150), + *(DWORD *)(service_addr + 0x150 + 0x10)); + } } if (*(DWORD *)(service_addr + 0x304) == 0 || *(DWORD *)(service_addr + 0x304 + 0x10) == 0) { out.head_img = string(); } else { - out.head_img = string(*(char **)(service_addr + 0x304), - *(DWORD *)(service_addr + 0x304 + 0x10)); + if (*(DWORD *)(service_addr + 0x304 + 0x14) == 0xF) { + out.head_img = string((char *)(service_addr + 0x304), + *(DWORD *)(service_addr + 0x304 + 0x10)); + } else { + out.head_img = string(*(char **)(service_addr + 0x304), + *(DWORD *)(service_addr + 0x304 + 0x10)); + } } } @@ -125,21 +170,21 @@ int GetSelfInfo(SelfInfoInner &out) { if (data_save_path.ptr) { out.data_save_path = Wstring2String(wstring(data_save_path.ptr, data_save_path.length)); - }else { + } + else { out.data_save_path = string(); } - if (current_data_path.ptr) { - out.current_data_path = - Wstring2String(wstring(current_data_path.ptr, current_data_path.length)); - }else { + if (current_data_path.ptr) { + out.current_data_path = Wstring2String( + wstring(current_data_path.ptr, current_data_path.length)); + } else { out.current_data_path = string(); } return 1; } - -int CheckLogin(){ +int CheckLogin() { DWORD base = GetWeChatWinBase(); DWORD accout_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET; DWORD service_addr = NULL; @@ -157,16 +202,15 @@ int CheckLogin(){ } } - -int Logout(){ +int Logout() { int success = 0; - if(!CheckLogin()){ + if (!CheckLogin()) { return success; } DWORD base = GetWeChatWinBase(); DWORD account_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET; DWORD logout_addr = base + WX_LOGOUT_OFFSET; - __asm{ + __asm { PUSHAD CALL account_service_addr PUSH 0x0