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 dll inject when value becomes... start procedure?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
nielskool
Advanced Cheater
Reputation: 0

Joined: 03 Jun 2007
Posts: 65

PostPosted: Sat Oct 24, 2009 4:13 pm    Post subject: delphi dll inject when value becomes... start procedure? Reply with quote

heey guys,

i am trying to make a dll that shows a message when a value(in the host) changes to 1
i inject this dll in the program but it crashes everytime... maybe i need some help.
just started with this.
this is the code i use:
Code:

library messdll;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  StdCtrls;

{$R *.res}
var
temp:cardinal;
buf:pchar;

begin
repeat
Sleep(500);
getmem(buf,4);
ReadProcessMemory(Application.Handle,ptr($02DC4F0A),buf,4,temp);
if(integer(buf) = 1) then
begin
  showmessage('yeah you found it');
    end;
freemem(buf);
    until(false);
end.


P.S.
i now use a repeat and sleep, is there an other way to get the same result?

//edit
when i use:
Code:
library messdll;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  StdCtrls;

{$R *.res}
var
temp:cardinal;
buf:pchar;

begin
repeat
Sleep(500);
getmem(buf,4);
ReadProcessMemory(OpenProcess(PROCESS_ALL_ACCESS,False,Application.Handle),ptr($00947C3C),buf,4,temp);
showmessage(string(buf));
if(integer(buf) = 10) then
begin
  showmessage('yeah you found it');
    end;
freemem(buf);
    until(false);
end.

it gave me some wierd text(4chars)
showmessage(string(buf));
or
showmessage(integer(buf));
doesn't matter gives same outputs
but spider solitait does not hang...

_________________
cheaters are the best race in the world, they love eachother:P, so i would say never fuck poeple of your own race, unless they're beautiful:P
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