Int 21H [3.3] Function 67H (103) Set handle count

Sets the maximum number of files and devices that may be opened simultaneously using handles by the current process.

Call with:

AH = 67H

BX = number of desired handles

Returns:

If function successful

Carry flag = clear

If function unsuccessful

Carry flag = set

AX = error code

Notes:

This function call controls the size of the table that relates handle numbers for the current process to MS-DOS's internal, global table for all of the open files and devices in the system. The default table is located in the reserved area of the process's PSP and is large enough for 20 handles.

The function fails if the requested number of handles is greater than 20 and there is not sufficient free memory in the system to allocate a new block to hold the enlarged table.

If the number of handles requested is larger than the available entries in the system's global table for file and device handles (controlled by the FILES entry in CONFIG.SYS), no error is returned. However, a subsequent attempt to open a file or device, or create a new file, will fail if all the entries in the system's global file table are in use, even if the requesting process has not used up all its own handles.

Example:

Set the maximum handle count for the current process to thirty, so that the process can have as many as 30 files or devices opened simultaneously. (Five of the handles are already assigned to the standard devices when the process starts up.) Note that a FILES=30 (or greater value) entry in the CONFIG.SYS file would also be required for the process to successfully open 30 files or devices.

.

.

.

mov ah,67h ; function number

mov bx,30 ; maximum number of handles

int 21h ; transfer to MS-DOS

jc error ; jump if function failed

.

.

.