| View previous topic :: View next topic |
| Author |
Message |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 4:14 pm Post subject: speedhack |
|
|
I wwas wondering, for cheatengine's speed hack, how did it work?
What api's did it use to speed up certain processes?

Last edited by slippppppppp on Fri Jan 04, 2008 10:36 pm; edited 2 times in total |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Fri Jan 04, 2008 4:24 pm Post subject: |
|
|
| Code: |
procedure TMainForm.btnSetSpeedhackClick(Sender: TObject);
resourcestring
strfailuretosetspeed='Failure to set the speed';
strIncorrectspeed='The speed value is incorrect';
strCantSetSpeed='I can''t set this speed. (must be bigger than 0)';
strHyperscanFailed='The hyperthread failed to respond with the right answer';
var x: dword;
speedf: single;
speed: dword absolute speedf;
sleeptime: integer;
speedtext: string;
i: integer;
begin
try
speedtext:=edit2.Text;
speedf:=strtofloat(speedtext);
except
try
if pos(',',speedtext)<>0 then
begin
//replace the , with a .
i:=pos(',',speedtext);
while i<>0 do
begin
speedtext[i]:='.';
i:=pos(',',speedtext);
end;
end
else
begin
//replace the . with a ,
i:=pos('.',speedtext);
while i<>0 do
begin
speedtext[i]:=',';
i:=pos('.',speedtext);
end;
end;
speedf:=strtofloat(speedtext);
except
raise exception.Create(strincorrectspeed);
end;
end;
sleeptime:=strtoint(edit1.text);
if speedf<=0 then raise exception.Create(strcantsetspeed);
if speedf*sleeptime<1 then
begin
try
sleeptime:=trunc(roundto(1/speedf,-1));
if sleeptime=0 then sleeptime:=1;
edit1.Text:=IntToStr(sleeptime);
except
exception.Create(strfailuretosetspeed);
end;
end;
x:=sendmessage(cefuncproc.hypermode.hyperscanwindow,wm_user+6,sleeptime,speed);
if x<>12345 then raise exception.Create(strHyperscanfailed);
|
~~~~
sendmessage:
| Code: |
function SendMessage; external user32 name 'SendMessageA';
|
_________________
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 4:26 pm Post subject: |
|
|
Ok, i saw that samurai, but what i want to know is that,
This:
cefuncproc.hypermode.hyperscanwindow
I dont want to strip code from there, but can i replace with that, HWND? |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Fri Jan 04, 2008 4:26 pm Post subject: |
|
|
it hooks timeGetTime, GetTickCount and QueryPerformanceCounter and let them return a fake time
The fake time is updated with a thread that is running at maximum priority that increases the timer every few milliseconds (sleeptime) so the speed will be a multiplication of the real time
source: cehook/speedhack.pas _________________
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 |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 4:28 pm Post subject: |
|
|
Okay, this is really complicated, how can i get this working without including all those other cheat engine files. I kind of understand speedhack.pas . But how do i use the functions in it?  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 9:16 pm Post subject: |
|
|
| Ok, i know how to hook them, but how would i get them to return a fake value? |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Jan 04, 2008 10:38 pm Post subject: |
|
|
| slippppppppp wrote: | | Ok, i know how to hook them, but how would i get them to return a fake value? |
If you have them hooked you can rewrite what they do and return any value you want. For example timeGetTime:
Return value is the system time in milliseconds.
| Code: | | DWORD timeGetTime(VOID); |
Once you have it hooked you should basically have a "detoured" function that you can call to be the new function such as:
| Code: |
DWORD WINAPI mine_timeGetTime(VOID)
{
// ... code here
} |
In your function you can return what ever you want, or make a call to the original function and return the normal value. _________________
- Retired. |
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 10:43 pm Post subject: |
|
|
Okay now wiccan, that isn't really the problem now, what i need help on is the SendMessage Part, when i enable it, i dont get errors, but the process is not different, so nothing really happend, and so far myfunctino looks like so:
sendmessage(WindowHandle,wm_user+6,sleeptime,speed);
WindowHandle Holds the HWND of a selected Window
SleepTime and Speed is modified through edit texts.
But this is still not working  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Jan 04, 2008 10:59 pm Post subject: |
|
|
Not sure why you are using SendMessage, can't say I have seen SendMessage used for a speed hack before. As DB pointed out in the source of CE, you can find the speedhack hook located in cehook/speedhack.pas _________________
- Retired. |
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri Jan 04, 2008 11:03 pm Post subject: |
|
|
Yes, i know that's the hook. But at the end of the button for speed hack, it says
x := SendMessage(CEFUNCPROC.HYPERMODE.something,wm_user+6,sleeptime,speed);
So, im guessing that sendmessage is the indicator to start the speed hack? |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Sat Jan 05, 2008 2:49 am Post subject: |
|
|
that sendmessage will only work when the cehook.dll has been injected and the controlwindow has been spawned _________________
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 |
|
 |
|