提交 4f05a57a 编写于 作者: L ljc545w

优化部分功能

上级 885064f6
......@@ -5,9 +5,10 @@ struct SendArticleStruct {
DWORD title;
DWORD abstract;
DWORD url;
DWORD imgpath;
};
BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url) {
BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url, wchar_t* imgpath) {
if (!hProcess)
return 1;
DWORD WeChatRobotBase = GetWeChatRobotBase();
......@@ -20,8 +21,9 @@ BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url)
LPVOID titleaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID abstractaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID urladdr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID imgaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
SendArticleStruct* paramAndFunc = (SendArticleStruct*)::VirtualAllocEx(hProcess, 0, sizeof(SendArticleStruct), MEM_COMMIT, PAGE_READWRITE);
if (!wxidaddr || !titleaddr || !abstractaddr || !urladdr ||
if (!wxidaddr || !titleaddr || !abstractaddr || !urladdr || !imgaddr ||
!paramAndFunc || !WeChatRobotBase)
{
return 1;
......@@ -35,10 +37,13 @@ BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url)
WriteProcessMemory(hProcess, abstractaddr, abstract, wcslen(abstract) * 2 + 2, &dwWriteSize);
if (urladdr)
WriteProcessMemory(hProcess, urladdr, url, wcslen(url) * 2 + 2, &dwWriteSize);
if (imgpath && imgaddr)
WriteProcessMemory(hProcess, imgaddr, imgpath, wcslen(imgpath) * 2 + 2, &dwWriteSize);
params.wxid = (DWORD)wxidaddr;
params.title = (DWORD)titleaddr;
params.abstract = (DWORD)abstractaddr;
params.url = (DWORD)urladdr;
params.imgpath = imgpath ? (DWORD)imgaddr : 0;
if (paramAndFunc)
WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(params), &dwId);
......@@ -51,6 +56,7 @@ BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url)
VirtualFreeEx(hProcess, titleaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, abstractaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, urladdr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, imgaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 0;
}
\ No newline at end of file
#pragma once
#include<windows.h>
BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url);
\ No newline at end of file
BOOL SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url, wchar_t* imgpath);
\ No newline at end of file
......@@ -6,9 +6,10 @@ struct SendAtTextStruct
DWORD wxid;
DWORD wxmsg;
DWORD length;
DWORD AutoNickName;
};
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg,BOOL AutoNickName) {
if (!hProcess)
return 1;
DWORD WeChatRobotBase = GetWeChatRobotBase();
......@@ -38,6 +39,7 @@ int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
params.wxid = (DWORD)wxidaddr;
params.wxmsg = (DWORD)wxmsgaddr;
params.length = 1;
params.AutoNickName = AutoNickName;
if (paramAndFunc) {
if (!::WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(SendAtTextStruct), &dwTId))
......@@ -65,7 +67,7 @@ int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
return 0;
}
BOOL SendAtText(wchar_t* chatroomid, SAFEARRAY* psaValue, wchar_t* wxmsg) {
BOOL SendAtText(wchar_t* chatroomid, SAFEARRAY* psaValue, wchar_t* wxmsg,BOOL AutoNickName) {
if (!hProcess)
return 1;
VARIANT rgvar;
......@@ -77,7 +79,7 @@ BOOL SendAtText(wchar_t* chatroomid, SAFEARRAY* psaValue, wchar_t* wxmsg) {
VariantInit(&rgvar);
long pIndex = 0;
hr = SafeArrayGetElement(psaValue, &pIndex, &rgvar);
return SendAtText(chatroomid, rgvar.bstrVal, wxmsg);
return SendAtText(chatroomid, rgvar.bstrVal, wxmsg,AutoNickName);
}
vector<void*> wxidptrs;
DWORD dwWriteSize = 0;
......@@ -113,6 +115,7 @@ BOOL SendAtText(wchar_t* chatroomid, SAFEARRAY* psaValue, wchar_t* wxmsg) {
params.wxid = (DWORD)wxidptrsaddr;
params.wxmsg = (DWORD)wxmsgaddr;
params.length = wxidptrs.size();
params.AutoNickName = AutoNickName;
if (paramAndFunc) {
WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(SendAtTextStruct), &dwTId);
}
......
#pragma once
#include<windows.h>
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg);
int SendAtText(wchar_t* chatroomid, SAFEARRAY* wxid, wchar_t* wxmsg);
\ No newline at end of file
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg,BOOL AutoNickName);
int SendAtText(wchar_t* chatroomid, SAFEARRAY* wxid, wchar_t* wxmsg,BOOL AutoNickName);
\ No newline at end of file
......@@ -37,14 +37,14 @@ STDMETHODIMP CWeChatRobot::CSendText(BSTR wxid, BSTR wxmsg, int* __result) {
* 参数3:文本消息内容
* 参数4:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendAtText(BSTR chatroomid, VARIANT* wxid, BSTR wxmsg, int* __result) {
STDMETHODIMP CWeChatRobot::CSendAtText(BSTR chatroomid, VARIANT* wxid, BSTR wxmsg, BOOL AutoNickName, int* __result) {
*__result = 0;
if (wxid->vt == VT_BSTR) {
*__result = SendAtText(chatroomid,wxid->bstrVal, wxmsg);
*__result = SendAtText(chatroomid, wxid->bstrVal, wxmsg, AutoNickName);
}
else if(wxid->vt == (VT_ARRAY | VT_VARIANT)) {
else if (wxid->vt == (VT_ARRAY | VT_VARIANT)) {
SAFEARRAY* psaValue = wxid->parray;
*__result = SendAtText(chatroomid, psaValue, wxmsg);
*__result = SendAtText(chatroomid, psaValue, wxmsg, AutoNickName);
}
return S_OK;
}
......@@ -76,8 +76,8 @@ STDMETHODIMP CWeChatRobot::CSendFile(BSTR wxid, BSTR filepath, int* __result) {
* 参数4:文章链接
* 参数5:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendArticle(BSTR wxid, BSTR title,BSTR abstract,BSTR url, int* __result) {
*__result = SendArticle(wxid, title,abstract,url);
STDMETHODIMP CWeChatRobot::CSendArticle(BSTR wxid, BSTR title,BSTR abstract,BSTR url, BSTR imgpath, int* __result) {
*__result = SendArticle(wxid, title,abstract,url,imgpath);
return S_OK;
}
......
......@@ -56,9 +56,9 @@ public:
STDMETHODIMP CSendImage(BSTR wxid, BSTR imagepath, int* __result);
STDMETHODIMP CSendText(BSTR wxid, BSTR wxmsg, int* __result);
STDMETHODIMP CSendFile(BSTR wxid, BSTR filepath, int* __result);
STDMETHODIMP CSendArticle(BSTR wxid, BSTR title, BSTR abstract, BSTR url, int* __result);
STDMETHODIMP CSendArticle(BSTR wxid, BSTR title, BSTR abstract, BSTR url, BSTR imgpath, int* __result);
STDMETHODIMP CSendCard(BSTR receiver, BSTR sharedwxid, BSTR nickname, int* __result);
STDMETHODIMP CSendAtText(BSTR chatroomid, VARIANT* wxid, BSTR wxmsg, int* __result);
STDMETHODIMP CSendAtText(BSTR chatroomid, VARIANT* wxid, BSTR wxmsg, BOOL AutoNickName, int* __result);
STDMETHODIMP CGetFriendList(VARIANT* __result);
STDMETHODIMP CGetFriendListString(BSTR* __result);
STDMETHODIMP CGetWxUserInfo(BSTR wxid, BSTR* __result);
......
......@@ -21,7 +21,7 @@ interface IWeChatRobot : IDispatch
[id(3)] HRESULT CSendText([in] BSTR wxid, [in] BSTR wxmsg, [out, retval] int* __result);
[id(4)] HRESULT CSendImage([in] BSTR wxid, [in] BSTR imagepath, [out, retval] int* __result);
[id(5)] HRESULT CSendFile([in] BSTR wxid, [in] BSTR filepath, [out, retval] int* __result);
[id(6)] HRESULT CSendArticle([in] BSTR wxid, [in] BSTR title, [in] BSTR abstract, [in] BSTR url, [out, retval] int* __result);
[id(6)] HRESULT CSendArticle([in] BSTR wxid, [in] BSTR title, [in] BSTR abstract, [in] BSTR url, [in] BSTR imgpath, [out, retval] int* __result);
[id(7)] HRESULT CSendCard([in] BSTR receiver, [in] BSTR sharedwxid, [in] BSTR nickname, [out, retval] int* __result);
[id(8)] HRESULT CGetFriendList([out, retval] VARIANT* __result);
[id(9)] HRESULT CGetFriendListString([out, retval] BSTR* __result);
......@@ -34,7 +34,7 @@ interface IWeChatRobot : IDispatch
[id(16)] HRESULT CStartReceiveMessage([out, retval] int* __result);
[id(17)] HRESULT CReceiveMessage([out, retval] VARIANT* __result);
[id(18)] HRESULT CStopReceiveMessage([out, retval] int* __result);
[id(19)] HRESULT CSendAtText([in] BSTR chatroomid, [in] VARIANT* wxid, [in] BSTR wxmsg, [out, retval] int* __result);
[id(19)] HRESULT CSendAtText([in] BSTR chatroomid, [in] VARIANT* wxid, [in] BSTR wxmsg, [in] BOOL AutoNickName, [out, retval] int* __result);
[id(20)] HRESULT CGetChatRoomMembers([in] BSTR chatroomid, [out, retval] VARIANT* __result);
[id(21)] HRESULT CGetDbHandles([out, retval] VARIANT* __result);
[id(22)] HRESULT CExecuteSQL([in] DWORD DbHandle, [in] BSTR sql, [out, retval] VARIANT* __result);
......
......@@ -114,6 +114,7 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR title,
/* [in] */ BSTR abstract,
/* [in] */ BSTR url,
/* [in] */ BSTR imgpath,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendCard(
......@@ -161,6 +162,7 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR chatroomid,
/* [in] */ VARIANT *wxid,
/* [in] */ BSTR wxmsg,
/* [in] */ BOOL AutoNickName,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CGetChatRoomMembers(
......@@ -318,6 +320,7 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR title,
/* [in] */ BSTR abstract,
/* [in] */ BSTR url,
/* [in] */ BSTR imgpath,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendCard )(
......@@ -378,6 +381,7 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR chatroomid,
/* [in] */ VARIANT *wxid,
/* [in] */ BSTR wxmsg,
/* [in] */ BOOL AutoNickName,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CGetChatRoomMembers )(
......@@ -512,8 +516,8 @@ EXTERN_C const IID IID_IWeChatRobot;
#define IWeChatRobot_CSendFile(This,wxid,filepath,__result) \
( (This)->lpVtbl -> CSendFile(This,wxid,filepath,__result) )
#define IWeChatRobot_CSendArticle(This,wxid,title,abstract,url,__result) \
( (This)->lpVtbl -> CSendArticle(This,wxid,title,abstract,url,__result) )
#define IWeChatRobot_CSendArticle(This,wxid,title,abstract,url,imgpath,__result) \
( (This)->lpVtbl -> CSendArticle(This,wxid,title,abstract,url,imgpath,__result) )
#define IWeChatRobot_CSendCard(This,receiver,sharedwxid,nickname,__result) \
( (This)->lpVtbl -> CSendCard(This,receiver,sharedwxid,nickname,__result) )
......@@ -551,8 +555,8 @@ EXTERN_C const IID IID_IWeChatRobot;
#define IWeChatRobot_CStopReceiveMessage(This,__result) \
( (This)->lpVtbl -> CStopReceiveMessage(This,__result) )
#define IWeChatRobot_CSendAtText(This,chatroomid,wxid,wxmsg,__result) \
( (This)->lpVtbl -> CSendAtText(This,chatroomid,wxid,wxmsg,__result) )
#define IWeChatRobot_CSendAtText(This,chatroomid,wxid,wxmsg,AutoNickName,__result) \
( (This)->lpVtbl -> CSendAtText(This,chatroomid,wxid,wxmsg,AutoNickName,__result) )
#define IWeChatRobot_CGetChatRoomMembers(This,chatroomid,__result) \
( (This)->lpVtbl -> CGetChatRoomMembers(This,chatroomid,__result) )
......
此差异已折叠。
......@@ -158,6 +158,7 @@
<ClInclude Include="CheckFriendStatus.h" />
<ClInclude Include="DbBackup.h" />
<ClInclude Include="DbExecuteSql.h" />
<ClInclude Include="DeleteUser.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="FriendList.h" />
<ClInclude Include="GetChatRoomMembers.h" />
......@@ -166,6 +167,7 @@
<ClInclude Include="pch.h" />
<ClInclude Include="ReceiveMessage.h" />
<ClInclude Include="SelfInfo.h" />
<ClInclude Include="SendAppMsg.h" />
<ClInclude Include="SendArticle.h" />
<ClInclude Include="SendAtText.h" />
<ClInclude Include="SendCard.h" />
......@@ -184,6 +186,7 @@
<ClCompile Include="CheckFriendStatus.cpp" />
<ClCompile Include="DbBackup.cpp" />
<ClCompile Include="DbExecuteSql.cpp" />
<ClCompile Include="DeleteUser.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FriendList.cpp" />
<ClCompile Include="GetChatRoomMemebers.cpp" />
......@@ -199,6 +202,7 @@
<ClCompile Include="ReceiveMessage.cpp" />
<ClCompile Include="SearchContactByNet.cpp" />
<ClCompile Include="SelfInfo.cpp" />
<ClCompile Include="SendAppMsg.cpp" />
<ClCompile Include="SendArticle.cpp" />
<ClCompile Include="SendAtText.cpp" />
<ClCompile Include="SendCard.cpp" />
......
......@@ -85,6 +85,12 @@
<Filter Include="微信版本">
<UniqueIdentifier>{820d8228-ee6c-43ad-87ec-4e349d7a549a}</UniqueIdentifier>
</Filter>
<Filter Include="好友相关\删除好友">
<UniqueIdentifier>{cf1ddfc9-e181-43e5-ba92-998439becadb}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送小程序">
<UniqueIdentifier>{2e1bef8d-a840-4318-a728-29f1e8e68336}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
......@@ -153,6 +159,12 @@
<ClInclude Include="wechatver.h">
<Filter>微信版本</Filter>
</ClInclude>
<ClInclude Include="DeleteUser.h">
<Filter>好友相关\删除好友</Filter>
</ClInclude>
<ClInclude Include="SendAppMsg.h">
<Filter>发送消息\发送小程序</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
......@@ -233,5 +245,11 @@
<ClCompile Include="wechatver.cpp">
<Filter>微信版本</Filter>
</ClCompile>
<ClCompile Include="DeleteUser.cpp">
<Filter>好友相关\删除好友</Filter>
</ClCompile>
<ClCompile Include="SendAppMsg.cpp">
<Filter>发送消息\发送小程序</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#include "pch.h"
#define DeleteUserCall1Offset 0x04417570 - 0x04360000
#define DeleteUserCall2Offset 0x0441D570 - 0x04360000
#define DeleteUserCall3Offset 0x047C8570 - 0x04360000
BOOL __stdcall DeleteUser(wchar_t* wxid) {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD DeleteUserCall1 = WeChatWinBase + DeleteUserCall1Offset;
DWORD DeleteUserCall2 = WeChatWinBase + DeleteUserCall2Offset;
DWORD DeleteUserCall3 = WeChatWinBase + DeleteUserCall3Offset;
WxBaseStruct pwxid(wxid);
char buffer[0x70] = { 0 };
BOOL isSuccess = 0x0;
__asm {
pushad;
pushfd;
lea ecx, buffer;
call DeleteUserCall1;
call DeleteUserCall2;
push ecx;
lea esi, pwxid;
push esi;
mov ecx, eax;
call DeleteUserCall3;
mov isSuccess, eax;
popfd;
popad;
}
return isSuccess;
}
\ No newline at end of file
#pragma once
#include<windows.h>
BOOL __stdcall DeleteUser(wchar_t* wxid);
\ No newline at end of file
#include "pch.h"
#define SendAppMsgCall1Offset 0x04421340 - 0x04360000
#define SendAppMsgCall2Offset 0x04AD0980 - 0x04360000
#define SendAppMsgCall3Offset 0x04B1BB30 - 0x04360000
struct VectorStruct {
#ifdef _DEBUG
DWORD v_head;
#endif
DWORD v_data;
DWORD v_end1;
DWORD v_end2;
};
BOOL __stdcall SendAppMsg(wchar_t* wxid,wchar_t* appid) {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD SendAppMsgCall1 = WeChatWinBase + SendAppMsgCall1Offset;
DWORD SendAppMsgCall2 = WeChatWinBase + SendAppMsgCall2Offset;
DWORD SendAppMsgCall3 = WeChatWinBase + SendAppMsgCall3Offset;
vector<WxBaseStruct> receiver;
VectorStruct* vs = (VectorStruct*)&receiver;
DWORD preceiver = (DWORD)&vs->v_data;
WxBaseStruct pwxid(wxid);
receiver.push_back(pwxid);
WxBaseStruct pappid(appid);
char buffer[0x1E0] = { 0 };
BOOL isSuccess = 0x0;
__asm {
pushad;
pushfd;
push 0x60966;
sub esp, 0xC;
mov esi, dword ptr[SendAppMsgCall3];
mov ecx, esp;
mov eax, dword ptr[preceiver];
push eax;
call SendAppMsgCall1;
sub esp, 0x14;
lea eax, pappid;
mov ecx, esp;
push eax;
call SendAppMsgCall2;
lea ecx, buffer;
call SendAppMsgCall3;
mov isSuccess, eax;
popfd;
popad;
}
return isSuccess;
}
\ No newline at end of file
#pragma once
#include<windows.h>
BOOL __stdcall SendAppMsg(wchar_t* wxid, wchar_t* appid);
\ No newline at end of file
......@@ -28,6 +28,7 @@ struct SendArticleStruct {
DWORD title;
DWORD abstract;
DWORD url;
DWORD imgpath;
};
/*
......@@ -41,7 +42,8 @@ VOID SendArticleRemote(LPVOID lparameter) {
wchar_t* title = (wchar_t*)sas->title;
wchar_t* abstract = (wchar_t*)sas->abstract;
wchar_t* url = (wchar_t*)sas->url;
SendArticle(wxid,title,abstract,url);
wchar_t* imgpath = sas->imgpath ? (wchar_t*)sas->imgpath : NULL;
SendArticle(wxid,title,abstract,url, imgpath);
}
/*
......@@ -72,7 +74,7 @@ DWORD GetSelfWxIdAddr() {
* url:文章链接
* return:BOOL,成功返回`1`,失败返回`0`
*/
BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wchar_t* url) {
BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wchar_t* url,wchar_t* imgpath) {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD SendArticleCall1 = WeChatWinBase + SendArticleCall1Offset;
DWORD SendArticleCall2 = WeChatWinBase + SendArticleCall2Offset;
......@@ -99,6 +101,12 @@ BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wcha
WxBaseStruct pXml(xmlbuffer);
WxBaseStruct pReceiver(wxid);
WxString imgbuffer = { 0 };
wcout << imgpath << endl;
if (imgpath) {
imgbuffer.buffer = imgpath;
imgbuffer.length = wcslen(imgpath);
imgbuffer.maxLength = wcslen(imgpath) * 2;
}
WxString nullStruct = { 0 };
char buffer[0xFF0] = { 0 };
DWORD isSuccess = 0x0;
......
#pragma once
#include<windows.h>
extern "C" __declspec(dllexport) VOID SendArticleRemote(LPVOID lparameter);
BOOL __stdcall SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url);
\ No newline at end of file
BOOL __stdcall SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url,wchar_t* imgpath);
\ No newline at end of file
......@@ -18,6 +18,7 @@ struct SendAtTextStruct
DWORD wxidlist;
DWORD wxmsg;
DWORD length;
BOOL AutoNickName;
};
/*
......@@ -45,10 +46,10 @@ void SendAtTextRemote(LPVOID lpParameter) {
wchar_t* wsTextMsg = (WCHAR*)rp->wxmsg;
if (rp->length == 0)
return;
else if(rp->length == 1)
SendAtText(wsChatRoomId, (DWORD*)&rp->wxidlist, wsTextMsg,rp->length);
else if (rp->length == 1)
SendAtText(wsChatRoomId, (DWORD*)&rp->wxidlist, wsTextMsg, rp->length, rp->AutoNickName);
else
SendAtText(wsChatRoomId, (DWORD*)rp->wxidlist, wsTextMsg, rp->length);
SendAtText(wsChatRoomId, (DWORD*)rp->wxidlist, wsTextMsg, rp->length, rp->AutoNickName);
}
/*
......@@ -57,9 +58,10 @@ void SendAtTextRemote(LPVOID lpParameter) {
* wsWxId:艾特的人列表
* wsTextMsg:发送的消息内容
* length:艾特的人数量
* AutoNickName:是否自动填充被艾特人昵称
* return:void
*/
void __stdcall SendAtText(wchar_t* wsChatRoomId, DWORD wsWxId[], wchar_t* wsTextMsg,int length) {
void __stdcall SendAtText(wchar_t* wsChatRoomId, DWORD wsWxId[], wchar_t* wsTextMsg,int length,BOOL AutoNickName) {
// +1的作用是补充一个空结构体,将`AtStruct`尾地址设定为空结构的首地址即可
WxString* AtUsers = new WxString[length + 1];
wstring AtMessage = L"";
......@@ -77,8 +79,10 @@ void __stdcall SendAtText(wchar_t* wsChatRoomId, DWORD wsWxId[], wchar_t* wsText
temp.buffer = (wchar_t*)wsWxId[i];
temp.length = wcslen((wchar_t*)wsWxId[i]);
temp.maxLength = wcslen((wchar_t*)wsWxId[i]) * 2;
memcpy(&AtUsers[querySuccess],&temp,sizeof(WxString));
AtMessage = AtMessage + L"@" + nickname + L" ";
memcpy(&AtUsers[querySuccess], &temp, sizeof(WxString));
if (AutoNickName) {
AtMessage = AtMessage + L"@" + nickname + L" ";
}
querySuccess++;
}
AtMessage += wsTextMsg;
......
#pragma once
#include<windows.h>
void __stdcall SendAtText(wchar_t* wsChatRoomId, DWORD wsWxId[], wchar_t* wsTextMsg, int length);
void __stdcall SendAtText(wchar_t* wsChatRoomId, DWORD wsWxId[], wchar_t* wsTextMsg, int length, BOOL AutoNickName);
extern "C" __declspec(dllexport) void SendAtTextRemote(LPVOID lpParameter);
\ No newline at end of file
......@@ -31,6 +31,8 @@
#include "AddFriend.h"
#include "sqlite3.h"
#include "wechatver.h"
#include "DeleteUser.h"
#include "SendAppMsg.h"
#include <vector>
#include <strstream>
#endif //PCH_H
......
......@@ -30,16 +30,31 @@ class ChatSession():
def SendMp4(self,mp4path):
return self.robot.CSendImage(self.chatwith,mp4path)
def SendArticle(self,title,abstract,url):
return self.robot.CSendArticle(self.chatwith,title,abstract,url)
def SendArticle(self,title,abstract,url,imgpath = None):
return self.robot.CSendArticle(self.chatwith,title,abstract,url,imgpath)
def SendCard(self,sharedwxid,nickname):
return self.robot.CSendCard(self.chatwith,sharedwxid,nickname)
def SendAtText(self,wxid:list or str or tuple,msg):
def SendAtText(self,wxid:list or str or tuple,msg,AutoNickName = True):
"""
Parameters
----------
wxid : list or str or tuple
被艾特人的wxid,列表或字符串.
msg : str
消息内容.
AutoNickName : BOOL, optional
是否自动填充被艾特人昵称.
Returns None
-------
SendAtText
发送群艾特消息.
"""
if '@chatroom' not in self.chatwith:
return 1
return self.robot.CSendAtText(self.chatwith,wxid,msg)
return self.robot.CSendAtText(self.chatwith,wxid,msg,AutoNickName)
class WeChatRobot():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册