rovnix Newbie cheater
Reputation: 0
Joined: 09 Feb 2014 Posts: 18
|
Posted: Tue Jul 22, 2014 5:17 am Post subject: create simple trampoline hook in delphi |
|
|
been looking at this code for a simple trampoiline, just that i got lost along the line
| Quote: |
library Project2;
uses
windows; //reduce size Smile
{$R *.res}
procedure hook(target, newfunc:pointer);
var
jmpto:dword;
begin
jmpto:=dword(newfunc)-dword(target)-5;
VirtualProtect(target, 5, PAGE_EXECUTE_READWRITE, nil);
pbyte(target)^:=$e9;
pdword(dword(target)+1)^:=jmpto;
end;
procedure MySleep(time:dword);
begin
MessageBox(0, 'You have called "Sleep!"', 'Good!', MB_OK);
end;
begin
hook(GetProcAddress(GetModuleHandle('kernel32.dll'), 'Sleep'), @MySleep);
end.
|
now i saw someone talking about the Sleep() return function, how do i go about it, i am kind of lost. How do i go about this, kinda lost and i'm new to this.[/url]
|
|
661089799107 Expert Cheater
Reputation: 3
Joined: 25 Jan 2009 Posts: 186
|
Posted: Tue Jul 22, 2014 9:18 pm Post subject: |
|
|
1). Allocate 10 bytes of memory to store the original 5 bytes of Sleep, and a JMP instruction to Sleep+5.
2). Replace the first 5 bytes of Sleep with a JMP to your own function
3). Somewhere in your own function do a call to the 10 bytes of memory you allocated, and return the value that is returned.
|
|