Eric, this topic had been covered already in the list. Search for it.
I believe your question is rather how to get the pointer within the function
that you have overwritten so you can dispatch the calls.

There are two approaches in general: to store the pointer somewhere, where
it is accessible during SysTrap, and the HackMaster approach, which is to
allocate a small piece of memory at startup and modify it so that it
contains _code_, than points or directly returns that value.

The first approach is easier, but less safe. Be careful and do not use
FtrSet/FtrGet pair, which doesn't work under most of the SysTraps (well,
haven't tried them all: under _some_ of the SysTraps). Using SysTrapReserved
is an option, but, as Bob and David Fedor have said about 15000
times....it's rude and unsecured...

The second approach requires some Assembler knowledge. Or, I remember a
posting (maybe by Ken Krugler) that contained a piece of such code for C.

Finally, I'd once again suggest that you try and catch DmGetResource. It
worked for me when I had to replace the system keyboard.

Hope this helps,
Bobby Kolev




-----Original Message-----
From: Daniel McCarty <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, August 17, 1999 3:51 PM
Subject: Re: how to save a function pointer?


>Eric wrote:
>>
>>         my patch replace the system keyboard, I use sysgettrapaddress to
>> get the system keyboard function pointer first, I want to save it in
>> database so that I can recover it later.
>>
>> void (*oldKeyboardPtr)(KeyboardType);
>> oldKeyboardPtr=SysGetTrapAddress(0xA2E2);
>>
>> how to save the oldKeyboardPtr?
>
>   Saving sys trap pointers (dynamic) in databases (static) isn't
>a very good idea.  What is it that you're trying to do that would
>cause you to have to "recover" the trap address?
>
>-Daniel.

Reply via email to