提交 56f2561d 编写于 作者: L ljc545w

Create Object

上级
/Debug
/Release/*.exp
/Release/*.pdb
/Release/*.lib
*/Debug/
*/Release/
*.rar
/.vs/
#include "pch.h"
struct WxFriendAddrStruct {
DWORD wxIdAddr;
DWORD wxNumberAddr;
DWORD wxNickNameAddr;
DWORD wxRemarkAddr;
};
struct WxFriendStruct {
wchar_t* wxId;
wchar_t* wxNumber;
wchar_t* wxNickName;
wchar_t* wxRemark;
};
WxFriendStruct* WxFriendList;
void ReadFriendMessageByAddress(WxFriendAddrStruct* lpWxFriendAddr, WxFriendStruct* lpWxFriend) {
DWORD length = 0;
DWORD bufferaddr = 0;
ReadProcessMemory(hProcess, (LPCVOID)(lpWxFriendAddr->wxIdAddr + 0x4), &length, sizeof(DWORD), 0);
if (length) {
lpWxFriend->wxId = new wchar_t[length + 1];//(wchar_t*)malloc(sizeof(wchar_t) * (length + 1));
if (lpWxFriend->wxId)
{
ZeroMemory(lpWxFriend->wxId, sizeof(wchar_t) * (length + 1));
ReadProcessMemory(hProcess, (LPCVOID)lpWxFriendAddr->wxIdAddr, &bufferaddr, sizeof(DWORD), 0);
ReadProcessMemory(hProcess, (LPCVOID)bufferaddr, lpWxFriend->wxId, length * sizeof(wchar_t), 0);
}
}
else {
lpWxFriend->wxId = L"null";
}
ReadProcessMemory(hProcess, (LPCVOID)(lpWxFriendAddr->wxNumberAddr + 0x4), &length, sizeof(DWORD), 0);
if (length) {
lpWxFriend->wxNumber = new wchar_t[length + 1];//(wchar_t*)malloc(sizeof(wchar_t) * (length + 1));
if (lpWxFriend->wxNumber)
{
ZeroMemory(lpWxFriend->wxNumber, sizeof(wchar_t) * (length + 1));
ReadProcessMemory(hProcess, (LPCVOID)lpWxFriendAddr->wxNumberAddr, &bufferaddr, sizeof(DWORD), 0);
ReadProcessMemory(hProcess, (LPCVOID)bufferaddr, lpWxFriend->wxNumber, length * sizeof(wchar_t), 0);
}
}
else {
lpWxFriend->wxNumber = L"null";
}
ReadProcessMemory(hProcess, (LPCVOID)(lpWxFriendAddr->wxNickNameAddr + 0x4), &length, sizeof(DWORD), 0);
if (length) {
lpWxFriend->wxNickName = new wchar_t[length + 1]; //(wchar_t*)malloc(sizeof(wchar_t) * (length + 1));
if (lpWxFriend->wxNickName)
{
ZeroMemory(lpWxFriend->wxNickName, sizeof(wchar_t) * (length + 1));
ReadProcessMemory(hProcess, (LPCVOID)lpWxFriendAddr->wxNickNameAddr, &bufferaddr, sizeof(DWORD), 0);
ReadProcessMemory(hProcess, (LPCVOID)bufferaddr, lpWxFriend->wxNickName, length * sizeof(wchar_t), 0);
}
}
else {
lpWxFriend->wxNickName = L"null";
}
ReadProcessMemory(hProcess, (LPCVOID)(lpWxFriendAddr->wxRemarkAddr + 0x4), &length, sizeof(DWORD), 0);
if (length) {
lpWxFriend->wxRemark = new wchar_t[length + 1]; //(wchar_t*)malloc(sizeof(wchar_t) * (length + 1));
if (lpWxFriend->wxRemark)
{
ZeroMemory(lpWxFriend->wxRemark, sizeof(wchar_t) * (length + 1));
ReadProcessMemory(hProcess, (LPCVOID)lpWxFriendAddr->wxRemarkAddr, &bufferaddr, sizeof(DWORD), 0);
ReadProcessMemory(hProcess, (LPCVOID)bufferaddr, lpWxFriend->wxRemark, length * sizeof(wchar_t), 0);
}
}
else {
lpWxFriend->wxRemark = L"null";
}
}
void FreeWxFriend(int index) {
delete[] WxFriendList[index].wxId;
WxFriendList[index].wxId = NULL;
if (StrCmpW(WxFriendList[index].wxNumber, L"null") != 0) {
delete[] WxFriendList[index].wxNumber;
WxFriendList[index].wxNumber = NULL;
};
if (StrCmpW(WxFriendList[index].wxNickName, L"null") != 0) {
delete[] WxFriendList[index].wxNickName;
WxFriendList[index].wxNickName = NULL;
};
if (StrCmpW(WxFriendList[index].wxRemark, L"null") != 0) {
delete[] WxFriendList[index].wxRemark;
WxFriendList[index].wxRemark = NULL;
};
}
std::wstring GetFriendList() {
DWORD GetFriendListInitAddr = GetWeChatRobotBase() + GetFriendListInitOffset;
DWORD GetFriendListRemoteAddr = GetWeChatRobotBase() + GetFriendListRemoteOffset;
DWORD GetFriendListFinishAddr = GetWeChatRobotBase() + GetFriendListFinishOffset;
DWORD FriendCount = 0;
DWORD dwId, dwHandle = 0;
// 获取好友列表的长度
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetFriendListInitAddr, NULL, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &FriendCount);
CloseHandle(hThread);
}
// 获取保存第一个好友的数据指针的结构体首地址
hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetFriendListRemoteAddr, 0, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &dwHandle);
CloseHandle(hThread);
}
WxFriendAddrStruct WxFriendAddr = { 0 };
// 根据好友数量初始化全局变量
WxFriendList = new WxFriendStruct[FriendCount];
if (dwHandle) {
for (unsigned int i = 0; i < FriendCount; i++) {
WxFriendList[i] = { 0 };
ZeroMemory(&WxFriendAddr, sizeof(WxFriendAddrStruct));
ReadProcessMemory(hProcess, (LPCVOID)dwHandle, &WxFriendAddr, sizeof(WxFriendAddrStruct), 0);
ReadFriendMessageByAddress(&WxFriendAddr, &WxFriendList[i]);
// 保存下一个好友数据的结构体
dwHandle += sizeof(WxFriendAddrStruct);
}
}
else {
return L"[]";
}
// 清除微信进程空间中的缓存
hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetFriendListFinishAddr, NULL, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
wstring message = L"[";
// 构造结构化的数据
for (unsigned int i = 0; i < FriendCount; i++) {
message = message + L"{\"wxid\":\"" + WxFriendList[i].wxId + L"\",";
message = message + L"\"wxNumber\":\"" + WxFriendList[i].wxNumber + L"\",";
message = message + L"\"wxNickName\":\"" + WxFriendList[i].wxNickName + L"\",";
message = message + L"\"wxRemark\":\"" + WxFriendList[i].wxRemark + L"\"}";
if(i != FriendCount - 1)
message = message + L",";
FreeWxFriend(i);
}
message = message + L"]";
// 释放全局变量
delete[] WxFriendList;
WxFriendList = NULL;
return message;
}
\ No newline at end of file
#pragma once
#include<windows.h>
std::wstring GetFriendList();
\ No newline at end of file
#include "pch.h"
bool InjectDll(DWORD dwId, WCHAR* szPath)//参数1:目标进程PID 参数2:DLL路径
{
if (!hProcess)
return 1;
if (GetWeChatRobotBase() != 0) {
return 1;
}
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
DWORD dwWriteSize = 0;
if (pRemoteAddress)
{
WriteProcessMemory(hProcess, pRemoteAddress, szPath, wcslen(szPath) * 2 + 2, &dwWriteSize);
}
else {
return 1;
}
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)LoadLibrary, pRemoteAddress, NULL, NULL);
if (hThread) {
WaitForSingleObject(hThread, -1);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
return 0;
}
bool Injert(DWORD dwPid,wchar_t* workPath) {
wchar_t* dllpath = new wchar_t[MAX_PATH];
swprintf_s(dllpath, MAX_PATH, L"%ws%ws%ws", workPath, L"\\", dllname);
string name = _com_util::ConvertBSTRToString((BSTR)workPath);
if (!isFileExists_stat(name)) {
MessageBoxA(NULL, name.c_str(), "文件不存在", MB_ICONWARNING);
return 1;
}
bool status = InjectDll(dwPid, dllpath);
delete[] dllpath;
dllpath = NULL;
return status;
}
BOOL RemoveDll(DWORD dwId) {
if (!hProcess)
return 1;
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
DWORD dwWriteSize = 0;
HANDLE hThread = NULL;
DWORD dwHandle, dwID;
LPVOID pFunc = NULL;
if (pRemoteAddress)
WriteProcessMemory(hProcess, pRemoteAddress, dllname, wcslen(dllname) * 2 + 2, &dwWriteSize);
else {
return 1;
}
pFunc = GetModuleHandleW;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, pRemoteAddress, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &dwHandle);
}
else {
return 1;
}
CloseHandle(hThread);
pFunc = FreeConsole;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, NULL, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
pFunc = FreeLibrary;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, (LPVOID)dwHandle, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
return 0;
}
#pragma once
#include<windows.h>
bool Injert(DWORD dwPid, wchar_t* workPath);
BOOL RemoveDll(DWORD dwId);
\ No newline at end of file
#include "pch.h"
struct FileParamStruct {
DWORD wxid;
DWORD filepath;
};
int SendFile(wchar_t* wxid, wchar_t* filepath) {
DWORD WeChatRobotBase = GetWeChatRobotBase();
DWORD dwId = 0;
DWORD dwWriteSize = 0;
FileParamStruct params;
ZeroMemory(&params, sizeof(params));
LPVOID wxidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID filepathaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
FileParamStruct* paramAndFunc = (FileParamStruct*)::VirtualAllocEx(hProcess, 0, sizeof(FileParamStruct), MEM_COMMIT, PAGE_READWRITE);
if (!wxidaddr || !filepathaddr || !paramAndFunc || !WeChatRobotBase) {
return 1;
}
DWORD dwTId = 0;
if (wxidaddr)
WriteProcessMemory(hProcess, wxidaddr, wxid, wcslen(wxid) * 2 + 2, &dwWriteSize);
if (filepathaddr)
WriteProcessMemory(hProcess, filepathaddr, filepath, wcslen(filepath) * 2 + 2, &dwWriteSize);
params.wxid = (DWORD)wxidaddr;
params.filepath = (DWORD)filepathaddr;
if (paramAndFunc) {
if (!::WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(params), &dwTId))
{
return 1;
}
}
else {
return 1;
}
DWORD SendFileRemoteAddr = WeChatRobotBase + SendFileOffset;
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)SendFileRemoteAddr, (LPVOID)paramAndFunc, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, wxidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, filepathaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 0;
}
#pragma once
#include<windows.h>
int SendFile(wchar_t* wxid, wchar_t* filepath);
\ No newline at end of file
#include "pch.h"
struct ImageParamStruct {
DWORD wxid;
DWORD imagepath;
};
int SendImage(wchar_t* wxid, wchar_t* imagepath) {
DWORD WeChatRobotBase = GetWeChatRobotBase();
DWORD dwId = 0;
DWORD dwWriteSize = 0;
ImageParamStruct params;
ZeroMemory(&params, sizeof(params));
LPVOID wxidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID imagepathaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
ImageParamStruct* paramAndFunc = (ImageParamStruct*)::VirtualAllocEx(hProcess, 0, sizeof(ImageParamStruct), MEM_COMMIT, PAGE_READWRITE);
if (!wxidaddr || !imagepathaddr || !paramAndFunc || !WeChatRobotBase) {
return 1;
}
DWORD dwTId = 0;
if (wxidaddr)
WriteProcessMemory(hProcess, wxidaddr, wxid, wcslen(wxid) * 2 + 2, &dwWriteSize);
if (imagepathaddr)
WriteProcessMemory(hProcess, imagepathaddr, imagepath, wcslen(imagepath) * 2 + 2, &dwWriteSize);
params.wxid = (DWORD)wxidaddr;
params.imagepath = (DWORD)imagepathaddr;
if (paramAndFunc) {
if (!::WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(params), &dwTId))
{
return 1;
}
}
else {
return 1;
}
DWORD SendImageRemoteAddr = WeChatRobotBase + SendImageOffset;
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)SendImageRemoteAddr, (LPVOID)paramAndFunc, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, wxidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, imagepathaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 0;
}
#pragma once
#include<windows.h>
int SendImage(wchar_t* wxid, wchar_t* imagepath);
\ No newline at end of file
#include "pch.h"
struct SendTextStruct
{
DWORD wxid;
DWORD wxmsg;
};
int SendText(wchar_t* wxid, wchar_t* wxmsg) {
DWORD WeChatRobotBase = GetWeChatRobotBase();
DWORD dwId = 0;
DWORD dwWriteSize = 0;
SendTextStruct params;
ZeroMemory(&params, sizeof(params));
LPVOID wxidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID wxmsgaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
SendTextStruct* paramAndFunc = (SendTextStruct*)::VirtualAllocEx(hProcess, 0, sizeof(SendTextStruct), MEM_COMMIT, PAGE_READWRITE);
if (!wxidaddr || !wxmsgaddr || !paramAndFunc || !WeChatRobotBase) {
return 1;
}
DWORD dwTId = 0;
if (wxidaddr)
WriteProcessMemory(hProcess, wxidaddr, wxid, wcslen(wxid) * 2 + 2, &dwWriteSize);
if (wxmsgaddr)
WriteProcessMemory(hProcess, wxmsgaddr, wxmsg, wcslen(wxmsg) * 2 + 2, &dwWriteSize);
params.wxid = (DWORD)wxidaddr;
params.wxmsg = (DWORD)wxmsgaddr;
if (paramAndFunc) {
if (!::WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(params), &dwTId))
{
return 1;
}
}
else {
return 1;
}
DWORD SendTextRemoteAddr = WeChatRobotBase + SendTextOffset;
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)SendTextRemoteAddr, (LPVOID)paramAndFunc, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, wxidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, wxmsgaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 0;
}
\ No newline at end of file
#pragma once
#include<windows.h>
int SendText(wchar_t* wxid, wchar_t* wxmsg);
// WeChatRobot.cpp: CWeChatRobot 的实现
#include "pch.h"
#include "WeChatRobot.h"
// CWeChatRobot
/*
* 参数1:`MyWeChatRobot.dll`所在目录
* 参数2:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CStartRobotService(BSTR workPath, int* __result) {
*__result = StartRobotService(workPath);
return S_OK;
}
/*
* 参数1:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CStopRobotService(int* __result) {
*__result = StopRobotService();
return S_OK;
}
/*
* 参数1:接收人wxid
* 参数2:文本消息内容
* 参数3:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendText(BSTR wxid, BSTR wxmsg, int* __result) {
*__result = SendText(wxid, wxmsg);
return S_OK;
}
/*
* 参数1:接收人wxid
* 参数2:图片绝对路径
* 参数3:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendImage(BSTR wxid, BSTR imagepath, int* __result) {
*__result = SendImage(wxid, imagepath);
return S_OK;
}
/*
* 参数1:接收人wxid
* 参数2:文件绝对路径
* 参数3:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendFile(BSTR wxid, BSTR filepath, int* __result) {
*__result = SendFile(wxid, filepath);
return S_OK;
}
/*
* 参数1:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CGetFriendList(BSTR* __result) {
string smessage = _com_util::ConvertBSTRToString((BSTR)(GetFriendList().c_str()));
*__result = _com_util::ConvertStringToBSTR(smessage.c_str());
return S_OK;
}
\ No newline at end of file
// WeChatRobot.h: CWeChatRobot 的声明
#pragma once
#include "resource.h" // 主符号
#include "WeChatRobotCOM_i.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Windows CE 平台(如不提供完全 DCOM 支持的 Windows Mobile 平台)上无法正确支持单线程 COM 对象。定义 _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 可强制 ATL 支持创建单线程 COM 对象实现并允许使用其单线程 COM 对象实现。rgs 文件中的线程模型已被设置为“Free”,原因是该模型是非 DCOM Windows CE 平台支持的唯一线程模型。"
#endif
using namespace ATL;
// CWeChatRobot
class ATL_NO_VTABLE CWeChatRobot :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CWeChatRobot, &CLSID_WeChatRobot>,
public IDispatchImpl<IWeChatRobot, &IID_IWeChatRobot, &LIBID_WeChatRobotCOMLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CWeChatRobot()
{
}
DECLARE_REGISTRY_RESOURCEID(106)
BEGIN_COM_MAP(CWeChatRobot)
COM_INTERFACE_ENTRY(IWeChatRobot)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHODIMP CStartRobotService(BSTR workPath, int* __result);
STDMETHODIMP CStopRobotService(int* __result);
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 CGetFriendList(BSTR* __result);
};
OBJECT_ENTRY_AUTO(__uuidof(WeChatRobot), CWeChatRobot)
HKCR
{
WeChatRobot.CWeChatRobot.1 = s 'WeChatRobot class'
{
CLSID = s '{4ce7f5e1-2c93-4bfe-86ac-886452e47475}'
}
WeChatRobot.CWeChatRobot = s 'WeChatRobot class'
{
CurVer = s 'WeChatRobot.CWeChatRobot.1'
}
NoRemove CLSID
{
ForceRemove {4ce7f5e1-2c93-4bfe-86ac-886452e47475} = s 'WeChatRobot class'
{
ProgID = s 'WeChatRobot.CWeChatRobot.1'
VersionIndependentProgID = s 'WeChatRobot.CWeChatRobot'
ForceRemove Programmable
LocalServer32 = s '%MODULE%'
{
val ServerExecutable = s '%MODULE_RAW%'
}
TypeLib = s '{721abb35-141a-4aa2-94f2-762e2833fa6c}'
Version = s '1.0'
}
}
}
// WeChatRobotCOM.cpp: WinMain 的实现
#include "pch.h"
#include "framework.h"
#include "resource.h"
#include "WeChatRobotCOM_i.h"
#include "xdlldata.h"
using namespace ATL;
class CWeChatRobotCOMModule : public ATL::CAtlExeModuleT< CWeChatRobotCOMModule >
{
public :
DECLARE_LIBID(LIBID_WeChatRobotCOMLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_WECHATROBOTCOM, "{721abb35-141a-4aa2-94f2-762e2833fa6c}")
};
CWeChatRobotCOMModule _AtlModule;
//
extern "C" int WINAPI _tWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/,
LPTSTR /*lpCmdLine*/, int nShowCmd)
{
return _AtlModule.WinMain(nShowCmd);
}
// WeChatRobotCOM.idl: WeChatRobotCOM IDL
//
// 此文件将由 MIDL 工具处理以
// 生成类型库(WeChatRobotCOM.tlb)和封送处理代码。
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(a836e359-59b2-4e01-9b0c-0e5a5a2efa22),
dual,
nonextensible,
pointer_default(unique)
]
interface IWeChatRobot : IDispatch
{
[id(1)] HRESULT CStartRobotService([in] BSTR workPath, [out, retval] int* __result);
[id(2)] HRESULT CStopRobotService([out, retval] int* __result);
[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 CGetFriendList([out, retval] BSTR* __result);
};
[
uuid(721abb35-141a-4aa2-94f2-762e2833fa6c),
version(1.0),
]
library WeChatRobotCOMLib
{
importlib("stdole2.tlb");
[
uuid(4ce7f5e1-2c93-4bfe-86ac-886452e47475)
]
coclass WeChatRobot
{
[default] interface IWeChatRobot;
};
};
import "shobjidl.idl";
B// Microsoft Visual C++ generated resource script.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}</ProjectGuid>
<Keyword>AtlProj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>CWeChatRobot</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>WeChatRobotCOM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>WeChatRobotCOM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>WeChatRobotCOM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)WeChatRobotCOM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>WeChatRobotCOM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>WeChatRobotCOM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>WeChatRobotCOM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)WeChatRobotCOM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>WeChatRobotCOM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>WeChatRobotCOM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>WeChatRobotCOM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)WeChatRobotCOM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>WeChatRobotCOM_i.h</HeaderFileName>
<InterfaceIdentifierFileName>WeChatRobotCOM_i.c</InterfaceIdentifierFileName>
<ProxyFileName>WeChatRobotCOM_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)WeChatRobotCOM.tlb</TypeLibraryName>
<DllDataFileName />
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<RegisterOutput>true</RegisterOutput>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="FriendList.h" />
<ClInclude Include="InjertDll.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="robotdata.h" />
<ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" />
<ClInclude Include="SendText.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="WeChatRobot.h" />
<ClInclude Include="WeChatRobotCOM_i.h" />
<ClInclude Include="xdlldata.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="FriendList.cpp" />
<ClCompile Include="InjertDll.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" />
<ClCompile Include="SendText.cpp" />
<ClCompile Include="WeChatRobot.cpp" />
<ClCompile Include="WeChatRobotCOM.cpp" />
<ClCompile Include="WeChatRobotCOM_i.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="xdlldata.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="WeChatRobotCOM.rc" />
</ItemGroup>
<ItemGroup>
<None Include="WeChatRobot.rgs" />
<None Include="WeChatRobotCOM.rgs" />
</ItemGroup>
<ItemGroup>
<Midl Include="WeChatRobotCOM.idl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="生成的文件">
<UniqueIdentifier>{bbe1ba5c-e2d6-4aad-b97a-18ad64a9f157}</UniqueIdentifier>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
<Filter Include="注入工具">
<UniqueIdentifier>{2a494b07-1ec6-45c4-960c-09875429c485}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息">
<UniqueIdentifier>{9e0389a0-4ff4-40a5-8d6a-2c446d7c10b9}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送文本">
<UniqueIdentifier>{2f5b934c-6123-4271-880a-7e185fde0fee}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送图片">
<UniqueIdentifier>{99158de3-8221-42df-8b1f-eb3c7c383e20}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送文件">
<UniqueIdentifier>{eb0eba18-3b38-466c-8978-f7d0f2bb756e}</UniqueIdentifier>
</Filter>
<Filter Include="好友列表">
<UniqueIdentifier>{be3e55a9-dd57-4e92-a340-cb558f3cd4f7}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="xdlldata.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="WeChatRobotCOM_i.h">
<Filter>生成的文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="WeChatRobot.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="InjertDll.h">
<Filter>注入工具</Filter>
</ClInclude>
<ClInclude Include="SendImage.h">
<Filter>发送消息\发送图片</Filter>
</ClInclude>
<ClInclude Include="SendText.h">
<Filter>发送消息\发送文本</Filter>
</ClInclude>
<ClInclude Include="FriendList.h">
<Filter>好友列表</Filter>
</ClInclude>
<ClInclude Include="SendFile.h">
<Filter>发送消息\发送文件</Filter>
</ClInclude>
<ClInclude Include="robotdata.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="WeChatRobotCOM.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="xdlldata.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="WeChatRobotCOM_i.c">
<Filter>生成的文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="WeChatRobot.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="InjertDll.cpp">
<Filter>注入工具</Filter>
</ClCompile>
<ClCompile Include="SendImage.cpp">
<Filter>发送消息\发送图片</Filter>
</ClCompile>
<ClCompile Include="SendText.cpp">
<Filter>发送消息\发送文本</Filter>
</ClCompile>
<ClCompile Include="FriendList.cpp">
<Filter>好友列表</Filter>
</ClCompile>
<ClCompile Include="SendFile.cpp">
<Filter>发送消息\发送文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="WeChatRobotCOM.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="WeChatRobotCOM.rgs">
<Filter>资源文件</Filter>
</None>
<None Include="WeChatRobot.rgs">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Midl Include="WeChatRobotCOM.idl">
<Filter>源文件</Filter>
</Midl>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 8.01.0622 */
/* at Tue Jan 19 11:14:07 2038
*/
/* Compiler settings for WeChatRobotCOM.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif // !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_IWeChatRobot,0xa836e359,0x59b2,0x4e01,0x9b,0x0c,0x0e,0x5a,0x5a,0x2e,0xfa,0x22);
MIDL_DEFINE_GUID(IID, LIBID_WeChatRobotCOMLib,0x721abb35,0x141a,0x4aa2,0x94,0xf2,0x76,0x2e,0x28,0x33,0xfa,0x6c);
MIDL_DEFINE_GUID(CLSID, CLSID_WeChatRobot,0x4ce7f5e1,0x2c93,0x4bfe,0x86,0xac,0x88,0x64,0x52,0xe4,0x74,0x75);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0622 */
/* at Tue Jan 19 11:14:07 2038
*/
/* Compiler settings for WeChatRobotCOM.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __WeChatRobotCOM_i_h__
#define __WeChatRobotCOM_i_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IWeChatRobot_FWD_DEFINED__
#define __IWeChatRobot_FWD_DEFINED__
typedef interface IWeChatRobot IWeChatRobot;
#endif /* __IWeChatRobot_FWD_DEFINED__ */
#ifndef __WeChatRobot_FWD_DEFINED__
#define __WeChatRobot_FWD_DEFINED__
#ifdef __cplusplus
typedef class WeChatRobot WeChatRobot;
#else
typedef struct WeChatRobot WeChatRobot;
#endif /* __cplusplus */
#endif /* __WeChatRobot_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#include "shobjidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IWeChatRobot_INTERFACE_DEFINED__
#define __IWeChatRobot_INTERFACE_DEFINED__
/* interface IWeChatRobot */
/* [unique][nonextensible][dual][uuid][object] */
EXTERN_C const IID IID_IWeChatRobot;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a836e359-59b2-4e01-9b0c-0e5a5a2efa22")
IWeChatRobot : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CStartRobotService(
/* [in] */ BSTR workPath,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CStopRobotService(
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendText(
/* [in] */ BSTR wxid,
/* [in] */ BSTR wxmsg,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendImage(
/* [in] */ BSTR wxid,
/* [in] */ BSTR imagepath,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendFile(
/* [in] */ BSTR wxid,
/* [in] */ BSTR filepath,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CGetFriendList(
/* [retval][out] */ BSTR *__result) = 0;
};
#else /* C style interface */
typedef struct IWeChatRobotVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IWeChatRobot * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IWeChatRobot * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IWeChatRobot * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IWeChatRobot * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IWeChatRobot * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IWeChatRobot * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [range][in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IWeChatRobot * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CStartRobotService )(
IWeChatRobot * This,
/* [in] */ BSTR workPath,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CStopRobotService )(
IWeChatRobot * This,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendText )(
IWeChatRobot * This,
/* [in] */ BSTR wxid,
/* [in] */ BSTR wxmsg,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendImage )(
IWeChatRobot * This,
/* [in] */ BSTR wxid,
/* [in] */ BSTR imagepath,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendFile )(
IWeChatRobot * This,
/* [in] */ BSTR wxid,
/* [in] */ BSTR filepath,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CGetFriendList )(
IWeChatRobot * This,
/* [retval][out] */ BSTR *__result);
END_INTERFACE
} IWeChatRobotVtbl;
interface IWeChatRobot
{
CONST_VTBL struct IWeChatRobotVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IWeChatRobot_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IWeChatRobot_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IWeChatRobot_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IWeChatRobot_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IWeChatRobot_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IWeChatRobot_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IWeChatRobot_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IWeChatRobot_CStartRobotService(This,workPath,__result) \
( (This)->lpVtbl -> CStartRobotService(This,workPath,__result) )
#define IWeChatRobot_CStopRobotService(This,__result) \
( (This)->lpVtbl -> CStopRobotService(This,__result) )
#define IWeChatRobot_CSendText(This,wxid,wxmsg,__result) \
( (This)->lpVtbl -> CSendText(This,wxid,wxmsg,__result) )
#define IWeChatRobot_CSendImage(This,wxid,imagepath,__result) \
( (This)->lpVtbl -> CSendImage(This,wxid,imagepath,__result) )
#define IWeChatRobot_CSendFile(This,wxid,filepath,__result) \
( (This)->lpVtbl -> CSendFile(This,wxid,filepath,__result) )
#define IWeChatRobot_CGetFriendList(This,__result) \
( (This)->lpVtbl -> CGetFriendList(This,__result) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IWeChatRobot_INTERFACE_DEFINED__ */
#ifndef __WeChatRobotCOMLib_LIBRARY_DEFINED__
#define __WeChatRobotCOMLib_LIBRARY_DEFINED__
/* library WeChatRobotCOMLib */
/* [version][uuid] */
EXTERN_C const IID LIBID_WeChatRobotCOMLib;
EXTERN_C const CLSID CLSID_WeChatRobot;
#ifdef __cplusplus
class DECLSPEC_UUID("4ce7f5e1-2c93-4bfe-86ac-886452e47475")
WeChatRobot;
#endif
#endif /* __WeChatRobotCOMLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
unsigned long __RPC_USER BSTR_UserSize64( unsigned long *, unsigned long , BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal64( unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal64(unsigned long *, unsigned char *, BSTR * );
void __RPC_USER BSTR_UserFree64( unsigned long *, BSTR * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 8.01.0622 */
/* at Tue Jan 19 11:14:07 2038
*/
/* Compiler settings for WeChatRobotCOM.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_)
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning( disable: 4211 ) /* redefine extern to static */
#pragma warning( disable: 4232 ) /* dllimport identity*/
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */
#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
#pragma optimize("", off )
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 475
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif /* __RPCPROXY_H_VERSION__ */
#include "WeChatRobotCOM_i.h"
#define TYPE_FORMAT_STRING_SIZE 71
#define PROC_FORMAT_STRING_SIZE 259
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 1
typedef struct _WeChatRobotCOM_MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} WeChatRobotCOM_MIDL_TYPE_FORMAT_STRING;
typedef struct _WeChatRobotCOM_MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} WeChatRobotCOM_MIDL_PROC_FORMAT_STRING;
typedef struct _WeChatRobotCOM_MIDL_EXPR_FORMAT_STRING
{
long Pad;
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
} WeChatRobotCOM_MIDL_EXPR_FORMAT_STRING;
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
extern const WeChatRobotCOM_MIDL_TYPE_FORMAT_STRING WeChatRobotCOM__MIDL_TypeFormatString;
extern const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFormatString;
extern const WeChatRobotCOM_MIDL_EXPR_FORMAT_STRING WeChatRobotCOM__MIDL_ExprFormatString;
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IWeChatRobot_ServerInfo;
extern const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo;
extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ];
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT60_OR_LATER)
#error You need Windows Vista or later to run this stub because it uses these features:
#error forced complex structure or array, new range semantics, compiled for Windows Vista.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFormatString =
{
0,
{
/* Procedure CStartRobotService */
0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
/* 6 */ NdrFcShort( 0x7 ), /* 7 */
/* 8 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 10 */ NdrFcShort( 0x0 ), /* 0 */
/* 12 */ NdrFcShort( 0x24 ), /* 36 */
/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x3, /* 3 */
/* 16 */ 0x8, /* 8 */
0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 18 */ NdrFcShort( 0x0 ), /* 0 */
/* 20 */ NdrFcShort( 0x1 ), /* 1 */
/* 22 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter workPath */
/* 24 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 28 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */
/* 30 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 34 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 36 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 38 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 40 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CStopRobotService */
/* 42 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 44 */ NdrFcLong( 0x0 ), /* 0 */
/* 48 */ NdrFcShort( 0x8 ), /* 8 */
/* 50 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 52 */ NdrFcShort( 0x0 ), /* 0 */
/* 54 */ NdrFcShort( 0x24 ), /* 36 */
/* 56 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 58 */ 0x8, /* 8 */
0x41, /* Ext Flags: new corr desc, has range on conformance */
/* 60 */ NdrFcShort( 0x0 ), /* 0 */
/* 62 */ NdrFcShort( 0x0 ), /* 0 */
/* 64 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter __result */
/* 66 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 68 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 70 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 72 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 74 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 76 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CSendText */
/* 78 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 80 */ NdrFcLong( 0x0 ), /* 0 */
/* 84 */ NdrFcShort( 0x9 ), /* 9 */
/* 86 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
/* 88 */ NdrFcShort( 0x0 ), /* 0 */
/* 90 */ NdrFcShort( 0x24 ), /* 36 */
/* 92 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x4, /* 4 */
/* 94 */ 0x8, /* 8 */
0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 96 */ NdrFcShort( 0x0 ), /* 0 */
/* 98 */ NdrFcShort( 0x1 ), /* 1 */
/* 100 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter wxid */
/* 102 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 104 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 106 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter wxmsg */
/* 108 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 110 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 112 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */
/* 114 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 116 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 118 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 120 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 122 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 124 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CSendImage */
/* 126 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 128 */ NdrFcLong( 0x0 ), /* 0 */
/* 132 */ NdrFcShort( 0xa ), /* 10 */
/* 134 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
/* 136 */ NdrFcShort( 0x0 ), /* 0 */
/* 138 */ NdrFcShort( 0x24 ), /* 36 */
/* 140 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x4, /* 4 */
/* 142 */ 0x8, /* 8 */
0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 144 */ NdrFcShort( 0x0 ), /* 0 */
/* 146 */ NdrFcShort( 0x1 ), /* 1 */
/* 148 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter wxid */
/* 150 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 152 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 154 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter imagepath */
/* 156 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 158 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 160 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */
/* 162 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 164 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 166 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 168 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 170 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 172 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CSendFile */
/* 174 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 176 */ NdrFcLong( 0x0 ), /* 0 */
/* 180 */ NdrFcShort( 0xb ), /* 11 */
/* 182 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
/* 184 */ NdrFcShort( 0x0 ), /* 0 */
/* 186 */ NdrFcShort( 0x24 ), /* 36 */
/* 188 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x4, /* 4 */
/* 190 */ 0x8, /* 8 */
0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 192 */ NdrFcShort( 0x0 ), /* 0 */
/* 194 */ NdrFcShort( 0x1 ), /* 1 */
/* 196 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter wxid */
/* 198 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 200 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 202 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter filepath */
/* 204 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 206 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 208 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */
/* 210 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 212 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 214 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 216 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 218 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 220 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CGetFriendList */
/* 222 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 224 */ NdrFcLong( 0x0 ), /* 0 */
/* 228 */ NdrFcShort( 0xc ), /* 12 */
/* 230 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 232 */ NdrFcShort( 0x0 ), /* 0 */
/* 234 */ NdrFcShort( 0x8 ), /* 8 */
/* 236 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 238 */ 0x8, /* 8 */
0x43, /* Ext Flags: new corr desc, clt corr check, has range on conformance */
/* 240 */ NdrFcShort( 0x1 ), /* 1 */
/* 242 */ NdrFcShort( 0x0 ), /* 0 */
/* 244 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter __result */
/* 246 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 248 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 250 */ NdrFcShort( 0x3c ), /* Type Offset=60 */
/* Return value */
/* 252 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 254 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 256 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const WeChatRobotCOM_MIDL_TYPE_FORMAT_STRING WeChatRobotCOM__MIDL_TypeFormatString =
{
0,
{
NdrFcShort( 0x0 ), /* 0 */
/* 2 */
0x12, 0x0, /* FC_UP */
/* 4 */ NdrFcShort( 0x18 ), /* Offset= 24 (28) */
/* 6 */
0x1b, /* FC_CARRAY */
0x1, /* 1 */
/* 8 */ NdrFcShort( 0x2 ), /* 2 */
/* 10 */ 0x9, /* Corr desc: FC_ULONG */
0x0, /* */
/* 12 */ NdrFcShort( 0xfffc ), /* -4 */
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
/* 16 */ 0x0 ,
0x0, /* 0 */
/* 18 */ NdrFcLong( 0x0 ), /* 0 */
/* 22 */ NdrFcLong( 0x0 ), /* 0 */
/* 26 */ 0x6, /* FC_SHORT */
0x5b, /* FC_END */
/* 28 */
0x17, /* FC_CSTRUCT */
0x3, /* 3 */
/* 30 */ NdrFcShort( 0x8 ), /* 8 */
/* 32 */ NdrFcShort( 0xffe6 ), /* Offset= -26 (6) */
/* 34 */ 0x8, /* FC_LONG */
0x8, /* FC_LONG */
/* 36 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 38 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 40 */ NdrFcShort( 0x0 ), /* 0 */
/* 42 */ NdrFcShort( 0x4 ), /* 4 */
/* 44 */ NdrFcShort( 0x0 ), /* 0 */
/* 46 */ NdrFcShort( 0xffd4 ), /* Offset= -44 (2) */
/* 48 */
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
/* 50 */ 0x8, /* FC_LONG */
0x5c, /* FC_PAD */
/* 52 */
0x11, 0x4, /* FC_RP [alloced_on_stack] */
/* 54 */ NdrFcShort( 0x6 ), /* Offset= 6 (60) */
/* 56 */
0x13, 0x0, /* FC_OP */
/* 58 */ NdrFcShort( 0xffe2 ), /* Offset= -30 (28) */
/* 60 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 62 */ NdrFcShort( 0x0 ), /* 0 */
/* 64 */ NdrFcShort( 0x4 ), /* 4 */
/* 66 */ NdrFcShort( 0x0 ), /* 0 */
/* 68 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (56) */
0x0
}
};
static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] =
{
{
BSTR_UserSize
,BSTR_UserMarshal
,BSTR_UserUnmarshal
,BSTR_UserFree
}
};
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDispatch, ver. 0.0,
GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IWeChatRobot, ver. 0.0,
GUID={0xa836e359,0x59b2,0x4e01,{0x9b,0x0c,0x0e,0x5a,0x5a,0x2e,0xfa,0x22}} */
#pragma code_seg(".orpc")
static const unsigned short IWeChatRobot_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
42,
78,
126,
174,
222
};
static const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo =
{
&Object_StubDesc,
WeChatRobotCOM__MIDL_ProcFormatString.Format,
&IWeChatRobot_FormatStringOffsetTable[-3],
0,
0,
0
};
static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo =
{
&Object_StubDesc,
0,
WeChatRobotCOM__MIDL_ProcFormatString.Format,
&IWeChatRobot_FormatStringOffsetTable[-3],
0,
0,
0,
0};
CINTERFACE_PROXY_VTABLE(13) _IWeChatRobotProxyVtbl =
{
&IWeChatRobot_ProxyInfo,
&IID_IWeChatRobot,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* IDispatch::GetTypeInfoCount */ ,
0 /* IDispatch::GetTypeInfo */ ,
0 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CStartRobotService */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CStopRobotService */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendText */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendImage */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendFile */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CGetFriendList */
};
static const PRPC_STUB_FUNCTION IWeChatRobot_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _IWeChatRobotStubVtbl =
{
&IID_IWeChatRobot,
&IWeChatRobot_ServerInfo,
13,
&IWeChatRobot_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
WeChatRobotCOM__MIDL_TypeFormatString.Format,
1, /* -error bounds_check flag */
0x60001, /* Ndr library version */
0,
0x801026e, /* MIDL Version 8.1.622 */
0,
UserMarshalRoutines,
0, /* notify & notify_flag routine table */
0x1, /* MIDL flag */
0, /* cs routines */
0, /* proxy/server info */
0
};
const CInterfaceProxyVtbl * const _WeChatRobotCOM_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IWeChatRobotProxyVtbl,
0
};
const CInterfaceStubVtbl * const _WeChatRobotCOM_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IWeChatRobotStubVtbl,
0
};
PCInterfaceName const _WeChatRobotCOM_InterfaceNamesList[] =
{
"IWeChatRobot",
0
};
const IID * const _WeChatRobotCOM_BaseIIDList[] =
{
&IID_IDispatch,
0
};
#define _WeChatRobotCOM_CHECK_IID(n) IID_GENERIC_CHECK_IID( _WeChatRobotCOM, pIID, n)
int __stdcall _WeChatRobotCOM_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_WeChatRobotCOM_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo WeChatRobotCOM_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _WeChatRobotCOM_ProxyVtblList,
(PCInterfaceStubVtblList *) & _WeChatRobotCOM_StubVtblList,
(const PCInterfaceName * ) & _WeChatRobotCOM_InterfaceNamesList,
(const IID ** ) & _WeChatRobotCOM_BaseIIDList,
& _WeChatRobotCOM_IID_Lookup,
1,
2,
0, /* table of [async_uuid] interfaces */
0, /* Filler1 */
0, /* Filler2 */
0 /* Filler3 */
};
#pragma optimize("", on )
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif /* !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) */
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( WeChatRobotCOM )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( WeChatRobotCOM ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
DWORD SendImageOffset = 0x0;
DWORD SendTextOffset = 0x0;
DWORD SendFileOffset = 0x0;
DWORD GetFriendListInitOffset = 0x0;
DWORD GetFriendListRemoteOffset = 0x0;
DWORD GetFriendListFinishOffset = 0x0;
HANDLE hProcess = NULL;
bool isFileExists_stat(string& name) {
struct stat buffer;
return (stat(name.c_str(), &buffer) == 0);
}
BOOL CreateConsole(void) {
if (AllocConsole()) {
AttachConsole(GetCurrentProcessId());
FILE* retStream;
freopen_s(&retStream, "CONOUT$", "w", stdout);
if (!retStream) throw std::runtime_error("Stdout redirection failed.");
freopen_s(&retStream, "CONOUT$", "w", stderr);
if (!retStream) throw std::runtime_error("Stderr redirection failed.");
return 0;
}
return 1;
}
DWORD GetWeChatRobotBase() {
if (!hProcess)
return 0;
DWORD dwWriteSize = 0;
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
if (pRemoteAddress)
WriteProcessMemory(hProcess, pRemoteAddress, dllname, wcslen(dllname) * 2 + 2, &dwWriteSize);
else
return 0;
DWORD dwHandle, dwID;
LPVOID pFunc = GetModuleHandleW;
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, pRemoteAddress, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &dwHandle);
}
else {
return 0;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
return dwHandle;
}
void GetProcOffset(wchar_t* workPath) {
wchar_t* dllpath = new wchar_t[MAX_PATH];
swprintf_s(dllpath, MAX_PATH, L"%ws%ws%ws", workPath, L"\\", dllname);
string name = _com_util::ConvertBSTRToString((BSTR)dllpath);
if (!isFileExists_stat(name)) {
MessageBoxA(NULL, name.c_str(), "文件不存在", MB_ICONWARNING);
return;
}
HMODULE hd = LoadLibraryW(dllpath);
if (!hd)
return;
DWORD WeChatBase = (DWORD)GetModuleHandleW(dllname);
DWORD SendImageProcAddr = (DWORD)GetProcAddress(hd, SendImageRemote);
SendImageOffset = SendImageProcAddr - WeChatBase;
DWORD SendTextProcAddr = (DWORD)GetProcAddress(hd, SendTextRemote);
SendTextOffset = SendTextProcAddr - WeChatBase;
DWORD SendFileProcAddr = (DWORD)GetProcAddress(hd, SendFileRemote);
SendFileOffset = SendFileProcAddr - WeChatBase;
DWORD GetFriendListInitProcAddr = (DWORD)GetProcAddress(hd, GetFriendListInit);
GetFriendListInitOffset = GetFriendListInitProcAddr - WeChatBase;
DWORD GetFriendListRemoteProcAddr = (DWORD)GetProcAddress(hd, GetFriendListRemote);
GetFriendListRemoteOffset = GetFriendListRemoteProcAddr - WeChatBase;
DWORD GetFriendListFinishProcAddr = (DWORD)GetProcAddress(hd, GetFriendListFinish);
GetFriendListFinishOffset = GetFriendListFinishProcAddr - WeChatBase;
FreeLibrary(hd);
delete[] dllpath;
dllpath = NULL;
}
DWORD GetWeChatPid() {
HWND hCalc = FindWindow(NULL, L"微信");
DWORD wxPid = 0;
GetWindowThreadProcessId(hCalc, &wxPid);
if (wxPid == 0) {
hCalc = FindWindow(NULL, L"微信测试版");
GetWindowThreadProcessId(hCalc, &wxPid);
}
return wxPid;
}
DWORD StartRobotService(wchar_t* workPath) {
DWORD wxPid = GetWeChatPid();
if (!wxPid) {
MessageBoxA(NULL, "请先启动目标程序", "提示", MB_ICONWARNING);
return 1;
}
GetProcOffset(workPath);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, wxPid);
bool status = Injert(wxPid, workPath);
return status;
}
DWORD StopRobotService() {
if (!hProcess)
return 1;
DWORD wxPid = GetWeChatPid();
RemoveDll(wxPid);
CloseHandle(hProcess);
return 0;
}
\ No newline at end of file
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#pragma once
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H
#include <iostream>
#include "stdlib.h"
#include <tchar.h>
#include <stdio.h>
#include <windows.h>
#include <TlHelp32.h>
#include <atlconv.h>
#include <tchar.h>
#include <sys/stat.h>
#include <direct.h>
#include <comutil.h>
#pragma comment(lib, "comsuppw.lib")
#include "robotdata.h"
using namespace std;
bool isFileExists_stat(string& name);
DWORD GetWeChatRobotBase();
DWORD GetWeChatPid();
DWORD StartRobotService(wchar_t* workPath);
DWORD StopRobotService();
BOOL CreateConsole(void);
\ No newline at end of file
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 WeChatRobotCOM.rc 使用
//
#define IDS_PROJNAME 100
#define IDR_WECHATROBOTCOM 101
#define IDR_WECHATROBOT 106
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 107
#endif
#endif
#pragma once
#include "InjertDll.h"
#include "SendImage.h"
#include "SendText.h"
#include "SendFile.h"
#include "FriendList.h"
extern HANDLE hProcess;
extern DWORD SendImageOffset;
extern DWORD SendTextOffset;
extern DWORD SendFileOffset;
extern DWORD GetFriendListInitOffset;
extern DWORD GetFriendListRemoteOffset;
extern DWORD GetFriendListFinishOffset;
#define dllname L"DWeChatRobot.dll"
#define SendTextRemote "SendTextRemote"
#define SendImageRemote "SendImageRemote"
#define SendFileRemote "SendFileRemote"
#define GetFriendListInit "GetFriendListInit"
#define GetFriendListRemote "GetFriendListRemote"
#define GetFriendListFinish "GetFriendListFinish"
\ No newline at end of file
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>
// dlldata.c 的包装器
#ifdef _MERGE_PROXYSTUB // 合并代理存根(stub) DLL
#define REGISTER_PROXY_DLL //DllRegisterServer 等
#define USE_STUBLESS_PROXY //仅当使用 MIDL 开关 /Oicf 时定义
#pragma comment(lib, "rpcns4.lib")
#pragma comment(lib, "rpcrt4.lib")
#define ENTRY_PREFIX Prx
#include "dlldata.c"
#include "WeChatRobotCOM_p.c"
#endif //_MERGE_PROXYSTUB
#pragma once
#ifdef _MERGE_PROXYSTUB
extern "C"
{
BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason,
LPVOID lpReserved);
STDAPI PrxDllCanUnloadNow(void);
STDAPI PrxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
STDAPI PrxDllRegisterServer(void);
STDAPI PrxDllUnregisterServer(void);
}
#endif

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31605.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CWeChatRobot", "CWeChatRobot\WeChatRobotCOM.vcxproj", "{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DWeChatRobot", "DWeChatRobot\DWeChatRobot.vcxproj", "{7EDE81C4-63BC-4C4F-8424-210D91034FDE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WeChatTools", "WeChatTools\WeChatTools.vcxproj", "{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Debug|x64.ActiveCfg = Debug|x64
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Debug|x64.Build.0 = Debug|x64
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Debug|x86.ActiveCfg = Debug|Win32
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Debug|x86.Build.0 = Debug|Win32
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x64.ActiveCfg = Release|x64
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x64.Build.0 = Release|x64
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x86.ActiveCfg = Release|Win32
{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x86.Build.0 = Release|Win32
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.ActiveCfg = Debug|x64
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.Build.0 = Debug|x64
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.ActiveCfg = Debug|Win32
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.Build.0 = Debug|Win32
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.ActiveCfg = Release|x64
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.Build.0 = Release|x64
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.ActiveCfg = Release|Win32
{7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.Build.0 = Release|Win32
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x64.ActiveCfg = Debug|x64
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x64.Build.0 = Debug|x64
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x86.ActiveCfg = Debug|Win32
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x86.Build.0 = Debug|Win32
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x64.ActiveCfg = Release|x64
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x64.Build.0 = Release|x64
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x86.ActiveCfg = Release|Win32
{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {20BD2B3B-13AA-4C38-8216-127895041F93}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{7ede81c4-63bc-4c4f-8424-210d91034fde}</ProjectGuid>
<RootNamespace>MyWeChatRobot</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>DWeChatRobot</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="FriendList.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="SaveGif.h" />
<ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" />
<ClInclude Include="SendText.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FriendList.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SaveGif.cpp" />
<ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" />
<ClCompile Include="SendText.cpp" />
<ClCompile Include="showFriendList.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="通用标头">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="通用函数">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="发送消息">
<UniqueIdentifier>{b1463ca2-6055-4c67-8c42-6319a6171dd2}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送图片">
<UniqueIdentifier>{b22823ee-f629-4e0a-8358-da017f0e5c3a}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送文本">
<UniqueIdentifier>{912e6334-b078-4ba6-813c-66d0de3ee123}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送文件">
<UniqueIdentifier>{069b8c09-e473-4bba-a49e-571f35f2efef}</UniqueIdentifier>
</Filter>
<Filter Include="好友列表">
<UniqueIdentifier>{24dc11dd-cb6a-4c63-bf21-35823cd389ab}</UniqueIdentifier>
</Filter>
<Filter Include="自动功能">
<UniqueIdentifier>{25f77de8-b12c-4f2b-a3ac-0260b6a16897}</UniqueIdentifier>
</Filter>
<Filter Include="自动功能\聊天表情">
<UniqueIdentifier>{166b9e01-bc1c-4366-abcf-c14ec3fbbfb1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>通用标头</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>通用标头</Filter>
</ClInclude>
<ClInclude Include="SendImage.h">
<Filter>发送消息\发送图片</Filter>
</ClInclude>
<ClInclude Include="SendText.h">
<Filter>发送消息\发送文本</Filter>
</ClInclude>
<ClInclude Include="SendFile.h">
<Filter>发送消息\发送文件</Filter>
</ClInclude>
<ClInclude Include="FriendList.h">
<Filter>好友列表</Filter>
</ClInclude>
<ClInclude Include="SaveGif.h">
<Filter>自动功能\聊天表情</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>通用函数</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>通用函数</Filter>
</ClCompile>
<ClCompile Include="SendImage.cpp">
<Filter>发送消息\发送图片</Filter>
</ClCompile>
<ClCompile Include="SendText.cpp">
<Filter>发送消息\发送文本</Filter>
</ClCompile>
<ClCompile Include="SendFile.cpp">
<Filter>发送消息\发送文件</Filter>
</ClCompile>
<ClCompile Include="FriendList.cpp">
<Filter>好友列表</Filter>
</ClCompile>
<ClCompile Include="SaveGif.cpp">
<Filter>自动功能\聊天表情</Filter>
</ClCompile>
<ClCompile Include="showFriendList.cpp">
<Filter>好友列表</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
#include "pch.h"
#include <vector>
using namespace std;
#define LeftTreeOffset 0x21DD240
struct WxFriendStructW {
DWORD wxIdAddr;
DWORD wxNumberAddr;
DWORD wxNickNameAddr;
DWORD wxRemarkAddr;
WxFriendStructW(DWORD wxIdAddr, DWORD wxNumberAddr, DWORD wxNickNameAddr, DWORD wxRemarkAddr) {
this->wxIdAddr = wxIdAddr;
this->wxNumberAddr = wxNumberAddr;
this->wxNickNameAddr = wxNickNameAddr;
this->wxRemarkAddr = wxRemarkAddr;
}
};
vector<WxFriendStructW> WxFriendList;
int GetFriendListInit() {
GetFriendList();
#ifdef _DEBUG
cout << WxFriendList.size() << endl;
#endif
return WxFriendList.size();
}
DWORD GetFriendListRemote(int index) {
if (WxFriendList.size() <= (unsigned int)index)
return 0;
#ifdef _DEBUG
printf("0x%08X\n", (DWORD)&WxFriendList[index]);
printf("0x%08X\n", (DWORD)&(WxFriendList[index].wxIdAddr));
#endif
return (DWORD)&WxFriendList[index].wxIdAddr;
}
void GetFriendListFinish() {
WxFriendList.clear();
cout << WxFriendList.size() << endl;
}
void __stdcall GetFriendList() {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD LeftTreeAddr = 0;
DWORD RightTreeAddr = 0;
DWORD LeftTreeHead = 0;
DWORD baseAddr = WeChatWinBase + LeftTreeOffset;
__asm {
pushad;
mov eax, dword ptr[baseAddr];
mov eax, dword ptr[eax];
mov eax, dword ptr[eax + 0x4C];
mov ecx, dword ptr[eax];
mov LeftTreeAddr, ecx;
mov LeftTreeHead, eax;
mov ecx, dword ptr[eax + 0x4];
mov RightTreeAddr, ecx;
popad;
}
while (1) {
DWORD wxIdAddr = 0;
DWORD wxNumberAddr = 0;
DWORD wxNickNameAddr = 0;
DWORD wxRemarkAddr = 0;
__asm {
pushad;
mov eax, dword ptr [LeftTreeAddr];
mov ecx, eax;
add ecx, 0x30;
mov wxIdAddr, ecx;
mov ecx, eax;
add ecx, 0x44;
mov wxNumberAddr, ecx;
mov ecx, eax;
add ecx, 0x8C;
mov wxNickNameAddr, ecx;
mov ecx, eax;
add ecx, 0x78;
mov wxRemarkAddr, ecx;
mov ecx, dword ptr [eax];
mov LeftTreeAddr, ecx;
popad;
}
WxFriendStructW p(wxIdAddr, wxNumberAddr, wxNickNameAddr, wxRemarkAddr);
WxFriendList.push_back(p);
if (LeftTreeAddr == LeftTreeHead) {
break;
}
}
}
\ No newline at end of file
#pragma once
void __stdcall GetFriendList();
extern "C" __declspec(dllexport) DWORD GetFriendListRemote(int index);
extern "C" __declspec(dllexport) int GetFriendListInit();
extern "C" __declspec(dllexport) void GetFriendListFinish();
\ No newline at end of file
#include "pch.h"
#include <direct.h>
#include <io.h>
/*
Executable modules, 条目 126
基址=78BD0000
大小=02624000 (39993344.)
入口=7A0FC59D WeChatWi.<模块入口点>
名称=WeChatWi
文件版本=3.5.0.46
路径=D:\Tencent\WeChat\[3.5.0.46]\WeChatWin.dll
78FC8980 E8 FB730000 call 78FCFD80 ; 表情位置:eax-3C,大小:eax-48
*/
#define SaveGifHookOffset (0x5D9A2E83 - 0x5D5B0000)
#define NextCallOffset (0x5D9A8910 - 0x5D5B0000)
CHAR originalRecieveCode[5] = { 0 };
BYTE bjmpcode[5] = { 0 };
DWORD SaveGifHookAddress = GetWeChatWinBase() + SaveGifHookOffset;
DWORD dwReternAddress = GetWeChatWinBase() + SaveGifHookOffset + 5;
DWORD NextCallAddr = GetWeChatWinBase() + NextCallOffset;
bool SaveGifHooked = false;
void __declspec(naked) ExtractExpression()
{
__asm
{
pushad;
push eax;
call OutputExpression;
popad;
call NextCallAddr;
//跳回返回地址
jmp dwReternAddress;
}
}
void HookExtractExpression()
{
HookAnyAddress(SaveGifHookAddress, ExtractExpression,originalRecieveCode);
SaveGifHooked = true;
}
void CreateDir(const char* dir)
{
int m = 0, n;
string str1, str2;
str1 = dir;
str2 = str1.substr(0, 2);
str1 = str1.substr(3, str1.size());
while (m >= 0)
{
m = str1.find('\\');
str2 += '\\' + str1.substr(0, m);
n = _access(str2.c_str(), 0); //判断该目录是否存在
if (n == -1)
{
int status = _mkdir(str2.c_str()); //创建目录
}
str1 = str1.substr(m + 1, str1.size());
}
}
void CreateFileWithCurrentTime(char* filedir, char* filepostfix, DWORD filedata, DWORD filedatalen)
{
//获取当前时间作为文件名
time_t rawtime;
struct tm* ptminfo = new struct tm;
time(&rawtime);
localtime_s(ptminfo, &rawtime);
char currenttime[30] = { 0 };
sprintf_s(currenttime, "%02d%02d%02d%02d%02d%02d", ptminfo->tm_year + 1900,
ptminfo->tm_mon + 1, ptminfo->tm_mday, ptminfo->tm_hour, ptminfo->tm_min, ptminfo->tm_sec);
//拼接完整的路径
char filepath[MAX_PATH] = { 0 };
sprintf_s(filepath, "%s%s%s", filedir, currenttime, filepostfix);
//创建文件
HANDLE hFile = CreateFileA(filepath, GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
MessageBoxA(NULL, "创建文件失败", "错误", 0);
return;
}
//写入文件
DWORD dwWrite = 0;
WriteFile(hFile, (LPCVOID)filedata, filedatalen, &dwWrite, 0);
//关闭句柄
CloseHandle(hFile);
}
void __stdcall OutputExpression(DWORD dwExpressionAddr)
{
//取出图片长度
DWORD dwImageLen = *((DWORD*)(dwExpressionAddr + 0x4));
//取出图片内容
DWORD dwImage = *((DWORD*)(dwExpressionAddr));
if (dwImageLen == 0) {
return;
}
unsigned char magic_head[4] = { 0 };
char postfix[5] = { 0 };
memcpy(magic_head, (void*)dwImage, 3);
//根据MAGIC头判断后缀
if (magic_head[0] == 137 && magic_head[1] == 80 && magic_head[2] == 78)
{
strcpy_s(postfix, 5, ".png");
}
else if (magic_head[0] == 71 && magic_head[1] == 73 && magic_head[2] == 70)
{
strcpy_s(postfix, 5, ".gif");
}
else if (magic_head[0] == 255 && magic_head[1] == 216 && magic_head[2] == 255)
{
strcpy_s(postfix, 5, ".jpg");
}
//获取临时文件夹目录
char temppath[MAX_PATH] = { 0 };
GetTempPathA(MAX_PATH, temppath);
char imagedir[25] = { "WeChatRecordExpressions" };
//拼接存放微信表情的目录
char WeChatExpressionsPath[MAX_PATH] = { 0 };
sprintf_s(WeChatExpressionsPath, "%s%s\\", temppath, imagedir);
//创建目录存放图片
CreateDir(WeChatExpressionsPath);
//保存表情图片
CreateFileWithCurrentTime(WeChatExpressionsPath, postfix, dwImage, dwImageLen);
}
void UnHookExtractExpression()
{
// 回复被覆盖的指令
if (!SaveGifHooked)
return;
UnHookAnyAddress(SaveGifHookAddress, originalRecieveCode);
PostMessage(HWND_BROADCAST, NULL, 0, 0);
SaveGifHooked = false;
}
\ No newline at end of file
#pragma once
#include <windows.h>
extern "C" __declspec(dllexport) void HookExtractExpression();
void __stdcall OutputExpression(DWORD dwExpressionAddr);
void UnHookExtractExpression();
\ No newline at end of file
#include "pch.h"
#define WxSendFileCall1Offset (0x0FD68420 - 0x0F690000)
#define WxSendFileCall2Offset (0x11064BE3 - 0x0F690000)
#define WxSendFileCall3Offset (0x110633DA - 0x0F690000)
#define WxSendFileCall4Offset (0x0FA07B20 - 0x0F690000)
#define WxSendFileParamsOffset (0x5294CFF0 - 0x50770000)
struct FileParamStruct {
DWORD wxid;
DWORD filepath;
};
struct WxFileStruct {
int type = 3;
wchar_t* buffer;
DWORD length;
DWORD maxLength;
char fill[0x34] = { 0 };
WxFileStruct(wchar_t* pStr) {
buffer = pStr;
length = wcslen(pStr);
maxLength = wcslen(pStr) * 2;
}
};
void SendFileRemote(LPVOID lpParamStruct) {
FileParamStruct* params = (FileParamStruct*)lpParamStruct;
SendFile((WCHAR*)params->wxid, (WCHAR*)params->filepath);
}
void __stdcall SendFile(wchar_t* receiver, wchar_t* FilePath) {
WxBaseStruct pReceiver(receiver);
WxBaseStruct pFilePath(FilePath);
WxFileStruct esi_(FilePath);
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD WxSendFileCall1 = WeChatWinBase + WxSendFileCall1Offset;
DWORD WxSendFileCall2 = WeChatWinBase + WxSendFileCall2Offset;
DWORD WxSendFileCall3 = WeChatWinBase + WxSendFileCall3Offset;
DWORD WxSendFileCall4 = WeChatWinBase + WxSendFileCall4Offset;
DWORD WxSendFileParams = WeChatWinBase + WxSendFileParamsOffset;
char buffer[0x3A8] = { 0 };
DWORD edi_ = pReceiver.length;
DWORD ptrReceiver = (DWORD)pReceiver.buffer;
DWORD tempecx = 0;
__asm {
pushad;
pushfd;
lea esi, esi_;
push 0;
push 0;
push 0;
push 0;
push 0;
push 0x00700000;
sub esp, 0x14;
mov edi, esp;
mov dword ptr ds : [edi] , 0x0;
mov dword ptr ds : [edi + 0x4] , 0x0;
mov dword ptr ds : [edi + 0x8] , 0x0;
mov dword ptr ds : [edi + 0xC] , 0x0;
mov dword ptr ds : [edi + 0x10] , 0x0;
sub esp, 0x14;
lea eax, dword ptr ds : [esi + 0x4] ;
mov ecx, esp;
push eax;
call WxSendFileCall1;
sub esp, 0x14;
mov ecx, esp;
mov dword ptr ds : [ecx] , 0x0;
mov dword ptr ds : [ecx + 0x4] , 0x0;
mov dword ptr ds : [ecx + 0x8] , 0x0;
mov dword ptr ds : [ecx + 0xC] , 0x0;
mov dword ptr ds : [ecx + 0x10] , 0x0;
lea edx, pReceiver;
mov eax, [edx];
mov edi, edi_;
lea eax, dword ptr ds : [edi * 2 + 0x2] ;
mov tempecx, ecx;
push eax;
push dword ptr ds : [ecx] ;
call WxSendFileCall2;
mov ecx, [tempecx];
mov edx, eax;
add esp, 0x8;
mov eax, dword ptr ds : [ecx + 0x4] ;
mov dword ptr ds : [ecx] , edx;
mov dword ptr ds : [ecx + 0x8] , edi;
mov tempecx, ecx;
push edi;
push ptrReceiver;
push dword ptr ds : [ecx] ;
call WxSendFileCall3;
mov ecx, [tempecx];
add esp, 0xC;
mov edx, 0x0;
mov eax, dword ptr ds : [ecx] ;
mov word ptr ds : [eax + edi * 2] , 0x0;
mov dword ptr ds : [ecx + 0x4] , edi;
mov ecx, WxSendFileParams;
lea eax, buffer;
push eax;
call WxSendFileCall4;
popfd;
popad;
}
}
\ No newline at end of file
#pragma once
#include<windows.h>
void __stdcall SendFile(wchar_t* receiver, wchar_t* FilePath);
extern "C" __declspec(dllexport) void SendFileRemote(LPVOID lpParamStruct);
\ No newline at end of file
#include "pch.h"
/*
Executable modules, 条目 128
基址=02E50000
大小=02624000 (39993344.)
入口=0437C59D WeChatWi.<模块入口点>
名称=WeChatWi
文件版本=3.5.0.46
路径=D:\Tencent\WeChat\[3.5.0.46]\WeChatWin.dll
02FB4485 E8 D696F2FF call 02EDDB60
02FB448A 83EC 14 sub esp, 14
02FB448D 8945 B0 mov dword ptr [ebp-50], eax
02FB4490 8D46 18 lea eax, dword ptr [esi+18]
02FB4493 8BCC mov ecx, esp
02FB4495 8D7E 04 lea edi, dword ptr [esi+4] ; 图片路径
02FB4498 50 push eax
02FB4499 E8 823F5700 call 03528420
02FB449E 8B4D B0 mov ecx, dword ptr [ebp-50]
02FB44A1 8D85 7CFFFFFF lea eax, dword ptr [ebp-84]
02FB44A7 57 push edi ; 图片路径
02FB44A8 50 push eax ; 接收人wxid
02FB44A9 8D85 58FCFFFF lea eax, dword ptr [ebp-3A8]
02FB44AF 50 push eax ; 缓冲区,存放xml数据
02FB44B0 E8 DB713300 call 032EB690 ; 发送图片的CALL
*/
#define WxSendImageCall1offset (0x02EDDB60 - 0x02E50000)
#define WxSendImageCall2offset (0x03528420 - 0x02E50000)
#define WxSendImageCall3offset (0x032EB690 - 0x02E50000)
struct ImageParamStruct {
DWORD wxid;
DWORD imagepath;
};
void SendImageRemote(LPVOID lpParamStruct) {
ImageParamStruct* params = (ImageParamStruct*)lpParamStruct;
SendImage((WCHAR*)params->wxid, (WCHAR*)params->imagepath);
}
void __stdcall SendImage(wchar_t* receiver, wchar_t* ImagePath) {
DWORD WxSendImageCall1 = GetWeChatWinBase() + WxSendImageCall1offset;
DWORD WxSendImageCall2 = GetWeChatWinBase() + WxSendImageCall2offset;
DWORD WxSendImageCall3 = GetWeChatWinBase() + WxSendImageCall3offset;
char nullbuffer[0x50] = { 0 };
char buffer[0x3A8] = { 0 };
WxBaseStruct pReceiver(receiver);
WxBaseStruct pImagePath(ImagePath);
__asm {
pushad;
call WxSendImageCall1;
sub esp, 0x14;
mov dword ptr[ebp - 0x50], eax;
mov ecx, esp;
lea edi, pImagePath;
push eax;
call WxSendImageCall2;
mov ecx, dword ptr[ebp - 0x50];
lea eax, pReceiver;
push edi;
push eax;
lea eax, buffer;
push eax;
call WxSendImageCall3;
popad;
}
}
\ No newline at end of file
#pragma once
#include<windows.h>
void __stdcall SendImage(wchar_t* receiver, wchar_t* ImagePath);
extern "C" __declspec(dllexport) void SendImageRemote(LPVOID lpParamStruct);
\ No newline at end of file
#include "pch.h"
/*
WeChatWin.dll: 0x78670000
787D42EE 8D46 38 lea eax, dword ptr [esi+38] ; 取at结构体
787D42F1 6A 01 push 1 ; 0x1
787D42F3 50 push eax ; 群消息at好友,非at消息为0
787D42F4 57 push edi ; 消息内容,[edi]
787D42F5 8D95 7CFFFFFF lea edx, dword ptr [ebp-84] ; 接收人,[edx]
787D42FB 8D8D 58FCFFFF lea ecx, dword ptr [ebp-3A8] ; 缓冲区,据说是类本身
787D4301 E8 7A793300 call 78B0BC80 ; 发送消息CALL
787D4306 83C4 0C add esp, 0C ; 平衡堆栈
*/
#define SendTextCallOffset 0x49BC80;
struct SendTextStruct
{
DWORD wxid;
DWORD wxmsg;
};
void SendTextRemote(LPVOID lpParameter) {
SendTextStruct* rp = (SendTextStruct*)lpParameter;
wchar_t* wsWxId = (WCHAR*)rp->wxid;
wchar_t* wsTextMsg = (WCHAR*)rp->wxmsg;
SendText(wsWxId, wsTextMsg);
}
void __stdcall SendText(wchar_t* wsWxId, wchar_t* wsTextMsg) {
WxBaseStruct wxWxid(wsWxId);
WxBaseStruct wxTextMsg(wsTextMsg);
wchar_t** pWxmsg = &wxTextMsg.buffer;
char buffer[0x3A8] = { 0 };
WxString wxNull = { 0 };
DWORD dllBaseAddress = GetWeChatWinBase();
DWORD callAddress = dllBaseAddress + SendTextCallOffset;
__asm {
lea eax, wxNull;
push 0x1;
push eax;
mov edi, pWxmsg;
push edi;
lea edx, wxWxid;
lea ecx, buffer;
call callAddress;
add esp, 0xC;
}
}
\ No newline at end of file
#pragma once
#include<windows.h>
void __stdcall SendText(wchar_t* wsWxId, wchar_t* wsTextMsg);
extern "C" __declspec(dllexport) void SendTextRemote(LPVOID lpParameter);
\ No newline at end of file
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#ifdef _DEBUG
int detach_count = 0;
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
#ifdef _DEBUG
CreateConsole();
DWORD base = (DWORD)GetModuleHandleA("MyWeChatRobot.dll");
printf("SendImage 0x%08X\n", (DWORD)SendImage);
printf("SendText 0x%08X\n", (DWORD)SendText);
printf("SendFile 0x%08X\n", (DWORD)SendFile);
printf("GetFriendList 0x%08X\n", (DWORD)GetFriendList);
printf("HookExtractExpression 0x%08X\n", (DWORD)HookExtractExpression);
#endif
break;
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH: {
#ifdef _DEBUG
detach_count++;
if (detach_count != 1) {
FreeConsole();
UnHookAll();
}
#endif
break;
}
}
return TRUE;
}
#pragma once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
BOOL CreateConsole(void) {
if (AllocConsole()) {
AttachConsole(GetCurrentProcessId());
FILE* retStream;
freopen_s(&retStream, "CONOUT$", "w", stdout);
if (!retStream) throw std::runtime_error("Stdout redirection failed.");
freopen_s(&retStream, "CONOUT$", "w", stderr);
if (!retStream) throw std::runtime_error("Stderr redirection failed.");
return 0;
}
return 1;
}
DWORD GetWeChatWinBase() {
return (DWORD)GetModuleHandleA("WeChatWin.dll");
}
void Wchar_tToString(std::string& szDst, wchar_t* wchar)
{
wchar_t* wText = wchar;
DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, NULL, 0, NULL, FALSE);// WideCharToMultiByte的运用
char* psText; // psText为char*的临时数组,作为赋值给std::string的中间变量
psText = new char[dwNum];
WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, psText, dwNum, NULL, FALSE);// WideCharToMultiByte的再次运用
szDst = psText;// std::string赋值
delete[]psText;// psText的清除
}
void HookAnyAddress(DWORD dwHookAddr, LPVOID dwJmpAddress,char* originalRecieveCode)
{
//组装跳转数据
BYTE jmpCode[5] = { 0 };
jmpCode[0] = 0xE9;
//计算偏移
*(DWORD*)&jmpCode[1] = (DWORD)dwJmpAddress - dwHookAddr - 5;
// 保存以前的属性用于还原
DWORD OldProtext = 0;
// 因为要往代码段写入数据,又因为代码段是不可写的,所以需要修改属性
VirtualProtect((LPVOID)dwHookAddr, 5, PAGE_EXECUTE_READWRITE, &OldProtext);
ReadProcessMemory(GetCurrentProcess(), (LPVOID)dwHookAddr, originalRecieveCode, 5, 0);
//写入自己的代码
memcpy((void*)dwHookAddr, jmpCode, 5);
// 执行完了操作之后需要进行还原
VirtualProtect((LPVOID)dwHookAddr, 5, OldProtext, &OldProtext);
}
void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode)
{
DWORD OldProtext = 0;
VirtualProtect((LPVOID)dwHookAddr, 5, PAGE_EXECUTE_READWRITE, &OldProtext);
WriteProcessMemory(GetCurrentProcess(), (LPVOID)dwHookAddr, originalRecieveCode, 5, 0);
VirtualProtect((LPVOID)dwHookAddr, 5, OldProtext, &OldProtext);
}
void UnHookAll() {
UnHookExtractExpression();
}
\ No newline at end of file
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#pragma once
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#include<windows.h>
#include<iostream>
#include "SendImage.h"
#include "SendText.h"
#include "SendFile.h"
#include "FriendList.h"
#include "SaveGif.h"
#endif //PCH_H
using namespace std;
#define DLLEXPORT extern "C" __declspec(dllexport)
struct WxBaseStruct
{
wchar_t* buffer;
DWORD length;
DWORD maxLength;
DWORD fill1;
DWORD fill2;
WxBaseStruct(wchar_t* pStr) {
buffer = pStr;
length = wcslen(pStr);
maxLength = wcslen(pStr) * 2;
fill1 = 0x0;
fill2 = 0x0;
}
};
struct WxString
{
wchar_t* buffer;
DWORD length;
DWORD maxLength;
DWORD fill1;
DWORD fill2;
};
BOOL CreateConsole(void);
DWORD GetWeChatWinBase();
void Wchar_tToString(std::string& szDst, wchar_t* wchar);
void HookAnyAddress(DWORD dwHookAddr, LPVOID dwJmpAddress, char* originalRecieveCode);
void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode);
DLLEXPORT void UnHookAll();
#include "pch.h"
#include <vector>
using namespace std;
#define LeftTreeOffsetA 0x21DD240
struct WxFriendStructA {
int index;
string wxid;
string wxNumber;
string wxNickName;
string wxRemark;
WxFriendStructA(int index_, DWORD wxIdAddr, DWORD wxNumberAddr, DWORD wxNickNameAddr, DWORD wxRemarkAddr) {
index = index_;
Wchar_tToString(wxid, (wchar_t*)((LPVOID*)wxIdAddr));
if (wxNumberAddr)
Wchar_tToString(wxNumber, (wchar_t*)((LPVOID*)wxNumberAddr));
else
wxNumber = "null";
if (wxNickNameAddr)
Wchar_tToString(wxNickName, (wchar_t*)((LPVOID*)wxNickNameAddr));
else
wxNickName = "null";
if (wxRemarkAddr)
Wchar_tToString(wxRemark, (wchar_t*)((LPVOID*)wxRemarkAddr));
else
wxRemark = "null";
}
};
void __stdcall GetFriendListS() {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD LeftTreeAddr = 0;
DWORD RightTreeAddr = 0;
DWORD baseAddr = WeChatWinBase + LeftTreeOffsetA;
vector<WxFriendStructA> WxFriendList;
__asm {
pushad;
mov eax, dword ptr[baseAddr];
mov eax, dword ptr[eax];
mov eax, dword ptr[eax + 0x4C];
mov ecx, dword ptr[eax];
mov LeftTreeAddr, ecx;
mov ecx, dword ptr[eax + 0x4];
mov RightTreeAddr, ecx;
popad;
}
int index = 0;
// wcout.imbue(locale("chs"));
while (1) {
++index;
DWORD wxIdAddr = 0;
DWORD wxNumberAddr = 0;
DWORD wxNickNameAddr = 0;
DWORD wxRemarkAddr = 0;
__asm {
pushad;
mov eax, dword ptr[LeftTreeAddr];
mov ecx, dword ptr[eax + 0x30];
mov wxIdAddr, ecx;
mov ecx, dword ptr[eax + 0x44];
mov wxNumberAddr, ecx;
mov ecx, dword ptr[eax + 0x8C];
mov wxNickNameAddr, ecx;
mov ecx, dword ptr[eax + 0x78];
mov wxRemarkAddr, ecx;
mov ecx, dword ptr[eax];
mov LeftTreeAddr, ecx;
popad;
}
if (wxIdAddr == 0xBAADF00D || wxIdAddr == 0x0 || wxIdAddr == -1 || IsBadWritePtr((LPVOID*)wxIdAddr, 10)) {
break;
}
else {
WxFriendStructA p(index, wxIdAddr, wxNumberAddr, wxNickNameAddr, wxRemarkAddr);
WxFriendList.push_back(p);
}
}
for (unsigned int i = 0; i < WxFriendList.size(); i++) {
cout << WxFriendList[i].index << " ";
cout << WxFriendList[i].wxid << " ";
cout << WxFriendList[i].wxNumber << " ";
cout << WxFriendList[i].wxNickName << " ";
cout << WxFriendList[i].wxRemark << " ";
cout << endl;
}
WxFriendList.clear();
}
\ No newline at end of file
#include "base.h"
HANDLE hProcess = NULL;
bool isFileExists_stat(string& name) {
struct stat buffer;
return (stat(name.c_str(), &buffer) == 0);
}
string wstring2string(wstring wstr)
{
std::string result;
//获取缓冲区大小,并申请空间,缓冲区大小事按字节计算的
int len = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), wstr.size(), NULL, 0, NULL, NULL);
char* buffer = new char[len + 1];
//宽字节编码转换成多字节编码
WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), wstr.size(), buffer, len, NULL, NULL);
buffer[len] = '\0';
//删除缓冲区并返回值
result.append(buffer);
delete[] buffer;
return result;
}
bool InjectDll(DWORD dwId, WCHAR* szPath)//参数1:目标进程PID 参数2:DLL路径
{
if (!hProcess)
return 1;
if (GetWeChatRobotBase() != 0) {
printf("请勿重复注入\n");
return 1;
}
/*
【1.2 在目标进程的内存里开辟空间】
*/
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
//二、 把dll的路径写入到目标进程的内存空间中
DWORD dwWriteSize = 0;
/*
【写一段数据到刚才给指定进程所开辟的内存空间里】
*/
if (pRemoteAddress)
{
WriteProcessMemory(hProcess, pRemoteAddress, szPath, wcslen(szPath) * 2 + 2, &dwWriteSize);
}
else {
printf("写入失败!\n");
return 1;
}
//三、 创建一个远程线程,让目标进程调用LoadLibrary
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)LoadLibrary, pRemoteAddress, NULL, NULL);
if (hThread) {
WaitForSingleObject(hThread, -1);
}
else {
printf("调用失败!\n");
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
CloseHandle(hProcess);
return 0;
}
void Injert(DWORD dwPid, wchar_t* wStr) {
wchar_t dllpath[MAX_PATH];
wchar_t workPath[MAX_PATH];
wchar_t* pworkPath = _wgetcwd(workPath, MAX_PATH);
swprintf_s(dllpath, MAX_PATH, L"%ws%ws%ws", pworkPath, L"\\", wStr);
string name = wstring2string((wstring)dllpath);
if (!isFileExists_stat(name)) {
wstring info = L"请检查目标文件路径!";
MessageBox(NULL, info.c_str(), _T("警告"), MB_ICONWARNING);
return;
}
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);
InjectDll(dwPid, dllpath);
}
BOOL RemoveDll(DWORD dwId) {
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwId);
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
DWORD dwWriteSize = 0;
HANDLE hThread = NULL;
DWORD dwHandle, dwID;
LPVOID pFunc = NULL;
if(pRemoteAddress)
WriteProcessMemory(hProcess, pRemoteAddress, dllname, wcslen(dllname) * 2 + 2, &dwWriteSize);
else {
printf("写入失败!\n");
return 1;
}
pFunc = GetModuleHandleW;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, pRemoteAddress, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &dwHandle);
}
else {
printf("GetModuleHandleW调用失败!\n");
return 1;
}
CloseHandle(hThread);
// 释放console窗口,不然关闭console的同时微信也会退出
pFunc = FreeConsole;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, NULL, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
printf("FreeConsole调用失败!\n");
return 1;
}
CloseHandle(hThread);
// 使目标进程调用FreeLibrary,卸载DLL
pFunc = FreeLibrary;
hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, (LPVOID)dwHandle, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
printf("FreeLibrary调用失败!\n");
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
CloseHandle(hProcess);
return 0;
}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3f7198c7-68d1-4bba-9bf2-b7fc67a9426e}</ProjectGuid>
<RootNamespace>MyWeChatTools</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>WeChatTools</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="base.cpp" />
<ClCompile Include="Injert.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="base.h" />
<ClInclude Include="main.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="注入工具">
<UniqueIdentifier>{4212f33d-28e9-4a15-90c9-8f292a8a90b9}</UniqueIdentifier>
</Filter>
<Filter Include="主函数">
<UniqueIdentifier>{601f5067-b37e-4adf-b081-ba472f0eb50c}</UniqueIdentifier>
</Filter>
<Filter Include="通用函数">
<UniqueIdentifier>{32810a6d-ba95-4285-b52b-62ce859da7f1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>主函数</Filter>
</ClCompile>
<ClCompile Include="Injert.cpp">
<Filter>注入工具</Filter>
</ClCompile>
<ClCompile Include="base.cpp">
<Filter>通用函数</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
<Filter>主函数</Filter>
</ClInclude>
<ClInclude Include="base.h">
<Filter>通用函数</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
#include "base.h"
DWORD GetWeChatRobotBase() {
if (!hProcess)
return 0;
DWORD dwWriteSize = 0;
LPVOID pRemoteAddress = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
if (pRemoteAddress)
WriteProcessMemory(hProcess, pRemoteAddress, dllname, wcslen(dllname) * 2 + 2, &dwWriteSize);
else
return 0;
DWORD dwHandle, dwID;
LPVOID pFunc = GetModuleHandleW;
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFunc, pRemoteAddress, 0, &dwID);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
GetExitCodeThread(hThread, &dwHandle);
}
else {
return 0;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, pRemoteAddress, 0, MEM_RELEASE);
return dwHandle;
}
\ No newline at end of file
#pragma once
#include <iostream>
#include "stdlib.h"
#include <tchar.h>
#include <Windows.h>
#include <stdio.h>
#include <windows.h>
#include <TlHelp32.h>
#include <atlconv.h>
#include <tchar.h>
#include <sys/stat.h>
#include <direct.h>
using namespace std;
void Injert(DWORD dwPid, wchar_t* wStr);
bool isFileExists_stat(string& name);
string wstring2string(wstring wstr);
BOOL RemoveDll(DWORD dwId);
extern HANDLE hProcess;
DWORD GetWeChatRobotBase();
#define dllname L"DWeChatRobot.dll"
#define SendImageOffset 0x000110BE
\ No newline at end of file
#include "main.h"
int _tmain(int nargv, WCHAR* argvs[])
{
DWORD dwId = 0;
HWND hCalc = FindWindow(NULL, L"微信");
DWORD dwPid = 0;
DWORD dwRub = GetWindowThreadProcessId(hCalc, &dwPid);
if (!dwPid) {
wstring info = L"请先启动目标进程!";
MessageBox(NULL, info.c_str(), _T("警告"), MB_ICONWARNING);
return 1;
}
wchar_t* wStr = NULL;
if (nargv == 1) {
return 1;
}
else if (nargv == 2) {
wStr = argvs[1];
Injert(dwPid, argvs[1]);
}
else if (nargv == 3 && !((wstring)argvs[1]).compare(L"-r")) {
wStr = argvs[2];
RemoveDll(dwPid);
}
return 0;
}
\ No newline at end of file
#pragma once
#include "base.h"
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 24 16:19:48 2022
@author: ljc545w
"""
# Before use,execute `CWeChatRebot.exe /regserver` in cmd by admin user
import comtypes.client
import ast
class ChatSession():
def __init__(self,robot,wxid):
self.robot = robot
self.chatwith = wxid
def SendText(self,msg):
return self.robot.CSendText(self.chatwith,msg)
def SendImage(self,imgpath):
return self.robot.CSendImage(self.chatwith,imgpath)
def SendFile(self,filepath):
return self.robot.CSendFile(self.chatwith,filepath)
# 其实发送图片的函数比较智能,也可以发送视频和文件
def SendMp4(self,mp4path):
return self.robot.CSendImage(self.chatwith,mp4path)
class WeChatRobot():
def __init__(self,dllpath):
self.robot = comtypes.client.CreateObject("WeChatRobot.CWeChatRobot")
self.dllpath = dllpath
self.AddressBook = []
def StartService(self):
return self.robot.CStartRobotService(self.dllpath)
def StopService(self):
return self.robot.CStopRobotService()
def GetAddressBook(self):
AddressBookString = wx.robot.CGetFriendList()
AddressBookString = AddressBookString.replace("\n","\\n")
self.AddressBook = ast.literal_eval(AddressBookString)
return self.AddressBook
def GetFriendList(self):
if not self.AddressBook:
self.GetAddressBook()
FriendList = []
for item in self.AddressBook:
if 'wxid_' == item['wxid'][0:5]:
FriendList.append(item)
return FriendList
def GetChatRoomList(self):
if not self.AddressBook:
self.GetAddressBook()
ChatRoomList = []
for item in self.AddressBook:
if '@chatroom' in item['wxid']:
ChatRoomList.append(item)
return ChatRoomList
def GetOfficialAccountList(self):
if not self.AddressBook:
self.GetAddressBook()
OfficialAccountList = []
for item in self.AddressBook:
if 'wxid_' != item['wxid'][0:5] and '@chatroom' not in item['wxid']:
OfficialAccountList.append(item)
return OfficialAccountList
def GetFriendByWxRemark(self,remark:str):
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxRemark'] == remark:
return item
return None
def GetFriendByWxNumber(self,wxnumber:str):
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxNumber'] == wxnumber:
return item
return None
def GetFriendByWxNickName(self,wxnickname:str):
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxNickName'] == wxnickname:
return item
return None
def GetChatSession(self,wxid):
return ChatSession(self.robot, wxid)
if __name__ == '__main__':
# DWeChatRobot.dll path
dllpath = r'D:\VS2019C++\MyWeChatRobot\Release'
# image full path
imgpath = r"C:\Users\Administrator\Desktop\快捷\wechat\测试图片.jpg"
# file full path
filepath = r"C:\Users\Administrator\Desktop\快捷\wechat\MyWeChatRobot.zip"
# mp4 full path
mp4path = r"C:\Users\Administrator\Desktop\快捷\wechat\wxsend.mp4"
wx = WeChatRobot(dllpath)
wx.StartService()
me = wx.GetFriendByWxNickName("文件传输助手")
session = wx.GetChatSession(me.get('wxid'))
session.SendText('来自python的消息')
session.SendImage(imgpath)
session.SendFile(filepath)
session.SendMp4(mp4path)
wx.StopService()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册