1 Star 0 Fork 1

陈奇/ComWeChatRobot

forked from Janisa/ComWeChatRobot 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
InjectDll.cpp 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
#include "pch.h"
bool InjectDll(DWORD dwId, WCHAR *szPath)
{
WeChatProcess hp(dwId);
if (!hp.m_init)
return 1;
if (hp.WeChatRobotBase() != 0)
return 0;
WeChatData<wchar_t *> r_dllpath(hp.GetHandle(), szPath, TEXTLENGTH(szPath));
if (r_dllpath.GetAddr() == 0)
return 1;
CallRemoteFunction(hp.GetHandle(), LoadLibraryW, r_dllpath.GetAddr());
return 0;
}
bool Inject(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))
{
MessageBox(NULL, dllpath, L"ļ", MB_ICONWARNING);
delete[] dllpath;
dllpath = NULL;
return 1;
}
bool status = InjectDll(dwPid, dllpath);
delete[] dllpath;
dllpath = NULL;
return status;
}
BOOL RemoveDll(DWORD dwId)
{
WeChatProcess hp(dwId);
if (!hp.m_init)
return 1;
DWORD WeChatRobotBase = hp.WeChatRobotBase();
if (WeChatRobotBase == 0)
return 0;
CallRemoteFunction(hp.GetHandle(), FreeConsole, NULL);
CallRemoteFunction(hp.GetHandle(), FreeLibrary, WeChatRobotBase);
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/chen_q_i/ComWeChatRobot.git
git@gitee.com:chen_q_i/ComWeChatRobot.git
chen_q_i
ComWeChatRobot
ComWeChatRobot
master

搜索帮助