Required handler functions
Support for seven functions is required:
- INIT
Called only once by the system manager. This call enables the handler to perform any integrity checks and to optionally hook itself into the system. At this point the handler may make DOS calls as well as most system manager calls. If the handler will need to make DOS or system manager calls at a later time, it must get a service request entry (F_M_GET_SERVICE_ENTRY). System manager returns two far pointers. One pointer is to the allocated service request entry and the other points to a service request data structure (see next page). The remaining requests (besides INIT) are usually called by an application directly to the service handler via the handler's SVC_user_entry point. The calling application passes a far pointer to a buffer. The first byte of the buffer contains the command (equates for defined commands are located in SYSDEFS.H).
- LINK TO APP
Enables an application to link into the TSR service handler. The second byte of the passed buffer contains the app's TCB entry #. The handler sets the TSR service request field SVC_app_index to this value.
- UNLINK FROM APP
Dissociates linked app from the TSR service handler. No parameters are passed.
- HOOK DEVICE
Tells TSR service handler to capture necessary resources to provide service. This typically involves capturing interrupts, etc.
- UNHOOK DEVICE
Unhook any hooked interrupts and restore any changed system resources back to their original states. Note that the handler should check the current value of any hooked interrupt vector for indications that it has subsequently been hooked by another program. If it is not safe to restore the original interrupty vector, it must fail the request. The requesting app can then free the overlapped interrupt vector by requesting other handlers to unhook, returning back to the taget handler and re-issueing the unhook request. Finally it must request all other unhooked handlers to re-hook themselves.
- SERVICE COMPLETE
Called when an application (typically in background mode) has completed processing data from a handlers buffer, or has data ready to by processed by the handler.
- SERVICE UNLOAD
TSR service handler must unhook interrupts, release the service request entry and free the reserved static memory allocated by sysmgr. Failure may occur as in unhook command.