View previous topic :: View next topic |
Author |
Message |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Wed Mar 04, 2009 1:03 pm Post subject: [Delphi] GetMemoryAddress of Delphi Function |
|
|
procedure TForm1.Button1Click(Sender: TObject);
var
h:integer;
begin
h:=pointer(Application.Terminate);
showmessage(inttohex(h,1));
end;
It will not let me compile:
Code: | Build
[Error] Unit1.pas(30): Invalid typecast
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas' |
I assume Application has a "baseaddress" and Terminate is the offset. How can i get that address+offset for example? _________________
Last edited by h4c0r-BG on Thu Mar 05, 2009 6:18 am; edited 1 time in total |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Wed Mar 04, 2009 1:18 pm Post subject: |
|
|
try
h:=integer(@Application.Terminate) _________________
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 |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Wed Mar 04, 2009 8:27 pm Post subject: |
|
|
Dark Byte wrote: | try
h:=integer(@Application.Terminate) |
I don't think this will work because you can't find out the pointer to something in a class like directx.
What I do is insert alot of nops before and after it then call Application.Terminate. Compile then look it up in a disassembler. |
|
Back to top |
|
 |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Thu Mar 05, 2009 6:17 am Post subject: |
|
|
Dark Byte wrote: | try
h:=integer(@Application.Terminate) |
[Error] Unit1.pas(30): Variable required
Friend said wrote: |
so, how do you get a variable's memory address in delphi? in C is with "&"....
|
If i am not mistaken he is talking about "@" in Delphi? _________________
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Mar 05, 2009 8:11 am Post subject: |
|
|
I told you what to do on Messenger -_-
(Add procedure lol; to private dec)
Code: | Procedure TForm1.lol;
Begin
Application.Terminate;
End;
Button1.Click:
ShowMessageFmt( '%x', [ @TForm1.lol ] ); |
will raise an exception error, try doing what dark byte did (typecast it as Integer)
I'm not sure that THAT function itself is even a standalone, it's just a wrapper so it won't give you .Terminate (Application is the class and Ter is a member of it) address -_- |
|
Back to top |
|
 |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Thu Mar 05, 2009 9:51 am Post subject: |
|
|
Thank you Rot1, but i wanted to get the address of:
Application.Terminate not procedure TForm1.lol
 _________________
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Mar 05, 2009 10:54 am Post subject: |
|
|
h4c0r-BG wrote: | Thank you Rot1, but i wanted to get the address of:
Application.Terminate not procedure TForm1.lol
 |
as i said, when you compile and run your program, it doesn't really call Application.Terminate, as it's just a freakin' wrapper, example:
Procedure lol(text: string);
begin
ShowMessage(text);
end;
lets say you wanna get the address of lol, you can't because in the compiled program it's just regulary calling ShowMessage from your compiled wrapper. |
|
Back to top |
|
 |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Thu Mar 05, 2009 11:21 am Post subject: |
|
|
Rot1, i am using this code within a dll file, it will get the address of the procedure ... and ... the returned value will be from my DLL, but the thing which i call is in the executable.
So the address will be not what i wanted. _________________
|
|
Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Thu Mar 05, 2009 12:05 pm Post subject: |
|
|
I don't think you can get the address of a function from another module unless it's exported. _________________
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Mar 05, 2009 12:25 pm Post subject: |
|
|
dnsi0 wrote: | Dark Byte wrote: | try
h:=integer(@Application.Terminate) |
I don't think this will work because you can't find out the pointer to something in a class like directx.
What I do is insert alot of nops before and after it then call Application.Terminate. Compile then look it up in a disassembler. |
Dude....i'm amazed of this comment. |
|
Back to top |
|
 |
|