把dll文件注入到魔兽war3的进程中
然后调用里面的SetName(char * name)
具体怎么操作 c++
c++调用dll文件
答案:1 悬赏:20 手机版
解决时间 2021-03-17 02:27
- 提问者网友:原来太熟悉了会陌生
- 2021-03-16 20:09
最佳答案
- 五星知识达人网友:轮獄道
- 2021-03-16 20:15
远程注入,无非就是那几个API的调用而已。
给你一个代码,自己写的,你稍加修改便可。
#include<windows.h>
#include<stdio.h>
#include<string.h>
void main()
{
char szLibPath[]="dlInjt.dll";
int iLibLen=strlen(szLibPath)+1;
DWORD dwExitCode;
HMODULE hKernel32=GetModuleHandle("kernel32.dll");
PROC AddrLoadLibraryA=GetProcAddress(hKernel32,"LoadLibraryA");
HWND hwnd=FindWindow(NULL,"窗口的标题");
if(hwnd==NULL)
{
puts("Cannot find window");
return;
}
DWORD dwProcess;
GetWindowThreadProcessId(hwnd,&dwProcess);
HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,dwProcess);
if(hProcess==NULL)
{
puts("OpenProcess failed");
return;
}
PVOID pLibRemote;
//////////////////////写入注入的DLL名字//////////////////////////////////////////////////////////
pLibRemote=VirtualAllocEx(hProcess,NULL,iLibLen,MEM_COMMIT,PAGE_READWRITE);
if(pLibRemote==NULL)
{
puts("VirtualAllocEx failed");
return;
}
if(WriteProcessMemory(hProcess,pLibRemote,(PVOID)szLibPath,iLibLen,NULL)==0)
{
puts("WriteProcessMemory failed");
return;
}
///////////////////////远程线程加载DLL//////////////////////////////////////////////////////
HANDLE hThread=CreateRemoteThread(hProcess,NULL,NULL,LPTHREAD_START_ROUTINE(AddrLoadLibraryA),pLibRemote,0,NULL);
if(hThread==NULL)
{
puts("CreateRemoteThread failed");
}
WaitForSingleObject(hThread,INFINITE);
GetExitCodeThread(hThread,&dwExitCode);
VirtualFreeEx(hProcess,pLibRemote,iLibLen,MEM_DECOMMIT);
CloseHandle(hThread);
CloseHandle(hProcess);
CloseHandle(hwnd);
}
给你一个代码,自己写的,你稍加修改便可。
#include<windows.h>
#include<stdio.h>
#include<string.h>
void main()
{
char szLibPath[]="dlInjt.dll";
int iLibLen=strlen(szLibPath)+1;
DWORD dwExitCode;
HMODULE hKernel32=GetModuleHandle("kernel32.dll");
PROC AddrLoadLibraryA=GetProcAddress(hKernel32,"LoadLibraryA");
HWND hwnd=FindWindow(NULL,"窗口的标题");
if(hwnd==NULL)
{
puts("Cannot find window");
return;
}
DWORD dwProcess;
GetWindowThreadProcessId(hwnd,&dwProcess);
HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,dwProcess);
if(hProcess==NULL)
{
puts("OpenProcess failed");
return;
}
PVOID pLibRemote;
//////////////////////写入注入的DLL名字//////////////////////////////////////////////////////////
pLibRemote=VirtualAllocEx(hProcess,NULL,iLibLen,MEM_COMMIT,PAGE_READWRITE);
if(pLibRemote==NULL)
{
puts("VirtualAllocEx failed");
return;
}
if(WriteProcessMemory(hProcess,pLibRemote,(PVOID)szLibPath,iLibLen,NULL)==0)
{
puts("WriteProcessMemory failed");
return;
}
///////////////////////远程线程加载DLL//////////////////////////////////////////////////////
HANDLE hThread=CreateRemoteThread(hProcess,NULL,NULL,LPTHREAD_START_ROUTINE(AddrLoadLibraryA),pLibRemote,0,NULL);
if(hThread==NULL)
{
puts("CreateRemoteThread failed");
}
WaitForSingleObject(hThread,INFINITE);
GetExitCodeThread(hThread,&dwExitCode);
VirtualFreeEx(hProcess,pLibRemote,iLibLen,MEM_DECOMMIT);
CloseHandle(hThread);
CloseHandle(hProcess);
CloseHandle(hwnd);
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯