mov bx, ApiID ;asynchronous API identifier
mov ax, 0006h ;Query API Support
call [Service] ;service-function handler
jc error_handler ;carry set on error
mov WORD PTR [ApiInfo], bx
mov ax, es
mov WORD PTR [ApiInfo+2], ax ;es:bx points to SWAPIINFO structure
Query API Support (Service Function 0006h) returns the address of the SWAPIINFO structure of the client program that provides the highest level of support for the specified asynchronous API. Client programs that support asynchronous APIs call this function to determine which program should control session switching and handle the specified asynchronous API.
ApiID
Identifies an asynchronous API. This value can be one of the following:
Value | Meaning |
API_NETBIOS (0001h) | NETBIOS |
API_8022 (0002h) | 802.2 |
API_TCPIP (0003h) | TCP/IP |
API_LANMAN (0004h) | LAN Manager named pipes |
API_IPX (0005h) | NetWare IPX |
If the function is successful, the carry flag is clear, the AX register contains 0000h, and the ES:BX registers contain the address of the SWAPIINFO structure of the client program that provides the highest level of support for the specified asynchronous API. If the task switcher does not support this function, the carry flag is set.
The SWAPIINFO structure has the following form:
SWAPIINFO STRUC
aisLength dw 10 ;size of this structure, in bytes
aisAPI dw ? ;API identifier
aisMajor dw ? ;major version number
aisMinor dw ? ;minor version number
aisSupport dw ? ;support level
SWAPIINFO ENDS
For a full description of the SWAPIINFO structure, see Section 7.11, “Structures.”
This function allows client programs that provide support for the same asynchronous API to negotiate which program controls session switching. Each client program maintains information about the asynchronous APIs it supports and the level of support provided to each API in a list of SWAPIINFO structures. The program provides a pointer to the beginning of this list in its SWCALLBACKINFO structure. (For a full description of the SWCALLBACKINFO structure, see Section 7.11, “Structures.”) Since any number of client programs can provide support for the same API, the task switcher uses the aisSupport field in the SWAPIINFO structures to determine which client program provides the highest level of support and therefore receives control. In general, a client program provides the highest level of support if it allows session switching for the greatest number of special cases.
When a client program that supports an asynchronous API is processing Query Suspend (Notification Function 0001h) or Suspend Session (Notification Function 0002h), it must call Query API Support to determine whether it is the client program that should handle the API. If the function returns the address of the client program's own SWAPIINFO structure, the client program should prevent the session switch. If it returns the address of another client program's structure, the calling client program should not prevent the session switch, relying instead on the more capable client program to prevent the session switch if necessary.
When a task switcher processes Query API Support, interrupts are disabled if a client program calls this function while handling a notification function for which interrupts also are disabled. Otherwise, interrupts are enabled. If interrupts are disabled, the task switcher must not enable them or call MS-DOS system functions. Although the task switcher modifies the AX, ES, and BX registers, it must preserve all other registers.
Notification Function 0001h Query Suspend
Notification Function 0002h Suspend Session