8.7 Installing Callback Functions

TOOLHELP.DLL includes functions that enable you to trap an application's interrupts and notifications.

The InterruptRegister function installs a callback function that handles all system interrupts. The callback function must be reentrant and must explicitly preserve all register values. The InterruptUnRegister function restores the default processing.

The NotifyRegister function installs a notification callback function for a specific task. Typically, the notification callback function cannot use any Windows functions except the TOOLHELP.DLL functions and the PostMessage function. The NotifyUnRegister function restores the default processing.

The exit code returned by a non-Windows application may reflect an error encountered by Windows when it attempted to start the application, rather than a value returned by the application itself. These error values are as follows:

Error value Cause

0x81 Could not start the application because of a file-access problem. This problem originated either in the application or its PIF file. Following are likely reasons for this error value:
  File not found Path not found No file handles Invalid drive Access denied Sharing violation Invalid executable format
0x82 Could not start the application, because of insufficient memory or disk space.
0x83 Abnormal termination.
0x84 Could not start the application, because of incorrect version.
0x85 Could not start the application, because MS-DOS Interrupt 21h Function 4B00h (Load and Execute Program) failed.
0x86 Could not start the application, because the TOOLHELP.DLL task-switching functions prevented it from starting.