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 


help in using pointers in delphi
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Sat Mar 12, 2011 11:05 am    Post subject: help in using pointers in delphi Reply with quote

ok first thanks for admin for this advanced furom

if i have a game named test
and my tries adress is 12345678
and i wana make tries = 9
i think it will be easy like that
Code:
var
// assign needed variables
  WIN : integer;
  PID : integer;
  TID : integer;
  HND : integer;
  WRT : cardinal;
  BUF : pchar;

const
// assign needed constants
  Caption = 'test';
  Addr0 = $12345678;
  Poke0 = $09;
  Bytes = 1;

begin

// find window from process caption
     WIN := FindWindow(nil,Caption);

// get process id after window was found
     TID := GetWindowThreadProcessId(WIN,@PID);

// create handle to gain access to the process
     HND := OpenProcess(PROCESS_ALL_ACCESS,False,PID);

// create pointer for the value
     GetMem(BUF,1);

// setup address value and write it to the process
     BUF^ := Chr(Poke0);
     WriteProcessMemory(HND,ptr(Addr0),BUF,Bytes,WRT);

// finally free memory and terminate handle
     FreeMem(BUF);
     closehandle(HND);


so my question is

if this value is behined a pointer with this offsets
like that
test.exe+0002E7AC
+7c +21c +8
how wil the code should be in delphi??
Back to top
View user's profile Send private message
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Wed Mar 23, 2011 4:45 pm    Post subject: Reply with quote

so is it so hard ?? Evil or Very Mad Evil or Very Mad
or it is a secret ??
i want know just how to put a multi level pointer in delphi
is it posible or not ??
plz help
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Wed Mar 23, 2011 5:26 pm    Post subject: Reply with quote

Yep, is posible, just use ReadProcessMemory the necesary times for find the pointer, i mean... read the base pointer in 4 bytes, add the first offset to result, scan/read the result (again with the RPM API), and add the next offset, make it again, blah, blah, blah...

PD: Don't make re-post.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Fri Mar 25, 2011 11:28 am    Post subject: Reply with quote

DaasCook wrote:
Yep, is posible, just use ReadProcessMemory the necesary times for find the pointer, i mean... read the base pointer in 4 bytes, add the first offset to result, scan/read the result (again with the RPM API), and add the next offset, make it again, blah, blah, blah...

PD: Don't make re-post.


thanks for replay


but i need an example in delphi please please
for remember
the game data was :
the game name is test
adress
test.exe+0002E7AC
offsets
+7c +21c +8
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Fri Mar 25, 2011 4:37 pm    Post subject: Reply with quote

elshabory wrote:
thanks for replay


but i need an example in delphi please please
for remember
the game data was :
the game name is test
adress
test.exe+0002E7AC
offsets
+7c +21c +8

Code:
var
 WindowHandle: HWND;
 ProcessIdentifier: DWORD;
 ProcessHandle: THandle;
 ModuleHandle: HMODULE;
 MemoryBuffer: DWORD;
 NumberOfBytesRead: Integer;
begin
 WindowHandle := FindWindow(nil, 'Window Name');
 ProcessIdentifier := GetWindowThreadProcessId(WindowHandle, @ProcessIdentifier);
 ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, false, ProcessIdentifier);
 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 'test.exe', @ModuleHandle);
 ReadProcessMemory(ProcessHandle, Ptr(ModuleHandle + $2E7AC), @MemoryBuffer, SizeOf(MemoryBuffer), NumberOfBytesRead);
 ReadProcessMemory(ProcessHandle, Ptr(MemoryBuffer + $7C), @MemoryBuffer, SizeOf(MemoryBuffer), NumberOfBytesRead);
 ReadProcessMemory(ProcessHandle, Ptr(MemoryBuffer + $21C), @MemoryBuffer, SizeOf(MemoryBuffer), NumberOfBytesRead);
 ReadProcessMemory(ProcessHandle, Ptr(MemoryBuffer + $8), @MemoryBuffer, SizeOf(MemoryBuffer), NumberOfBytesRead);
 // Do what you want with the value held by MemoryBuffer here...
 CloseHandle(ProcessHandle);
end;


Last edited by Innovation on Sun Mar 27, 2011 10:39 am; edited 5 times in total
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Fri Mar 25, 2011 4:45 pm    Post subject: Reply with quote

I'm developing this little app for show you an example, when i finish, i'll post the source code, please take a while.



Lolol, Innovation has made it before i do xD...

Anyways, if you want i'll post the src, that is not so different than Innovation has posted.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.


Last edited by Krähne on Sun Mar 27, 2011 7:54 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Sun Mar 27, 2011 7:05 am    Post subject: Reply with quote

first thanks mr. Innovation and mr. DaasCook

but i got errors
Code:
[Error] Unit1.pas(38): Undeclared identifier: 'GetModuleHandleEx'
  [Error] Unit1.pas(38): Undeclared identifier: 'GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT'
  [Error] Unit1.pas(39): Undeclared identifier: 'ReadProcessMemoryBuffer'
  [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

forgive me i am new in delphi

and i will be so glade if you help us with this source mr. DaasCook
i am waitng for this

thanks all
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Sun Mar 27, 2011 7:53 am    Post subject: Reply with quote

elshabory wrote:
first thanks mr. Innovation and mr. DaasCook

but i got errors
Code:
[Error] Unit1.pas(38): Undeclared identifier: 'GetModuleHandleEx'
  [Error] Unit1.pas(38): Undeclared identifier: 'GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT'
  [Error] Unit1.pas(39): Undeclared identifier: 'ReadProcessMemoryBuffer'
  [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

forgive me i am new in delphi

and i will be so glade if you help us with this source mr. DaasCook
i am waitng for this

thanks all


Ok, before everything, tell me something...

What is the really process name you want to edit?, Maybe counter strike?.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Mar 27, 2011 8:52 am    Post subject: Reply with quote

elshabory wrote:
but i got errors

Those were because I accidentally mass-replaced some terms when refactoring the code in Notepad (I fixed it now) and because Delphi's Windows API packages don't have declarations for GetModuleHandleEx and GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT.

Code:
function GetModuleHandleEx(dwFlags: DWORD; lpModuleName: PAnsiChar; var hModule: HMODULE): BOOL; stdcall; external 'kernel32.dll' name 'GetModuleHandleExA';

...

const
 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: DWORD = $2;
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sun Mar 27, 2011 9:22 am    Post subject: Reply with quote

DaasCook wrote:
[
Ok, before everything, tell me something...

What is the really process name you want to edit?, Maybe counter strike?.


Please stop using small font sizes, it's annoying to people to have to resize your messages just to read them.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Sun Mar 27, 2011 9:27 am    Post subject: Reply with quote

Innovation wrote:
elshabory wrote:
but i got errors

Those were because I accidentally mass-replaced some terms when refactoring the code in Notepad (I fixed it now) and because Delphi's Windows API packages don't have declarations for GetModuleHandleEx and GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT.

Code:
function GetModuleHandleEx(dwFlags: DWORD; lpModuleName: PAnsiChar; var hModule: HMODULE): BOOL; stdcall; external 'kernel32.dll' name 'GetModuleHandleExA';

...

const
 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: DWORD = $2;


Remember: The module must have been loaded by the calling process.

So, as him are getting the module of another process, will doesn't work.

I'm developing another way for get the module base, take a while... Rolling Eyes

Wiccaan wrote:
DaasCook wrote:
[
Ok, before everything, tell me something...

What is the really process name you want to edit?, Maybe counter strike?.


Please stop using small font sizes, it's annoying to people to have to resize your messages just to read them.


Ok... (?) Excuse me.
Anyways, i think is a personal choice.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Sun Mar 27, 2011 10:19 am    Post subject: Reply with quote

thanks alot
but i am a new as i told you
can you give me a full source
this wil be a template for me
not just for this example
but for evry trainer i will make

so this data i wrote are not belong to any game
just example
i hope fore a full code to be a template for me when i build a multilevel pointer trainer in delphi
sory for my many questions
but this is important not only for me but for hundred programmers
which are new commers to delphi

so in few words :
i need a template for multilevel pointers trainer with the given data or any data !!

i wile be glade to read your replay
whatever its font size will be !!! Wink
gold is posting here !!!
and i will use my magnifier to read it if needed !!!


Last edited by elshabory on Sun Mar 27, 2011 10:31 am; edited 1 time in total
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sun Mar 27, 2011 10:29 am    Post subject: Reply with quote

DaasCook wrote:
Remember: The module must have been loaded by the calling process.

So, as him are getting the module of another process, will doesn't work.

I'm developing another way for get the module base, take a while... Rolling Eyes

No, it works assuming that "test.exe" is the main module. The main module is always loaded.
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Sun Mar 27, 2011 10:49 am    Post subject: Reply with quote

Innovation wrote:
DaasCook wrote:
Remember: The module must have been loaded by the calling process.

So, as him are getting the module of another process, will doesn't work.

I'm developing another way for get the module base, take a while... Rolling Eyes

No, it works assuming that "text.exe" is the main module. The main module is always loaded.


Yes, but... The module must have been loaded by the calling process. as i told you.

So... him are making a trainer, for that reason, the "tester.exe" isn't obviously the main module, i think you don't get it me.

Check you GetModuleHandleEx function, and will see that you can't get the module base from another process, just check it with the notepad.

elshabory wrote:
thanks alot
but i am a new as i told you
can you give me a full source
this wil be a template for me
not just for this example
but for evry trainer i will make

so this data i wrote are not belong to any game
just example
i hope fore a full code to be a template for me when i build a multilevel pointer trainer in delphi
sory for my many questions
but this is important not only for me but for hundred programmers
which are new commers to delphi

so in few words :
i need a template for multilevel pointers trainer with the given data or any data !!

i wile be glade to read your replay
whatever its font size will be !!! Wink
gold is posting here !!!
and i will use my magnifier to read it if needed !!!


Ok dude, here's my progress, isn't complete, because i'm making a function for get the module base (i mean "test.exe"+offset) blah blah...

But the other function (reading the multi-level pointers is finally complete, you can check it out and use for you needs).

Don't forget, the example isn't complete, and i'm not a delphi coder, but that example should be enough for you understand some basic things.

PD: You should initialize the value of "ModuleBase" TEdit control, for works correctly.

hope this helps, and... wait a little more, while i'm finishing the getmodulebase function.

Here's the example running an testing it with counter strike:


_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.


Last edited by Krähne on Sun Mar 27, 2011 10:24 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
elshabory
Newbie cheater
Reputation: 0

Joined: 02 Mar 2011
Posts: 20

PostPosted: Sun Mar 27, 2011 10:57 am    Post subject: Reply with quote

thanks but the link did not work
gives :
"Sorry, the file you requested is not available."
"The file has been deleted by the uploader. sendspace is not able to help you in this matter"
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
Goto page 1, 2  Next
Page 1 of 2

 
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