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 


Getting Handle

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

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Wed May 20, 2009 2:03 pm    Post subject: Getting Handle Reply with quote

well i want to get Handle for MS, im using delphi but my result is 0 O.o!!! im using a form to get Module, this is my code:

Code:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    Label1: TLabel;
    Txt1: TEdit;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  hProcess:Integer;
  StringhProcess:String;

implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);

begin
hProcess := GetModuleHandle('');
sleep(200);
StringhProcess:= IntToStr(hProcess);
Txt1.Text := StringhProcess;
end;
end.



and this is compiled one O.o ( attached item )

what am i doing wrong O.o!

p.d:

where it says: '' its MS process just that it doesn't let me post it
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed May 20, 2009 2:06 pm    Post subject: Reply with quote

If you are within a DLL try ImageNtHeader via MapViewOfFile.

If you are using a stand-alone application, then you'll have to use OpenProcess.

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed May 20, 2009 5:27 pm    Post subject: Re: Getting Handle Reply with quote

gunminiho wrote:
well i want to get Handle for MS, im using delphi but my result is 0 O.o!!! im using a form to get Module, this is my code:

Code:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    Label1: TLabel;
    Txt1: TEdit;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  hProcess:Integer;
  StringhProcess:String;

implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);

begin
hProcess := GetModuleHandle('');
sleep(200);
StringhProcess:= IntToStr(hProcess);
Txt1.Text := StringhProcess;
end;
end.



and this is compiled one O.o ( attached item )

what am i doing wrong O.o!

p.d:

where it says: '' its MS process just that it doesn't let me post it


Lol... GetModuleHandle Retrieves the handle of a Module in the current process... And besides it doesn't return a hProcess Handle. It returns the base address of the module to get a handle for rvm/wvm you need to use OpenProcess like Lurc Said.
Back to top
View user's profile Send private message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Wed May 20, 2009 7:01 pm    Post subject: Re: Getting Handle Reply with quote

dnsi0 wrote:
gunminiho wrote:
well i want to get Handle for MS, im using delphi but my result is 0 O.o!!! im using a form to get Module, this is my code:

Code:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    Label1: TLabel;
    Txt1: TEdit;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  hProcess:Integer;
  StringhProcess:String;

implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);

begin
hProcess := GetModuleHandle('');
sleep(200);
StringhProcess:= IntToStr(hProcess);
Txt1.Text := StringhProcess;
end;
end.



and this is compiled one O.o ( attached item )

what am i doing wrong O.o!

p.d:

where it says: '' its MS process just that it doesn't let me post it


Lol... GetModuleHandle Retrieves the handle of a Module in the current process... And besides it doesn't return a hProcess Handle. It returns the base address of the module to get a handle for rvm/wvm you need to use OpenProcess like Lurc Said.


hmm ^.^, same as i were using WriteProcessMemory isn't it?

lurc wrote:
If you are within a DLL try ImageNtHeader via MapViewOfFile.

If you are using a stand-alone application, then you'll have to use OpenProcess.


hmm would you main to explain a bit more about ImageNtHeader via MapViewOfFile, i have knowlegde about OpenProcess but i have no idea about the other, i would like to learn ^.^ that method, when im using a dll i use VirtualProtect ^.^
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed May 20, 2009 7:53 pm    Post subject: Re: Getting Handle Reply with quote

gunminiho wrote:
dnsi0 wrote:
gunminiho wrote:
well i want to get Handle for MS, im using delphi but my result is 0 O.o!!! im using a form to get Module, this is my code:

Code:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    Label1: TLabel;
    Txt1: TEdit;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  hProcess:Integer;
  StringhProcess:String;

implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);

begin
hProcess := GetModuleHandle('');
sleep(200);
StringhProcess:= IntToStr(hProcess);
Txt1.Text := StringhProcess;
end;
end.



and this is compiled one O.o ( attached item )

what am i doing wrong O.o!

p.d:

where it says: '' its MS process just that it doesn't let me post it


Lol... GetModuleHandle Retrieves the handle of a Module in the current process... And besides it doesn't return a hProcess Handle. It returns the base address of the module to get a handle for rvm/wvm you need to use OpenProcess like Lurc Said.


hmm ^.^, same as i were using WriteProcessMemory isn't it?

lurc wrote:
If you are within a DLL try ImageNtHeader via MapViewOfFile.

If you are using a stand-alone application, then you'll have to use OpenProcess.


hmm would you main to explain a bit more about ImageNtHeader via MapViewOfFile, i have knowlegde about OpenProcess but i have no idea about the other, i would like to learn ^.^ that method, when im using a dll i use VirtualProtect ^.^


Don't even bother exploring Image Headers and that stuff if you can't even get readprocessmemory/writeprocessmemory working.
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