forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[HELP] Hooking sctrlSEGetVersion

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Zer01ne



Joined: 08 Sep 2008
Posts: 29

PostPosted: Tue Jun 16, 2009 3:59 am    Post subject: [HELP] Hooking sctrlSEGetVersion Reply with quote

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

Code:

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
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Jun 16, 2009 11:43 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Zer01ne



Joined: 08 Sep 2008
Posts: 29

PostPosted: Fri Jun 19, 2009 6:40 am    Post subject: Reply with quote

Torch you have a exemple ? i have tested all code finded on this forum but MAKE_JUMP patchJump and other nothing work !!!
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Fri Jun 19, 2009 9:38 am    Post subject: Reply with quote

Use search?
http://forums.ps2dev.org/viewtopic.php?t=11894
Back to top
View user's profile Send private message
Zer01ne



Joined: 08 Sep 2008
Posts: 29

PostPosted: Fri Jun 19, 2009 10:39 am    Post subject: Reply with quote

I have used search but this is dont work if possible sctrlSEGetVersion i cant be hooked ?
Back to top
View user's profile Send private message
kralyk



Joined: 06 Apr 2008
Posts: 114
Location: Czech Republic, central EU

PostPosted: Fri Jun 19, 2009 4:31 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Sat Jun 20, 2009 10:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group