 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Hellcat
Joined: 24 Jan 2007 Posts: 84
|
Posted: Sat Feb 09, 2008 7:41 pm Post subject: Finding a Driver (in mem) and it's functionlist |
|
|
Hi there.
I want to find/locate a driver (MS, for example) in the memory during runtime and it's functions list.
Reasons are that for one project I want to call functions of the driver that don't have wrappers in the usual sceIo....() functions - at least not to my knowledge. (IoInit() would be one) - and for another app, I'd like to hook some (like done when doing flash-over-USB, but for something else).
I already have this snippet, which I also have successfully used:
| Code: | PspIoDrv *FindDriver(char *drvname)
{
u32 *mod = (u32 *)sceKernelFindModuleByName("sceIOFileManager");
if (!mod)
{
return NULL;
}
u32 text_addr = *(mod+27);
u32 *(* GetDevice)(char *) = (void *)(text_addr+0x16D4);
u32 *u;
u = GetDevice(drvname);
if (!u)
{
return NULL;
}
return (PspIoDrv *)u[1];
} |
But due to the hardcoded offsets this only works on 1.50 - but I'd like my stuff running on every FW.... well at least 3.xx CFWs.
So, I need a more generic way of finding the driver and it's functions list.
Anyone be willing to hint me into the right direction? :) |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Sat Feb 09, 2008 8:49 pm Post subject: |
|
|
CFW exports the function sctrlHENFindDriver that does what you want. (and thus, you don't need to use specific text_addr that differ between firmware versions). Given a driver name (without ":"), it will return a pointer to it (or NULL if no found).
Note that although the function can be called from user mode too, the returned pointer can only be manipulated by kernel code. |
|
| Back to top |
|
 |
|
|
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
|