 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sun Jul 22, 2007 5:05 pm Post subject: Retrieve MapleStory path with delphi |
|
|
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 |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Jul 22, 2007 6:12 pm Post subject: |
|
|
Thanks, but im cirious about programmers, why do they write like:
| Code: |
<> 0 then
exit
else
begin
|
it goes <----
get me ?
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sun Jul 22, 2007 6:17 pm Post subject: |
|
|
| 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 |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Jul 22, 2007 6:36 pm Post subject: |
|
|
| 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 |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Mon Jul 23, 2007 9:16 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|