fix: 通过好友验证需要指定权限 close #105

This commit is contained in:
hugy 2023-05-05 09:39:20 +08:00
parent c0b55da015
commit 8fa942c741
4 changed files with 7 additions and 5 deletions

View File

@ -5,7 +5,7 @@ project(wxhelper VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True) 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) file(GLOB CPP_FILES ${PROJECT_SOURCE_DIR}/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.cpp)

View File

@ -175,7 +175,7 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
return success; 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; int success = -1;
DWORD set_value_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET; DWORD set_value_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET;
DWORD verify_addr = base_addr_ + WX_VERIFY_OK_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); WeChatString v3_str(v3);
char helper_obj[0x40] = {0}; char helper_obj[0x40] = {0};
char nullbuffer[0x3CC] = {0}; char nullbuffer[0x3CC] = {0};
int flag = permission < 0 ? 0:permission;
__asm { __asm {
PUSHAD PUSHAD
PUSHFD PUSHFD
LEA ECX,helper_obj LEA ECX,helper_obj
CALL new_helper_addr CALL new_helper_addr
MOV ESI,0x0 MOV ESI,flag
MOV EDI,0x6 MOV EDI,0x6
PUSH ESI PUSH ESI
PUSH EDI PUSH EDI

View File

@ -14,7 +14,7 @@ class ContactMgr : public BaseMgr {
int DelContact(wchar_t* wxid); int DelContact(wchar_t* wxid);
std::wstring GetContactOrChatRoomNickname(wchar_t* id); std::wstring GetContactOrChatRoomNickname(wchar_t* id);
int AddFriendByWxid(wchar_t* wxid,wchar_t* msg); 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 } // namespace wxhelper

View File

@ -252,7 +252,8 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
case WECHAT_CONTACT_VERIFY_APPLY: { case WECHAT_CONTACT_VERIFY_APPLY: {
wstring v3 = GetWStringParam(j_param, "v3"); wstring v3 = GetWStringParam(j_param, "v3");
wstring v4 = GetWStringParam(j_param, "v4"); 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"}}; json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump(); ret = ret_data.dump();
break; break;