 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
wofo Expert Cheater
Reputation: 0
Joined: 12 Aug 2007 Posts: 211
|
Posted: Mon Dec 10, 2007 1:13 pm Post subject: Plz explain me this code |
|
|
Hi, I am starting in delphi and wanting to learn how to make trainers. Some1 gave me this code | Code: | var
Form1: TForm1;
WindowName : integer;
ProcessId : integer;
ThreadId : integer;
buf : PChar;
HandleWindow : Integer;
write : cardinal;
implementation
{$R WindowsXP.RES}
Const
WindowTitle = 'GTA: Vice City';
Address = 8223480;
NumberOfBytes = 2;
Banshee = 159;
{$R *.dfm}
procedure TForm1.ListBox1Click(Sender: TObject);
begin
If ListBox1.Selected [0] then
begin
WindowName := FindWindow(nil,WindowTitle);
If WindowName = 0 then
begin
MessageDlg('Vice City must be running. Run it now, and then try again.', mtwarning,[mbOK],0)
end
else
ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
GetMem(buf,1);
buf^ := Chr(Banshee);
WriteProcessMemory(HandleWindow,ptr(Address),buf,N umberOfBytes,write);
FreeMem(buf);
closehandle(HandleWindow);
end;
|
I tried to use it but cant modify addresses wich have characters, could some1 explain me how to do it?
Thanks in advance.
_________________
! 10\/3 1337
Happy Cheating guys |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Dec 10, 2007 1:22 pm Post subject: |
|
|
i recommend actually learning the language before going into anything advanced...
_________________
|
|
| Back to top |
|
 |
Devilizer Master Cheater
Reputation: 0
Joined: 22 Jun 2007 Posts: 451
|
Posted: Mon Dec 10, 2007 1:24 pm Post subject: |
|
|
| lurc wrote: | | i recommend actually learning the language before going into anything advanced... |
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Mon Dec 10, 2007 2:29 pm Post subject: |
|
|
var
Form1: TForm1; // doesnt have to be here
WindowName : integer; // window name declared as an integer
ProcessId : integer; // process declared as integer
ThreadId : integer; // ThreadIddeclared as integer
buf : PChar; // bug declared as a Pchar
HandleWindow : Integer; // Handle Window declared as integer
write : cardinal; // write declared as cardinal
implementation
{$R WindowsXP.RES}
Const // constants, ie symbol = XXX
WindowTitle = 'GTA: Vice City'; // WindowTitle's value
Address = 8223480; // address to write to
NumberOfBytes = 2; // bytes for room
Banshee = 159; // a random name with value, ie: the value to get banshee is 159?
{$R *.dfm}
procedure TForm1.ListBox1Click(Sender: TObject);
begin
If ListBox1.Selected [0] then
begin
WindowName := FindWindow(nil,WindowTitle); // WindowName's value = result of FindWindow 'GTA: Vice City'
If WindowName = 0 then // if the window cannot be found
begin
MessageDlg('Vice City must be running. Run it now, and then try again.', mtwarning,[mbOK],0) // show an error message
end
else // if window is found
ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId); // ThreadId's value is result of GetWindowThreadProcessId, gets the PID of the WindowName.
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
// Handle Window is the resulting value of Opening the process, PID, and giving you all access
GetMem(buf,1); // get memory, into buf
buf^ := Chr(Banshee); // puts the value of banshee into buf
WriteProcessMemory(HandleWindow,ptr(Address),buf,N umberOfBytes,write); // Writes the process's memory, the address and the buf value.
FreeMem(buf); // freememory of bug
closehandle(HandleWindow); // close the window's handle
end;
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Mon Dec 10, 2007 7:01 pm Post subject: |
|
|
Lmao no wonder it doesn't work... I can find like 10 places where this code, if compiled, would totally bomb.
HandleWindow not declared as THandle,
ProcessID doesn't have a value...
ThreadID doesn't need to be declared at all
WindowName should be compared to NULL not 0
Improper parameters for APIs
Closing a handle that isn't valid will crash
No block after the else statement so all code after 1 line after else will run.
Conclusion, no way this will work. Learn the language first, not just follow one of Kaspersky's tutorials and replace stuff.
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Tue Dec 11, 2007 7:02 am Post subject: |
|
|
| rapion124 wrote: |
1. HandleWindow not declared as THandle,
2. ProcessID doesn't have a value...
3. ThreadID doesn't need to be declared at all
4. WindowName should be compared to NULL not 0
5. Improper parameters for APIs
run.
|
1. Thandle is dword - Integer.
2. | Code: | | GetWindowThreadProcessId(WindowName,@ProcessId);//Move the process ID to ProcessId |
3. Kaspersky code.
4. WindowName value is the window handle - integer.
5. all parameters are right.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Tue Dec 11, 2007 7:22 am Post subject: |
|
|
| slippp, Form1: TForm1; // doesnt have to be here, wtf ?
|
|
| 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
|
|