Interrupt 2Fh Function 4B01h Build Notification Chain

mov bx, 0

mov es, bx ;es:bx is zero

mov dx, WORD PTR [Service]

mov cx, WORD PTR [Service+2]

;cx:dx is service-function handler address

mov ax, 4B01h ;Build Notification Chain

int 2Fh ;Multiplex Interrupt

mov cx, es

or cx, di

je no_notifychain ;es:bx is zero if no notification chain

Build Notification Chain (Interrupt 2Fh Function 4B01h) creates a linked list of notification-function handlers for global client programs and for client programs running in the current session. The task switcher calls this function to determine which client programs are to be notified about changes to the session. To receive notification, client programs must intercept Interrupt 2Fh and process Build Notification Chain when they receive the function call.

Parameter

Service

Points to the service-function handler for the task switcher. A client program can use this address to call the task switcher's service functions, such as Get Version (Service Function 0000h) and Test Memory Region (Service Function 0001h).

Return Value

If a client program is to be notified, the ES:BX registers contain the address of an SWCALLBACKINFO structure containing information about the client program. Otherwise, the ES:BX registers contain zero.

Comments

A client program's Interrupt 2Fh handler processes this function. If the client program does not require notifications, its handler must use the jmp instruction to transfer control to the previous Interrupt 2Fh handler (whose address the client program must save when it installs its own handler). If a client program requires notification, its Interrupt 2Fh handler must first pass Build Notification Chain to any other client programs that also require notification, by pushing the flags and using the call instruction to call the previous handler. The handler must not modify registers before calling the previous handler.

When the previous handler returns, the ES:BX registers contain either zero or the address of an SWCALLBACKINFO structure for another client program. In either case, before the client program can return from the interrupt, it must fill its own SWCALLBACKINFO structure, copy the contents of the ES:BX registers to the scbiNext field of its own structure, and copy the address of its SWCALLBACKINFO structure into the ES:BX registers.

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.”

A client program processes Build Notification Chain only after all previously loaded client programs have processed it. The most recently loaded client program is always first in the notification chain, followed by the next most recently loaded, and so on.

The relationship between loading order and processing order is important, since it gives a client program requesting asynchronous services from other clients a chance to cancel those requests when the task switcher notifies it of a pending switch. If the order were reversed, the client program providing the asynchronous service would have to block the switch until it completed the service.

Any client program that provides services to other programs must add itself to the notification chain.

A client program should not save the Service address, since the task switcher may change its current service-function-handler address at any time. To ensure that a client program always has the latest address of the service-function handler, the task switcher sends the latest address with each notification function.

Although a client program modifies the ES and BX registers, it must preserve all other registers.

See Also

Service Function 0000h Get Version
Service Function 0001h Test Memory Region