home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
hobbes.nmsu.edu
/
2008-06-02_hobbes.nmsu.edu.zip
/
dos
/
2gbfix.zip
/
2gbfix.txt
< prev
next >
Wrap
Text File
|
1998-11-19
|
6KB
|
133 lines
Documentation for 2GBFIX v1.0 by J.M.A. Hall
1. What is 2GBFIX and why would you want it?
2GBFIX is a workaround for a problem that occurs in DOS and WIN-OS/2
sessions under OS/2 (and possibly other OSes that provide virtual DOS
sessions) when you have disks or partitions that exceed 2 GB (2048 MB)
in size. Many DOS and Windows programs that check free and/or total
disk space cannot deal with disks over 2GB, partly because DOS itself
cannot deal with partitions bigger than this and partly because
calculation of bytes free is usually performed using 32-bit signed
integer arithmetic, where the maximum positive value equates to
approximately 2GB. The effects of this vary, but usually the affected
program thinks that the volume or partition has insufficient disk space
because the result of the calculation is either zero or negative.
2GBFIX works around this by patching the appropriate DOS calls so that
they never return more than 2GB of total or free space, which prevents
the program failing at the expense of the program not having a true
idea of the actual amount of disk space. For most practical purposes
this is not a problem.
2. What 2GBFIX doesn't do
It won't fix OS/2 programs that can't cope with >2GB disks. Sorry, that
one's a bit harder.
3. Before you install 2GBFIX
Please read LICENCE.TXT in the archive and ensure that you agree to its
conditions. It's pretty loose so it won't cause most of you a problem,
unless you happen to work for Microsoft of course :-).
4. Installing 2GBFIX
Proceed as follows:
i) Copy 2GBFIX.COM to a drive and directory that is accessible to a DOS
session (i.e. one where all the directories in the path conform to the
8.3 convention). You can make this the OS2, OS2\MDOS or OS2\MDOS\WINOS2
directories if you wish, though I wouldn't recommend it as you risk
losing it if you have to reinstall OS/2.
ii) If you wish to have 2GBFIX apply in all DOS and WIN-OS/2 sessions,
edit the \AUTOEXEC.BAT file on the drive that OS/2 boots from and add a
line that loads 2GBFIX (recommended). If you only wish to have it
loaded for a specific DOS program, edit the batch file that starts the
program (or create one if you don't currently have one) and add the
line there.
iii) Start the program or WIN-OS/2 session. You should find that your
drive(s) whos total or free space are over 2GB are now seen by that
sesson as having just under 2GB.
iv) Cheer :-)
5. How the program works (for those who are interested)
The DOS calls that return disk capacity and free space return it as the
following quantities:
(i) Disk sector size in bytes
(ii) Sectors per cluster
(iii) Total number of clusters
(iv) Number of free clusters
thus the disk capacity is (i)*(ii)*(iii) bytes, and the free space is
(i)*(ii)*(iv) bytes.
These are all 16-bit unsigned quantities (i.e. in the range 0..65535).
(i) is usually 512, though 2GBFIX does not assume this. (ii) is the
problematic quantity. Under DOS, the maximum value of (ii) is 64
(cluster size of 32 Kbytes) and thus the maximum 65535 clusters works
out to just under 2GB. Under OS/2 however, a volume not formatted as
FAT (e.g. HPFS) can easily exceed 2GB with currently available disks.
Under HPFS, cluster sizes are essentially meaningless, however for
compatibility purposes OS/2 emulates values consistent with a FAT
volume of the same size (if such a thing existed). Unfortunately this
is where problems set in. Firstly, programs that compute (i)*(ii) with
16-bit arithmetic on a >2GB disk are likely to end up with a cluster
size of zero due to integer overflow - thus all disk space calculations
end up as zero. (Windows File Manager seems to do this.) Secondly, if
the remaining calculation is performed using 32-bit signed arithmetic,
disk space exceeding 2GB will, again due to integer overflow, either be
negative or be truncated modulo 2GB.
2GBFIX corrects this by first checking if the cluster size in bytes
exceeds 32768 bytes. If it does, the cluster size is forced to 32768
bytes and the number of free and total clusters scaled up accordingly.
If the scaled up values would exceed 65535, they are forced to 65535.
Thus no disk will ever appear to have more than 65535 32KB clusters,
the same limits as under real DOS.
5. Additional information
2GBFIX can be unloaded if required by running it with /U on the command
line.
In keeping with the spirit of open-source software, the assembler
source is included in the archive, in case someone wants to tweak it
(e.g. for programs that can't even cope with a 2GB disk). To build the
program from source you will need MASM 5.1 or a compatible assembler. I
make no apology for this as I've owned MASM 5.1 a fair bit longer than
I've owned OS/2. You will also need EXE2BIN or an equivalent to
generate the COM file from an EXE file if using MASM 5.1. Use of the
source is subject to the restrictions in LICENSE.TXT.
The author has only been able to test this software on a single 2.2GB
HPFS partition, however the software has been written such that it
should work on any size of partition supported by OS/2. Bugs, problems,
suggestions, accolades, etc. can be emailed to jmah@isvr.soton.ac.uk.
Please place 2GBFIX in the "Subject:" line. I will try to respond to
all emails ASAP, but this is subject to the demands of my day job.
6. Acknowledgements
This program was written as the result of a thread on the
OS2-L@NIC.SURFNET.NL mailing list during November 1998. The author
would like to thank all members of that mailing list past and present
for their collective expertise and wisdom from which the author has
benefited on many occasions.
Jon Hall
November 1998