Discuss the development of new homebrew software, tools and libraries.
	Moderators:  cheriff , TyRaNiD 
			
		
		
			
				
																			
								Zer01ne 							 
									
		Posts:  28 Joined:  Mon Sep 08, 2008 7:15 am 
		
						
					
													
							
						
									
						Post 
					 
								by Zer01ne  Tue Jun 16, 2009 3:59 am 
			
			
			
			
			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
 
		 
				
		
		 
	 
				
		
		
			
				
								Torch 							 
									
		Posts:  825 Joined:  Wed May 28, 2008 2:50 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Torch  Tue Jun 16, 2009 11:43 pm 
			
			
			
			
			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  Fri Jun 19, 2009 6:40 am 
			
			
			
			
			Torch you have a exemple ? i have tested all code finded on this forum but MAKE_JUMP patchJump and other nothing work !!!
			
			
									
									
						 
		 
				
		
		 
	 
				
				
		
		
			
				
																			
								Zer01ne 							 
									
		Posts:  28 Joined:  Mon Sep 08, 2008 7:15 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Zer01ne  Fri Jun 19, 2009 10:39 am 
			
			
			
			
			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 pmLocation:  Czech Republic, central EU 
		
						
					
						 
													
							
						
									
						Post 
					 
								by kralyk  Fri Jun 19, 2009 4:31 pm 
			
			
			
			
			I dont think so, I think more likely you made some error.
			
			
									
									...sorry for my english... 
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								cory1492 							 
									
		Posts:  216 Joined:  Fri Dec 10, 2004 1:49 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by cory1492  Sat Jun 20, 2009 10:23 am 
			
			
			
			
			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.