From: | Sensei |
Date: | 22 Sep 2001 at 00:40:08 |
Subject: | [amiga-c] Re: SetFunction vs SetFunction |
Czesc Twelvebullets!
Dnia 21-Sep-01, Twelvebullets napisał:
> How do I patch an Exec function, or indeed any library funtion. Do I
> need to pass the address of the library i`m patching in __A6 ??
It's very recommended that you do it (library base can be context depended!),
but it's not possible if you're patching library function to another library
function... I would strongly suggest to not use such techniques and use
simple patches to library functions without another library, or at least
write wrapper which will load correct library base register before executing
patch function,...
// direct patch function for SetFunction().
// at a6 you have always true patched library base.
static __saveds __asm BPTR NewOpen(
register __d1 STRPTR filename,
register __d2 ULONG mode,
register __a6 struct DosLibrary *DOSBase )
{
// do your patch stuff here.
return( ( *OldOpen )( filename, mode, DOSBase ) );
}
// your my.library library function.
static __saveds __asm BPTR MyNewOpen(
register __d1 STRPTR filename,
register __d2 ULONG mode,
register __a6 struct MyBase *MyBase )
{
return( NewOpen( filename, mode, MyBase->mb_DOSBase ) );
}
Regards!
Przemyslaw 'SENSEI' Gruchala
code/gfx2d/gfx3d/webmaster
Amiga 1200
Apollo 1240/33 MHz, 18 MB RAM, BTC 33.6 bps
HDD 3.2 GB, HDD 520 MB, CD x12
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/JNm9_D/33_CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/