Hi all.
I have write some application, which patches some system routine (for
example "find").
This should be application and not hack (that is requirement).
I do the following:
When my application started first time, I allocate feature for the procedure
Err InstallTrap()
{
static MemPtr p1;
static MemPtr p2;
UInt32 result = 0;
UInt32 size;
void* SHEptr = 0;
void* OldSysHandleEventP = 0;
// Allocate a block large enough to hold the above procedure.
p1 = (MemPtr) InsteadFind;
p2 = (MemPtr) InstallTrap;
size = (UInt32)p2 - (UInt32)p1;
if(FtrPtrNew('XXX',3000,size,&SHEptr))
return (memErrNotEnoughSpace);
result=FtrGet('XXX',3000,(UInt32*)&SHEptr);
if(!result)
DmWrite(SHEptr,0,InsteadFind, size);
// Install SHE Patch
OldSysHandleEventP = SysGetTrapAddress(sysTrapFind);
SysSetTrapAddress(sysTrapFind, SHEptr );
return ( result );
}
My patched function ("InsteadFind") simply opens some form (that works).
But when I trying change something on the form (label string for example),
I got fatal error.
What is wrong ???
Thanks a lot. Help me please, I need it urgently
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/