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 


Retrieve MapleStory path with delphi

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

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Jul 22, 2007 5:05 pm    Post subject: Retrieve MapleStory path with delphi Reply with quote

Simple function that requires no more uses than Windows, whipped this up because I saw people instead looking through some of the possible paths whereas Nexon could change it at any time (and it's been changed thrice). Returns a pointer to a C string, (compatible with TString) remember to free after use.

Code:

function GetMapleStoryPath(): PChar;
var
  Key : HKEY;
  KOK, Size : Cardinal;
  Lul : PChar;
begin
  result := nil;

  if RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'SOFTWARE\Wizet\MapleStory', 0, KEY_QUERY_VALUE, Key) <> 0 then
    exit
  else
  begin
    Lul := VirtualAlloc(nil, MAX_PATH, MEM_COMMIT, PAGE_READWRITE);
    KOK := RegQueryValueEx(Key, 'ExecPath', nil, nil, PByte(Lul), @Size);
    RegCloseKey(Key);
    if KOK = 0 then Result := Lul else VirtualFree(Lul, 0, MEM_RELEASE);
  end;
end;
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Jul 22, 2007 6:12 pm    Post subject: Reply with quote

Thanks, but im cirious about programmers, why do they write like:


Code:

 <> 0 then
    exit
  else
  begin



it goes <----

get me ?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Jul 22, 2007 6:17 pm    Post subject: Reply with quote

because of delphi's auto indentation, plus it's easier to read when indented like that. when you look at code from delphi sites like torry, they're indented like that too, so it's not a personal thing. Borland even has guidelines for indenting.
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Jul 22, 2007 6:36 pm    Post subject: Reply with quote

appalsap wrote:
because of delphi's auto indentation, plus it's easier to read when indented like that. when you look at code from delphi sites like torry, they're indented like that too, so it's not a personal thing. Borland even has guidelines for indenting.


I see...

i made up something similiar with it using shellexecute

shellexecute(
handle,
'open',
'YOURFILE/URLHERE',
nil,
nil,
SW_SHOWNORMAL);
Back to top
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Mon Jul 23, 2007 9:16 am    Post subject: Reply with quote

Since I've done a little research on the path earlier today I actually understand this code without knowing delphi at all.

question here though: "VirtualAlloc" allocate memory for what? I don't remember having to do this...

_________________
Get kidnapped often.
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