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] Why doesn't is work?

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

Joined: 06 Nov 2009
Posts: 9

PostPosted: Fri Nov 13, 2009 2:44 pm    Post subject: [Delphi] Why doesn't is work? Reply with quote

I'm trying to protect GetCursorPos against most common hooks, but I receive lots of errors.

In library:
Code:

...
...
var hUser32: THandle;
...
function BulhufasGetCursorPos(var lpPoint: TPoint): BOOL; stdcall;
var dwOriginalAPI: DWORD;
begin
  dwOriginalAPI := DWORD(GetProcAddress( hUser32, 'GetCursorPos')) + 5;
  asm
    mov edi,edi
    push ebp
    mov ebp,esp
    jmp [dwOriginalAPI]
//I already tried to put "jmp dword ptr ds:[dwOriginalAPI]", but it doesn't work.
  end;
end;
...
...
exports BulhufasGetCursorPos;
...
...
begin
  hUser32 := GetModuleHandle('user32.dll');
  if hUser32 = INVALID_HANDLE_VALUE then
    hUser32 := LoadLibrary('user32.dll');
end.

In application:
Code:

...
...
implementation

{$R *.dfm}
function BulhufasGetCursorPos(var lpPoint: TPoint): BOOL; stdcall; external 'Bulhufas.dll' name 'BulhufasGetCursorPos';

procedure TForm1.Timer1Timer(Sender: TObject);
var lpPoint: TPoint;
begin
  if BulhufasGetCursorPos(lpPoint) = true then
    Edit1.Text := 'True'
  else
    Edit1.Text := 'False';
  Edit1.Text := Edit1.Text + ' ' + IntToStr(lpPoint.X) + ', ' + IntToStr(lpPoint.Y);
end;

Error: Access violation, normally in $70000000+ trying to write to $70000000+
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