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