Notification Function 0000h Init Switcher

les di, Service ;addr of task switcher's service-function handler

mov ax, 0000h ;Init Switcher

call [Notification] ;client program's notification-function handler

cmp ax, 0

jne no_load ;if nonzero, don't load

Init Switcher (Notification Function 0000h) notifies client programs that a new task switcher is being initialized.

Parameter

Service

Points to the service-function handler for the task switcher or controlling session manager. A client program can use this address to call the task switcher's service functions, such as Get Version (Service Function 0000h) and Hook Notification Chain (Service Function 0004h).

Return Value

The AX register contains 0000h if the task switcher can be loaded safely. Otherwise, it contains a nonzero value.

Comments

Task switchers (and controlling session managers) must call this function when they are initialized. A client program that runs in global memory and needs to take special action to coexist with a task switcher should do so when receiving this call.

The task switcher's service function handler (specified by the ES:DI registers) must support Get Version (Service Function 0000h).

Typically, a program that invokes and controls the task switcher calls Init Switcher, rather than the task switcher itself. If any client program returns a nonzero value to the Init Switcher call, the controlling program disables its task-switching option. Other task-switching programs may simply terminate if a client returns a nonzero value.

If any client program returns nonzero to Init Switcher, all client programs may receive a call to Switcher Exit (Notification Function 0007h), including the client program that returned nonzero. Client programs can ignore a Switcher Exit call that is not preceded by an Init Switcher call.

Because it is not necessarily the task switcher itself that calls this function, client programs should not assume that the service-function-handler address passed in the ES:DI registers will be the same address passed with subsequent notification functions. In particular, this address can be NULL.

The task switcher enables interrupts before calling the client program. The client program can call any MS-DOS system function. Although the client program modifies the AX register, it must preserve all other registers.

See Also

Service Function 0000h Get Version
Service Function 0004h Hook Notification Chain
Notification Function 0007h Switcher Exit