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 

"Deferred" syscall hook

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



Joined: 05 Jan 2008
Posts: 489

PostPosted: Wed Apr 02, 2008 10:43 pm    Post subject: "Deferred" syscall hook Reply with quote

Before someone comes up shouting that's certainly a piracy related issue, i have to say it is not. I'm not referring to a particular case because i have 2 or 3 different projects that may need this.
I have to perform the following task:
hook functions of a module not normally loaded into memory (i.e. applications will load it when needed) and i only need it when a certain application is running (but i don't really care if this continues working when app is already exited). I had the following ideas:
1) (from prx plugin) keep checking if module has been loaded in a poll-and-wait cycle, then patch it
2) (from prx plugin) load the module and patch it, then leave it _always_ in memory for apps requiring it
3) (from prx plugin) first patch the sceUtility function used to load modules, then in the patched function perform a check: if module to load is the module we have to patch, load it and patch it.
4) (from eboot.pbp) load the required module, patch it and then load the second eboot/iso app. On exit, module can be unloaded (maybe sceKernelExitGame(); should be patched as well)

I see every method has pros and cons, so i would like some advices before i start a two months coding session and finally realize that it was the wrong method X(
First two methods are quick-and-dirty, the first consumes CPU while the second wastes a small amount of RAM. 3 is a real mess (and i can't swear it will work because i'm not sure on how the application loads the module); 4 seems to be the finer, but i had to deal with the eboot/iso loader hell....

Has something like this been already done? (of course yes, but i mean: something i can look into...) What method would you choose if you had to do something like this?? thanks in advance.

jean
Back to top
View user's profile Send private message
alexp



Joined: 17 Apr 2007
Posts: 39

PostPosted: Wed Apr 02, 2008 11:03 pm    Post subject: Reply with quote

I'm trying to do something really similar and until now i've tried the first two approach, the first one is too much dependent on timing issues. I've had some problem with the second approach too because trying to load a vsh module from a kernel mode prx result in an illegal permission error. If i load such module from seplugins using CF functionality it seems that the game will then load a second instance of the module, so overriding the patch.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Wed Apr 02, 2008 11:15 pm    Post subject: Reply with quote

Quote:
seems that the game will then load a second instance of the module, so overriding the patch


S**T!! It was the most simple solution (and hence one of the first i was to check :P )
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Apr 03, 2008 12:57 am    Post subject: Reply with quote

The modern CFs have a hook function which will be called when ever a module is loaded, at which point you can patch it. I don't recall the function, "USE THE SEARCH"!
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Thu Apr 03, 2008 2:47 am    Post subject: Reply with quote

Quote:
"USE THE SEARCH"

Ok, ok...Sorry about it, but i don't even know how such a feature could be called (in fact i invented the "deferred hook" definition) and i did take a look into sdk before asking...This is not one of the "how can i sum two integer numbers?" questions we're reading here nowadays, i think you can save your voice for that :P
Thanks anyway
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Thu Apr 03, 2008 7:43 am    Post subject: Reply with quote

sctrlHENSetStartModuleHandler(SceModule2 *mod)
This is the functions TyraNid was speaking about....but the point is it's not working.... I'm trying to find the very moment an app is trying to access a usb device. I tryed logging modules loaded for instance by deniska while starting up usbgps.prx or the xmb starting up go!cam...
sceUsbStart(...) eventually does not depend upon the same functions loading standard modules....
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