From bce8ec25aff3268bf1a0ded29a12728b1753165a Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Thu, 25 May 2023 10:09:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E6=96=B0=E5=A2=9E=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E7=99=BB=E5=BD=95=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/account_mgr.cc | 5 +++++ src/account_mgr.h | 3 +++ src/http_handler.cc | 2 +- src/wechat_function.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/account_mgr.cc b/src/account_mgr.cc index e8579ee..9ce293e 100644 --- a/src/account_mgr.cc +++ b/src/account_mgr.cc @@ -181,6 +181,11 @@ int AccountMgr::GetSelfInfo(SelfInfoInner &out) { return 1; } +string AccountMgr::GetLoginUrl() { + DWORD login_url_addr = base_addr_ + WX_LOGIN_URL_OFFSET; + return "http://weixin.qq.com/x/" + std::string(reinterpret_cast(*(DWORD*)login_url_addr)); +} + int AccountMgr::CheckLogin() { int success = -1; DWORD accout_service_addr = base_addr_ + WX_ACCOUNT_SERVICE_OFFSET; diff --git a/src/account_mgr.h b/src/account_mgr.h index 67da58d..339fbbd 100644 --- a/src/account_mgr.h +++ b/src/account_mgr.h @@ -8,6 +8,9 @@ namespace wxhelper{ public: explicit AccountMgr(DWORD base); ~AccountMgr(); + + std::string GetLoginUrl(); + int GetSelfInfo(SelfInfoInner& out); int CheckLogin(); diff --git a/src/http_handler.cc b/src/http_handler.cc index acd1f5a..4623721 100644 --- a/src/http_handler.cc +++ b/src/http_handler.cc @@ -94,7 +94,7 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) { case WECHAT_IS_LOGIN: { int success = -1; success = g_context.account_mgr->CheckLogin(); - json ret_data = {{"result", "OK"}, {"code", success}}; + json ret_data = {{"result", "OK"}, {"code", success}, {"login_url", g_context.account_mgr->GetLoginUrl()}}; ret = ret_data.dump(); break; } diff --git a/src/wechat_function.h b/src/wechat_function.h index a8719eb..48d5d20 100644 --- a/src/wechat_function.h +++ b/src/wechat_function.h @@ -116,6 +116,7 @@ //login +#define WX_LOGIN_URL_OFFSET 0x3040DE8 #define WX_LOGOUT_OFFSET 0xe58870 #define WX_ACCOUNT_SERVICE_OFFSET 0x768c80 #define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xf3a610