Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> restoring the parent program</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Restoring the parent program
------------------------------------------------------------------------------
 Following termination of the child program, the resident kernel reloads the
 parent's memory image exactly as it was prior to executing the child
 program. Any XMS/EMS and/or disk space used for storage of the image is
 freed and execution of the parent program continues.

 Interrupt-driven routines

 If your program contains interrupt handlers, either written by you or linked
 in from a function library, the interrupt vectors will be automatically
 saved and restored correctly by the swap function.

 Mice

 If your program uses a mouse (or similar device), your program's idea of the
 mouse state may well be incorrect when the program image is restored, as the
 mouse may have moved or been reset during the swap.
 For this reason, you should do the following:

 . save the mouse state
 . disable the mouse
 . call the swap function
 . enable the mouse
 . restore the mouse state

 It is especially important that you disable the mouse prior to executing the
 swap if you have registered an alternate mouse handling function with the
 mouse driver. If the mouse handler is not disabled, the mouse driver will
 attempt to call your routine when a mouse event occurs, but as your program
 will no longer be in memory, the result will most likely be a catastrophic
 system failure.

 By default the swap function only saves and restores the current address of
 the mouse handler and the call mask. No other information is saved or
 restored.

 Call-back functions

 A "call back function" in this context is any routine whose address has been
 passed to any software external to the program, which may periodically call
 your function. The preceding alternate mouse handler is an example of this
 type of mechanism.
 If your application has installed any routine as a call back function, the
 call back routine must be unhooked before the swap is executed, and
 re-hooked after the parent has been restored.

 TSRs

 When the swap function restores the parent's image, any TSRs installed
 during the swap will be removed from memory. While this will work correctly
 with many TSRs, it is always preferable (and recommended) that TSRs be
 removed from memory through the use of their own removal mechanisms, prior
 to returning to the parent program.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson