Impl AddChatrootMembers
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)_debug</TargetName>
|
||||
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
@@ -224,6 +225,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto
|
||||
<ClInclude Include="..\rpc\pb_util.h" />
|
||||
<ClInclude Include="..\rpc\proto\wcf.pb.h" />
|
||||
<ClInclude Include="accept_new_friend.h" />
|
||||
<ClInclude Include="add_chatroom_member.h" />
|
||||
<ClInclude Include="exec_sql.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="get_contacts.h" />
|
||||
@@ -243,6 +245,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto
|
||||
<ClCompile Include="..\rpc\pb_util.cpp" />
|
||||
<ClCompile Include="..\rpc\proto\wcf.pb.c" />
|
||||
<ClCompile Include="accept_new_friend.cpp" />
|
||||
<ClCompile Include="add_chatroom_member.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="exec_sql.cpp" />
|
||||
<ClCompile Include="get_contacts.cpp" />
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
<ClInclude Include="..\rpc\pb_types.h">
|
||||
<Filter>nnrpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="add_chatroom_member.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@@ -125,6 +128,9 @@
|
||||
<ClCompile Include="..\rpc\pb_util.cpp">
|
||||
<Filter>nnrpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="add_chatroom_member.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="spy.def">
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "framework.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "add_chatroom_member.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern DWORD g_WeChatWinDllAddr;
|
||||
|
||||
typedef struct MemberList {
|
||||
DWORD start;
|
||||
DWORD end1;
|
||||
DWORD end2;
|
||||
} MemberList_t;
|
||||
|
||||
int AddChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
int rv = 0;
|
||||
DWORD addRoomMemberCall1 = g_WeChatWinDllAddr + g_WxCalls.arm.call1;
|
||||
DWORD addRoomMemberCall2 = g_WeChatWinDllAddr + g_WxCalls.arm.call2;
|
||||
DWORD addRoomMemberCall3 = g_WeChatWinDllAddr + g_WxCalls.arm.call3;
|
||||
|
||||
TextStruct_t txtRoomid = { 0 };
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
txtRoomid.text = (wchar_t *)wsRoomid.c_str();
|
||||
txtRoomid.size = wsRoomid.size();
|
||||
txtRoomid.capacity = wsRoomid.capacity();
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<TextStruct_t> vTxtMembers;
|
||||
if (!wxids.empty()) {
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
TextStruct_t txtMember = { 0 };
|
||||
txtMember.text = (wchar_t *)vMembers.back().c_str();
|
||||
txtMember.size = vMembers.back().size();
|
||||
txtMember.capacity = vMembers.back().capacity();
|
||||
vTxtMembers.push_back(txtMember);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("Adding {} members[{}] to {}", vTxtMembers.size(), wxids.c_str(), roomid.c_str());
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call addRoomMemberCall1;
|
||||
sub esp, 0x14;
|
||||
mov esi, eax;
|
||||
mov ecx, esp;
|
||||
lea eax, txtRoomid;
|
||||
push eax;
|
||||
call addRoomMemberCall2;
|
||||
lea edi, vTxtMembers
|
||||
push edi;
|
||||
mov ecx, esi;
|
||||
call addRoomMemberCall3;
|
||||
mov rv, eax;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
int AddChatroomMember(std::string roomid, std::string wxids);
|
||||
+2
-1
@@ -19,7 +19,8 @@ WxCalls_t wxCalls = {
|
||||
/* Exec Sql:
|
||||
Exec, base, start, end, slot, name*/
|
||||
{ 0x141BDF0, 0x2366934, 0x1428, 0x142C, 0x3C, 0x50 },
|
||||
{ 0x771980, 0x2AE8D0, 0x1EE40E0 } // Accept New Friend application
|
||||
{ 0x771980, 0x2AE8D0, 0x1EE40E0 }, // Accept New Friend application
|
||||
{ 0xE29F0, 0x771980, 0x43D8D0 } // Add chatroom members
|
||||
};
|
||||
|
||||
int LoadCalls(const wchar_t *version, WxCalls_t *calls)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "wcf.pb.h"
|
||||
|
||||
#include "accept_new_friend.h"
|
||||
#include "add_chatroom_member.h"
|
||||
#include "exec_sql.h"
|
||||
#include "get_contacts.h"
|
||||
#include "log.h"
|
||||
@@ -383,6 +384,28 @@ bool func_accept_friend(char *v3, char *v4, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_add_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_ADD_ROOM_MEMBERS;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
rsp.msg.status = 0;
|
||||
|
||||
rsp.msg.status = AddChatroomMember(roomid, wxids);
|
||||
if (rsp.msg.status != 1) {
|
||||
LOG_ERROR("AddChatroomMember failed: {}", rsp.msg.status);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
|
||||
{
|
||||
bool ret = false;
|
||||
@@ -461,6 +484,11 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_accept_friend(req.msg.v.v3, req.msg.v.v4, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_ADD_ROOM_MEMBERS: {
|
||||
LOG_DEBUG("[Functions_FUNC_ADD_ROOM_MEMBERS]");
|
||||
ret = func_add_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_ERROR("[UNKNOW FUNCTION]");
|
||||
break;
|
||||
|
||||
+7
-1
@@ -53,6 +53,12 @@ typedef struct NewFriend {
|
||||
DWORD handle;
|
||||
} NewFriend_t;
|
||||
|
||||
typedef struct RoomMember {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} RoomMember_t;
|
||||
|
||||
typedef struct WxCalls {
|
||||
DWORD login; // 登录状态
|
||||
UserInfoCall_t ui; // 用户信息
|
||||
@@ -63,7 +69,7 @@ typedef struct WxCalls {
|
||||
Contact_t contact; // 获取联系人
|
||||
Sql_t sql; // 执行 SQL
|
||||
NewFriend_t anf; // 通过好友申请
|
||||
|
||||
RoomMember_t arm; // 添加群成员
|
||||
} WxCalls_t;
|
||||
|
||||
typedef struct TextStruct {
|
||||
|
||||
Reference in New Issue
Block a user