Solved How to hook GetTickCount()

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

uNdead

Newbie
Full Member
Jan 6, 2013
16
468
0
Hey Guys, I tried to hook the the GetTickCount() function, so I can create a little speedhack (not for a online game) ;)

The Problem is that the DLL Injection works and I get the message that its attached but the Detour don't work :/ I never done anything like that because I normally only write external stuff xD does anybody know what I done wrong?

C++:
DWORD	WINAPI GetTickCount_Detour(void);								
DWORD	INITTICK = GetTickCount();

DETOUR_TRAMPOLINE(DWORD WINAPI GetTickCount_Trampoline(void),GetTickCount);	
								
BOOL APIENTRY DllMain( HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	switch(ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			// WORKS
			MessageBox(NULL, "ATTACHED", NULL, MB_OK);
			DisableThreadLibraryCalls(hModule);
	        DetourFunction((PBYTE)GetTickCount_Trampoline,(PBYTE)GetTickCount_Detour);
		break;

		case DLL_PROCESS_DETACH:
		   MessageBox(NULL, "DETACHED", NULL, MB_OK);
	       DetourRemove((PBYTE)GetTickCount_Trampoline,(PBYTE)GetTickCount_Detour);
			
		break;
	}
	return true;
}

DWORD WINAPI GetTickCount_Detour()
{	
	// NEVER COMES TO THIS POINT
	MessageBox(NULL, "DETOUR", NULL, MB_OK);

    DWORD CURRENTTICK = GetTickCount_Trampoline();

	return ( INITTICK + (CURRENTTICK - INITTICK) * 250 );

}
PASTEBIN LINK

Thx ;)
 
Last edited:

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
it looks ok, how are you doing the hook in DetourFunction?
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
yeah the rest looks ok, so there might be something wrong in that?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods