首页 > 代码库 > 控制台注入DLL代码
控制台注入DLL代码
// zhuru.cpp : 定义控制台应用程序的入口点。#include "stdafx.h"#include <Windows.h>#define GameClassName "classFoxitReader"#define dllName "GameDLL.dll"void zhuru(HWND hGame,const char* DllNameFullpath);int _tmain(int argc, _TCHAR* argv[]){ HWND hGame = FindWindowA(GameClassName,NULL); char DirName[256]=""; char DllNameFullpath[256]=""; GetCurrentDirectoryA(sizeof(DirName),DirName); strcpy_s(DllNameFullpath,DirName); strcat_s(DllNameFullpath,"\\"); strcat_s(DllNameFullpath,dllName); printf("%s\n",DllNameFullpath); zhuru(hGame,DllNameFullpath); //getchar(); return 0;}void zhuru(HWND hGame,const char* DllNameFullpath){ DWORD pid; HANDLE hProcess; LPWORD AddressDW; DWORD byWriteSize; HANDLE hThread; if (hGame!=NULL) { GetWindowThreadProcessId(hGame,&pid); if (pid!=NULL) { hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid); if (hProcess!=NULL) { AddressDW = (LPWORD)VirtualAllocEx(hProcess,NULL,256,MEM_COMMIT,PAGE_READWRITE); if (AddressDW!=NULL) { WriteProcessMemory(hProcess,AddressDW,DllNameFullpath,strlen(DllNameFullpath)+1,&byWriteSize); if (byWriteSize>=strlen(DllNameFullpath)) { hThread = CreateRemoteThread(hProcess,NULL,NULL,(LPTHREAD_START_ROUTINE)LoadLibraryA,AddressDW,NULL,NULL); WaitForSingleObject(hThread,0xFFFFFFF); CloseHandle(hThread); VirtualFreeEx(hProcess,AddressDW,256,MEM_COMMIT); CloseHandle(hProcess); } } } } } return;}
控制台注入DLL代码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。