Interrupt 2Fh Function 4B02h Detect Switcher

mov bx, 0 ;must be zero

mov di, 0

mov es, di ;es:di must be zero

mov ax,4B02h ;Detect Switcher

int 2Fh ;Multiplex Interrupt

mov cx, es

or cx, di

je no_switcher ;es:di is zero if no task switcher loaded

mov WORD PTR [Service], di

mov ax, es

mov WORD PTR [Service+2], ax

;es:di is service-function handler address

Detect Switcher (Interrupt 2Fh Function 4B02h) determines whether a task switcher is loaded. Client programs (such as a session manager) that need to prevent or control the interruptions caused by task switching should call this function during initialization.

Parameters

This function has no parameters.

Return Value

If a task switcher is loaded, the AX register contains 0000h and the ES:DI registers contain the address of the service-function handler for the task switcher. Otherwise, the ES:DI registers contain zero.

Comments

If a task switcher is loaded, the function returns the address of the task switcher's service-function handler. 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).

Detect Switcher returns the service-function handler address of the most recently loaded task switcher. A client program can check for other task switchers by examining the svsPrevSwitcher field in the SWVERSION structure returned by Get Version (Service Function 0000h). If this field contains a nonzero value, it points to the service-function handler for another task switcher. The client program can call this handler to retrieve and examine the other task switcher's SWVERSION structure, and it can continue this process until reaching the svsPrevSwitcher field for the first task switcher loaded, which contains zero.

The SWVERSION structure has the following form:

SWVERSION STRUC

svsAPIMajor dw ? ;protocol supported major version

svsAPIMinor dw ? ;protocol supported minor version

svsProductMajor dw ? ;task switcher's major version

svsProductMinor dw ? ;task switcher's minor version

svsSwitcherID dw ? ;task-switcher identifier

svsFlags dw ? ;operation flags

svsName dd ? ;points to task-switcher name (ASCIIZ)

svsPrevSwitcher dd ? ;previous task switcher's entry address

SWVERSION ENDS

For a full description of the SWVERSION structure, see Section 7.11, “Structures.”

A task switcher processing Detect Switcher can enable interrupts and call any MS-DOS system function. Although the task switcher modifies the AX, ES, and DI registers, it must preserve all other registers.

See Also

Service Function 0000h Get Version
Service Function 0004h Hook Notification Change