{***********************************************************************}
{									}
{ __MaxHnFil  Alter the maximum number of handles			}
{									}
{ procedure __MaxHnFil(    NoHandles : word;var ErrorCode : word);	}
{									}
{   NoHandles The number of open file handles allowed for this process. }
{   ErrorCode The returned DOS status code.				}
{	      (0) No of handles altered.				}
{	      (1) Invalid function.  DOS 3.30 or later is required.	}
{	      (8) Insufficient memory.	If the number of file handles	}
{		  is increased, DOS must allocate memory (approximately }
{		  48 bytes per handle) for the new handles.		}
{									}
{	      The maximum number of file handles for the system is set	}
{	      by the FILES= directive in the config.sys file.  In any	}
{	      case, the maximum number of file handles per process is	}
{	      at most 20, but never greater than the system value.	}
{	      This procedure allows you set the maximum number of file	}
{	      handles for the current process; it does not affect the	}
{	      system restriction or the number of handles for		}
{	      subsequent processes.					}
{									}
{	      If you specify a value less than the current number of	}
{	      handles used, the current handles remain valid, but as	}
{	      files are closed you may not be able to open others.  If	}
{	      NoHandles is larger than the system configuration, the	}
{	      system configuration number is used.  __MaxHnFil requires }
{	      DOS 3.30. 						}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

procedure __MaxHnFil(NoHandles : word; var ErrorCode : word);

  var
    Reg : registers;

  begin {__MaxHnFil}

    if ((_DOSMajorVer < 3) or (_DOSMinorVer < 3)) then
       begin
	 ErrorCode := 1;	       { DOS 3.30 is required		}
	 Exit
       end;

    with Reg do
      begin
	AH := $67;
	BX := NoHandles;
	Intr(_DOS,Reg);
	if ((Flags and FCarry) <> 0) then
	   ErrorCode := AX
	else
	   ErrorCode := 0
      end

  end;	{__MaxHnFil}
