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获取文件大小

Delphi changefileext 更改文件的后缀扩展名

Delphi如何简单取得后缀名

winapi 字符及字符串函数(1): charlower - 字符或字符串转小写

Delphi xe7 判断android应用程序中的通信状态类型

Delphi 异或加解密

Delphi xe5 for android ttabcontrol 控件

Delphi高效的byte转化sring 函数

Delphi idftp连不上ftp服务器的解决方法

Delphi uses 子句的写法

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



打赏

取消

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

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

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

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

评论

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