Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


detours in pascal

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
rovnix
Newbie cheater
Reputation: 0

Joined: 09 Feb 2014
Posts: 18

PostPosted: Tue Jun 09, 2015 11:13 am    Post subject: detours in pascal Reply with quote

Good evening people

Recently I been doing some game hacking, hooking and some other stuff again, but api hooking a hasn't been fun with me

Someone made this api hook detour function in delphi, (lazarus) tested with a simple messagebox hook, doesn't even work as I expected. Hence I decided to come on here to seek help.

Please do help me in your own small way people

Code:

function DetourFunction (src, dst: Pointer; len: Integer): Pointer;
var
  jmp     : PByteArray;
  dwBack  : LongWord;
  jmpaddr : PtrUInt;
  srcarr  : PByteArray;
  i       : Integer;
begin
  srcarr := PByteArray(src);
  GetMem(jmp, len + 5);
  VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, @dwBack);
  Move(src^, jmp^, len);
  jmp^[len]:=$e9;

  jmpaddr:=PtrUInt(@jmp^[len]);
  PPtrUInt( @jmp^[len+1])^ := PtrUInt(src)+PtrUInt(len) - jmpaddr - 5;

  srcarr^[0]:=$e9;
  PPtrUInt( @srcarr^[1] )^ := PtrUInt(dst) - PtrUInt(src) - 5;

  for i:=5 to len-1 do srcarr^[i]:=$90;

  VirtualProtect(src, len, dwBack, @dwBack);
  Result:=jmp;
end;


Hence it doesn't work as I expected, am quite still new to this as I don't have anyone to give me instructions here. Pls help.
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Fri Jun 12, 2015 2:05 am    Post subject: Reply with quote

is this code inside an injected dll in the target process? if not, this won't work
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites