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;