[HELP] Hooking sctrlSEGetVersion

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Zer01ne
Posts: 28
Joined: Mon Sep 08, 2008 7:15 am

[HELP] Hooking sctrlSEGetVersion

Post by Zer01ne »

Hello i have a problem with hooking the function sctrlSEGetVersion
This is part of the hooking code :

Code: Select all

int sctrlSEGetVersionPatched(int version)
{
	return version;
}

u32 orgaddr[2];
void (* PatchSyscall)(u32 funcaddr, void *newfunc);

PatchSyscall = (void *)sctrlHENFindFunction("SystemControl", "SystemCtrlForKernel", 0x826668E9);

			if (!PatchSyscall)
			{
				PatchSyscall = (void *)sctrlHENFindFunction("SystemControl", "SystemCtrlForKernel", 0x02BFCB5F);

				if (!PatchSyscall){
					asm("breakn");
					return 1;
				}
			}

			//Get sctrlSEGetVersion
			orgaddr[0]=sctrlHENFindFunction("SystemControl", "SystemCtrlForKernel", 0xB47C9D77);
			//Get sctrlSEGetVersion
			orgaddr[1]=sctrlHENFindFunction("SystemControl", "SystemCtrlForUser", 0xB47C9D77);

			//Patch sctrlSEGetVersion
			PatchSyscall(orgaddr[0], sctrlSEGetVersionPatched);
			//Patch sctrlSEGetVersion
			PatchSyscall(orgaddr[1], sctrlSEGetVersionPatched);

			sceKernelDcacheWritebackAll();
			sceKernelIcacheClearAll();

The probleme is the hook is not exist do you have a solution ?

Sorry for my english
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Its not a syscall, it can't be hooked like that. You need to manually patch the original function to jump to your hook function.
Zer01ne
Posts: 28
Joined: Mon Sep 08, 2008 7:15 am

Post by Zer01ne »

Torch you have a exemple ? i have tested all code finded on this forum but MAKE_JUMP patchJump and other nothing work !!!
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

Zer01ne
Posts: 28
Joined: Mon Sep 08, 2008 7:15 am

Post by Zer01ne »

I have used search but this is dont work if possible sctrlSEGetVersion i cant be hooked ?
kralyk
Posts: 114
Joined: Sun Apr 06, 2008 8:18 pm
Location: Czech Republic, central EU

Post by kralyk »

I dont think so, I think more likely you made some error.
Does your module export the pathced function? It has to be exported...
...sorry for my english...
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

Anything can be hooked, so long as you have permission for the memory region, you can find the function in memory, and are willing to deal with a little assembly/disassembly when pre-made methods don't work as expected. It's not like the PSP has a secure hypervisor clobbering executeable memory modifications... especially once you get HEN in there.
Post Reply