Solved Hooking function to grab register in assembly and save it for use

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Rekker

Newbie
Full Member
Jan 20, 2016
8
72
0
As in the title how would i grab the address which is dynamic in the R15 register at that location to use? Also when i press F5 pseudocode never seems to work properly as well! Thanks

 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,118
78,998
2,392
Place a jmp where that line is, jmp to a code that does this:
QWORD buffer;
Code:
_asm
{
mov buffer, r15;

//insert stolen bytes here

//jump back to address of stolen bytes + length of stolen bytes
}
Check out this for further explanation of the hooking part:
 
Last edited:

Rekker

Newbie
Full Member
Jan 20, 2016
8
72
0
Hi this is all well but now its x64 where it is not supported and we can use masm apparently found this vid but still having a bit of a struggle converting it


https://www.youtube.com/watch?v=guru397zg2g

https://guidedhacking.com/showthread.php?3233-Mid-function-hooking

C++:
bool Hook(void * toHook, void * ourFunct, int len) {

	if (len <= 5) {
		return false;
	}

	unsigned long curProtection;
	VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
	memset(toHook, 0x90, len);

	unsigned long relativeAddress = ((unsigned long)ourFunct - (unsigned long)toHook) - 5;

	*(BYTE*)toHook - 0xE9;
	*(unsigned long*)((unsigned long)toHook + 1) - relativeAddress;

	unsigned long temp;
	VirtualProtect(toHook,len,curProtection,&temp);

	return true;
}

unsigned long buffer,jmpBackAddy;

void __declspec(naked) ourFunct() {

	__asm {
		mov buffer, [r15]
		movaps[r15], xmm4
		jmp [jmpBackAddy]
	}

}

unsigned long hookAddress = (DWORD64)GetModuleHandle(0) + 0x165D361;
	int hookLength = 8;
	jmpBackAddy = hookAddress + hookLength;
	Hook((void*)hookAddress, ourFunct, hookLength);
 
Last edited:

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,298
37,938
269
Due to it being x64, you need to create a seperate .asm file and within that contain your actual assembly code, you can make it a very simple jumpgate ( push r15, jump <some C++ function to handle shit> ), or do it entirely in assembly, up to you.
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Due to it being x64, you need to create a seperate .asm file and within that contain your actual assembly code, you can make it a very simple jumpgate ( push r15, jump <some C++ function to handle shit> ), or do it entirely in assembly, up to you.
Or you use the Intel Compiler which supports x64 inline assembly :^)
 
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