
      *************  READ THIS FILE FIRST *************

This archive contains a tiny package of files designed to extend the
number of handles available to a program compiled with Turbo C.

With a fully installed system you will be able to:
  (a) Get more than 240 handles under Turbo C and/or DJGPP.
  (b) Use all of these in streams under DJGPP or BCC++ 3.0 if you want,
      but only up to 20 under earlier versions of Turbo C  :-(

As of 30th March 1992 it has been tested successfully with Turbo C v1.5,
Turbo C++ v1.0, Borland C++ v2.0, and Borland C++ v2.0. I have examined
the library object code for Turbo C v1.0 (the original version of Turbo C)
and found no essential differences. It therefore is fairly certain that it
will work with all versions of Turbo C up to and including Borland C++ v3.0.
If you have a later version and try this package I would ask you to email
me the results, please.
What is less certain is the effect of enhancements or extensions to MS-DOS
such as QEMM, etc. There is some evidence that the maximum number of files
available under some such extensions may be less than 128.


INSTALLATION:
I recommend that you follow all of the steps below. However, if you
are brave then go to step (9) if you just wish to use this package
with DJGPP and are happy to skip the preliminary tests.

(1) Extract the files of the package into a convenient directory
(you have probably done this already).

(2) If you wish to use a version of Turbo C which is earlier than
Turbo C++ v1.0, then you will need to edit "makefile" (there is a
section of "makefile" with notes to help you).

(3) Change to the directory which contains the files from this package
and type "make". Turbo C will produce an executable called "test2.exe".
You will probably get a warning message when "test2.c" is compiled,
ignore it.

(4) Edit your config.sys file so that you have a files=nn statement where
nn is greater than 20. I suggest setting it to 255 (which is the largest
possible value under MSDOS 5.00). Re-boot your system to make the change
effective.

(5) To run test2.exe, you will need a bit more than nn*2 kB of free disk
space to hold all of the files which will be simultaneously opened. (Note:
this assumes a cluster size of 2 kB, which seems to be the usual size for
a hard disk). (Warning: the root directories of drives in MS-DOS have a
fixed limit on the number of files which they may contain. It is possible
to exceed this number, particularly on floppy disks. Therefore you should
normally run test2.exe in a subdirectory, but no damage should occur if
you run it in a root directory - you might simply create fewer files than
you expect). If you are using BCC++ 3.0, twice as many files will be created
by test2.exe, so you need twice as much disk space to hold the files.

(6) Run test2.exe:
                   test2 -d
The -d switch causes test2.exe to report its progress as it goes through
a series of tests. When it finishes you should find a lot of files with
names of the form "fd_nnn.$$$" where nnn ranges from 000 to 251 (i.e.
252 files). Check that each file has a size of 25 bytes. Examine the
contents of one or two of these files, they should be different but almost
the same. Delete all of these little test files.

(7) If this ran with no apparent problems, try re-directing the output of
test2.exe to a file:
                   test2 -d >results
You should notice that you get one less handle than when you ran test2.exe
without re-direction. (You will also get one less "fd_nnn.$$$" file).

(8) You can use this scheme with any Turbo C program simply by either
   (i) If you use the default "close.c" and are using a version of Turbo C
       which is at least Turbo C++ v1.0, then you just need to link 
       close.obj into your .exe file. That's all!
   (ii) If you remove the "#pragma startup" statement from "close.c" (or
       you are using a version of Turbo C which is earlier then Turbo C++
       v1.0) then you will need to include a statement
               increase_handles();
       somewhere in your program, before the program tries to use all of
       those handles (preferably early in main()). You will need to link
       close.obj (compiled with the appropriate model) with your program.
If you are careful to avoid loading the original CLOSE module from the
Turbo C libraries, then you can avoid the explicit loading of close.obj
by placing it in a library.

(9) The original purpose of this package was to increase the number of handles
available with DJGPP v1.05. All you need to do is (assuming that you are
using a version of Turbo C which is at least Turbo C++ v1.0):
      (i)   Copy the file "close.c" to your go32 source directory.
      (ii)  Apply the file go32.dif to that directory.
      (iii) Re-compile go32.
      (iv)  Save or delete the old go32.exe and install the new go32.exe
            in a directory in your PATH.
   Notes:
   (a) This will not increase the number of streams which are available
    under DJGPP to the same extent, but only minor changes are needed to do
    this too! See the file "streams.doc" in this package.
   (b) If you are using a version of Turbo C which is earlier than Turbo C++
    v1.0 then you will probably also need to edit the file "control.c" in
    the go32 source directory and add "increase_handles();" as the first
    statement in main().

(10) See the file "handles.doc" for some information about handles in
MSDOS and Turbo C.

(11) If you need to investigate "missing" handles, programs such as INFOPLUS
will prove useful. The second part of page 9 (for version 150) of INFOPLUS
gives a list of all files which are currently open, and identifies the
program which has each one open. INFOPLUS is available from SIMTEL in the 
<MSDOS.INFO> directory (as IFP1Pxxx.ZIP where xxx is the version number).

(12) Enjoy!



NOTES on testing: This package has been tested with Turbo C++ v1.0
and PC-DOS 2.10, MS-DOS 3.10 and MS-DOS 5.00. It will not supply more
than 20 handles under PC-DOS 2.10 (the necessary support for more than
20 handles requires DOS >= 3.0). It works with MS-DOS 3.10 provided that
the option which uses DOS service 0x67 is not selected (service 0x67
requires DOS >= 3.3). It has also been tested less thoroughly with Turbo
C v1.5. Others have tested it with Borland C++ v2.0, and Borland C++ v3.0.
Thanks to those people who have helped by testing the code on Borland C++,
Stephen Herb <F35HER%DHHDESY3.BITNET@DSYIBM.DESY.DE> for testing the code
with BCC++ v2.0, and Steve Frampton (frampton@vicuna.ocunix.on.ca) for
testing the code with BCC++ v3.0.


COPYRIGHT: Like most people who write programs, I have simply built upon
the work of others. I have no particular wish to restrict the use of
anything in this package nor do I expect to profit from it. Use it in any
way you like (except please do not claim that it is your own work!).


WARRANTY: There is none, of course. I know of no reason why this software
could cause any loss of data, etc, etc. I accept no responsibility
if there is any loss of any kind for any reason.


8th April 1992

W. Metzenthen
apm233m@vaxc.cc.monash.edu.au
