#include <iostream>
#include <windows.h>
using namespace std;
void main()
{
char* dll="c:\\mm.dll";//这里被注入的DLL为C盘下的mm.dll
DWORD sizedll=sizeof(dll)+1;
HWND hWnd;
while(1)
{
hWnd=FindWindow(NULL,"QQ2010");//此注入的为QQ2010版本
if(hWnd)
{
break;
}
}
DWORD QQid;
GetWindowThreadProcessId(hWnd,&QQid);
HANDLE hQQ=OpenProcess(PROCESS_ALL_ACCESS,FALSE,QQid);
LPVOID lpRemoteDllName=::VirtualAllocEx(hQQ,NULL,sizedll,MEM_COMMIT,PAGE_READWRITE);//向QQ分配空间
WriteProcessMemory(hQQ,lpRemoteDllName,(LPVOID)dll,sizedll,NULL);
LPVOID StartRoutine=LoadLibraryA;
HANDLE hRemoteThread=CreateRemoteThread(hQQ,NULL,0,(LPTHREAD_START_ROUTINE)StartRoutine,lpRemoteDllName,0,NULL);
::WaitForSingleObject(hRemoteThread,INFINITE);
//释放句柄
::VirtualFreeEx(hQQ,lpRemoteDllName,sizedll,MEM_DECOMMIT);
::CloseHandle(hRemoteThread);
::CloseHandle(hQQ);
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)