From 8fa942c74157e6a6ff997e725317b2d343d0e0fc Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Fri, 5 May 2023 09:39:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=9A=E8=BF=87=E5=A5=BD=E5=8F=8B?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E9=9C=80=E8=A6=81=E6=8C=87=E5=AE=9A=E6=9D=83?= =?UTF-8?q?=E9=99=90=20=20close=20#105?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- src/contact_mgr.cc | 5 +++-- src/contact_mgr.h | 2 +- src/http_handler.cc | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aebd708..291162b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(wxhelper VERSION 1.0.0) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D '_UNICODE' /D 'UNICODE'") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D '_UNICODE' /D 'UNICODE' /D 'ELPP_THREAD_SAFE'") file(GLOB CPP_FILES ${PROJECT_SOURCE_DIR}/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.cpp) diff --git a/src/contact_mgr.cc b/src/contact_mgr.cc index 9525e41..e0bd40b 100644 --- a/src/contact_mgr.cc +++ b/src/contact_mgr.cc @@ -175,7 +175,7 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) { return success; } - int ContactMgr::VerifyApply(wchar_t *v3, wchar_t *v4){ + int ContactMgr::VerifyApply(wchar_t *v3, wchar_t *v4,int permission){ int success = -1; DWORD set_value_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET; DWORD verify_addr = base_addr_ + WX_VERIFY_OK_OFFSET; @@ -186,12 +186,13 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) { WeChatString v3_str(v3); char helper_obj[0x40] = {0}; char nullbuffer[0x3CC] = {0}; + int flag = permission < 0 ? 0:permission; __asm { PUSHAD PUSHFD LEA ECX,helper_obj CALL new_helper_addr - MOV ESI,0x0 + MOV ESI,flag MOV EDI,0x6 PUSH ESI PUSH EDI diff --git a/src/contact_mgr.h b/src/contact_mgr.h index 677d564..24de50b 100644 --- a/src/contact_mgr.h +++ b/src/contact_mgr.h @@ -14,7 +14,7 @@ class ContactMgr : public BaseMgr { int DelContact(wchar_t* wxid); std::wstring GetContactOrChatRoomNickname(wchar_t* id); int AddFriendByWxid(wchar_t* wxid,wchar_t* msg); - int VerifyApply(wchar_t *v3, wchar_t *v4); + int VerifyApply(wchar_t *v3, wchar_t *v4,int permission); }; } // namespace wxhelper diff --git a/src/http_handler.cc b/src/http_handler.cc index 8450ca6..acd1f5a 100644 --- a/src/http_handler.cc +++ b/src/http_handler.cc @@ -252,7 +252,8 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) { case WECHAT_CONTACT_VERIFY_APPLY: { wstring v3 = GetWStringParam(j_param, "v3"); wstring v4 = GetWStringParam(j_param, "v4"); - int success = g_context.contact_mgr->VerifyApply(WS2LPWS(v3),WS2LPWS(v4)); + int permission = GetIntParam(j_param, "permission"); + int success = g_context.contact_mgr->VerifyApply(WS2LPWS(v3),WS2LPWS(v4),permission); json ret_data = {{"code", success}, {"result", "OK"}}; ret = ret_data.dump(); break;