les di, CBInfo ;es:di points to SWCALLBACKINFO structure
mov ax, 0005h ;Unhook Notification Chain
call [Service] ;service-function handler
jc error_handler ;carry set on error
Unhook Notification Chain (Service Function 0005h) directs the task switcher to remove the specified SWCALLBACKINFO structure from its notification chain. Client programs that are on the notification chain must call this function when they terminate.
CBInfo
Points to the client program's SWCALLBACKINFO structure. The SWCALLBACKINFO structure has the following form:
SWCALLBACKINFO STRUC
scbiNext dd ? ;address of next structure in chain
scbiEntryPoint dd ? ;address of notification-function handler
scbiReserved dd ? ;reserved
scbiAPI dd ? ;address of list of SWAPIINFO structures
SWCALLBACKINFO ENDS
For a full description of the SWCALLBACKINFO and SWAPIINFO structures, see Section 7.11, “Structures.”
If the function is successful, the carry flag is clear and the AX register contains 0000h. If the task switcher does not support this function, the carry flag is set.
Whether a client program has used Build Notification Chain (Interrupt 2Fh Function 4B01h) or Hook Notification Chain (Service Function 0004h), it must call Unhook Notification Chain to remove itself from the notification chain of every task switcher to which it belongs.
A task switcher that rebuilds its notification chain at every session switch can return from Unhook Notification Chain with no other action.
A task switcher processing Unhook Notification Chain can enable interrupts and call any MS-DOS system function. Although the task switcher modifies the AX register, it must preserve all other registers.
Interrupt 2Fh Function 4B01h Build Notification Chain
Service Function 0004h Hook Notification Chain