delphi EXE注入代码


本文整理自网络,侵删。

 program Project1; 
{$IMAGEBASE $12120000} //换个镜像基址,这里是必须得,否则容易覆盖EXPLORER的进程信息
//=============================================================================
uses
windows,UrlMon,dialogs;
//windows是一定要的
//=============================================================================
Function Main(dwEntryPoint:Pointer):LongWord;stdcall;
begin
XXXXXXXXXXXXXXXXXXXXXX
end;
//=============================================================================
procedure Inject(ProcessHandle: longword; EntryPoint: pointer);
var
Module, NewModule: Pointer;
Size, BytesWritten, TID: longword;
begin
Module := Pointer(GetModuleHandle(nil));
Size := PImageOptionalHeader(Pointer(integer(Module) + PImageDosHeader(Module)._lfanew + SizeOf(dword) + SizeOf(TImageFileHeader))).SizeOfImage;
VirtualFreeEx(ProcessHandle, Module, 0, MEM_RELEASE);
NewModule := VirtualAllocEx(ProcessHandle, Module, Size, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
WriteProcessMemory(ProcessHandle, NewModule, Module, Size, BytesWritten);
CreateRemoteThread(ProcessHandle, nil, 0, EntryPoint, Module, 0, TID);
end;
//=============================================================================
var
PID,ProcessHandle:LongWord;
begin
GetWindowThreadProcessId(FindWindow('Shell_TrayWnd', nil), @PID);
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, False, PID);
Inject(ProcessHandle,@Main); //注入explorer.exe进程。
CloseHandle(ProcessHandle);
showmessage('注入EXPLORER.EXE!');
end.

相关阅读 >>

Delphi 网卡mac地址随机生成函数

Delphi 内存管理[2-3]

Delphi中的sha256算法

Delphi 判断上午还是下午

Delphi编写聊天程序

Delphi post数据到网页

Delphi判断驱动器类型

Delphi showdebuginfo 窗口

Delphi dcc32.exe 参数说明

Delphi 搜索某个字的位置 [带重复]

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...