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 


Delphi Question x.x

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
jonimane
How do I cheat?
Reputation: 0

Joined: 23 Nov 2010
Posts: 3

PostPosted: Tue Nov 23, 2010 8:04 pm    Post subject: Delphi Question x.x Reply with quote

i hooked two function(recv and send) of ws2_32.dll with this:
Code:
procedure hook(target, newfunc:pointer);
var
  jmpto:dword;
  OldProtect: Cardinal; // old protect in memory
begin
  jmpto := dword(newfunc) - dword(target) - 5;
  VirtualProtect(target, 5, PAGE_EXECUTE_READWRITE, @OldProtect);
  pbyte(target)^ := $e9;
  pdword(dword(target) + 1)^ := jmpto;
end;


And i am using this funcions to retrieve de unhooked funcions:

Code:

function unhookedSend(socket:integer; var data; datalen,flags:integer):Integer; assembler; stdcall;
asm
  mov edi, edi
  push ebp
  mov esp, ebp
  jmp [realSend];
end;

function unhookedRecv(socket:integer; data: pchar; datalen,flags:integer):Integer; assembler; stdcall;
asm
  mov edi, edi
  push ebp
  mov esp, ebp
  jmp [realRecv];
end;


but when i call every unhooked function... isn't work x.x

hooked functions:
Code:
function hookSend(socket:integer; var data; datalen,flags:integer): Integer;
begin
  Result := unhookedSend(socket, data, datalen, flags);
end;

function hookRecv(socket: integer; data: pchar; datalen,flags: integer): Integer;
begin
  Result := unhookedRecv(socket, data, datalen, flags);
end;


what is the problem? x.x

ps: sorry for my english x.x
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Nov 24, 2010 7:28 am    Post subject: Reply with quote

do you write realSend and realRecv ?

also, why "var data;' instead of "data:pchar;" ?

_________________
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
jonimane
How do I cheat?
Reputation: 0

Joined: 23 Nov 2010
Posts: 3

PostPosted: Wed Nov 24, 2010 7:39 am    Post subject: Reply with quote

realSend is a var...
Code:
var
  realSend: Pointer;
  realRecv: Pointer;


var because i have tested with a pchar type and don't works too x.x
more i will change to pchar when it works =]

i call this hook on:



Code:
  realSend := Pointer(DWord(GetProcAddress(GetModuleHandle('ws2_32.dll'), 'send')) + 5);
  hook(GetProcAddress(GetModuleHandle('ws2_32.dll'), 'send'), @hookSend);

  realRecv := Pointer(DWord(GetProcAddress(GetModuleHandle('ws2_32.dll'), 'recv')) + 5);
  hook(GetProcAddress(GetModuleHandle('ws2_32.dll'), 'recv'), @hookRecv);
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Nov 24, 2010 8:03 am    Post subject: Reply with quote

define "Not work"

Crash when called ?
Nothing being hooked at all?
Harddisk explodes ?

anyhow, also add stdcall; after the hookSend and hookRecv functions

_________________
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
jonimane
How do I cheat?
Reputation: 0

Joined: 23 Nov 2010
Posts: 3

PostPosted: Wed Nov 24, 2010 9:01 am    Post subject: Reply with quote

HardDisk Explodes \o/ =]

ps: this program is a dll... i inject on a process... that process use hooked functions

not work:
when i send a packet with a process... the packet don't be sended x.x

i will test with stdcall on hooked functions =]

Thx 4 all =]

@edit

works!!! i saw the problem kkkk

the problem was a LdrLoadDll hook kkkkkkkkkkkk
thx !!!!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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