home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu / 2008-06-02_hobbes.nmsu.edu.zip / dos / 2gbfix.zip / 2gbfix.txt < prev    next >
Text File  |  1998-11-19  |  6KB  |  133 lines

  1. Documentation for 2GBFIX v1.0 by J.M.A. Hall
  2.  
  3. 1. What is 2GBFIX and why would you want it?
  4.  
  5. 2GBFIX is a workaround for a problem that occurs in DOS and WIN-OS/2
  6. sessions under OS/2 (and possibly other OSes that provide virtual DOS
  7. sessions) when you have disks or partitions that exceed 2 GB (2048 MB)
  8. in size. Many DOS and Windows programs that check free and/or total
  9. disk space cannot deal with disks over 2GB, partly because DOS itself
  10. cannot deal with partitions bigger than this and partly because
  11. calculation of bytes free is usually performed using 32-bit signed
  12. integer arithmetic, where the maximum positive value equates to
  13. approximately 2GB. The effects of this vary, but usually the affected
  14. program thinks that the volume or partition has insufficient disk space
  15. because the result of the calculation is either zero or negative.
  16.  
  17. 2GBFIX works around this by patching the appropriate DOS calls so that
  18. they never return more than 2GB of total or free space, which prevents
  19. the program failing at the expense of the program not having a true
  20. idea of the actual amount of disk space. For most practical purposes
  21. this is not a problem.
  22.  
  23.  
  24. 2. What 2GBFIX doesn't do
  25.  
  26. It won't fix OS/2 programs that can't cope with >2GB disks. Sorry, that
  27. one's a bit harder.
  28.  
  29.  
  30. 3. Before you install 2GBFIX
  31.  
  32. Please read LICENCE.TXT in the archive and ensure that you agree to its
  33. conditions. It's pretty loose so it won't cause most of you a problem,
  34. unless you happen to work for Microsoft of course :-).
  35.  
  36.  
  37. 4. Installing 2GBFIX
  38.  
  39. Proceed as follows:
  40.  
  41. i) Copy 2GBFIX.COM to a drive and directory that is accessible to a DOS
  42. session (i.e. one where all the directories in the path conform to the
  43. 8.3 convention). You can make this the OS2, OS2\MDOS or OS2\MDOS\WINOS2
  44. directories if you wish, though I wouldn't recommend it as you risk
  45. losing it if you have to reinstall OS/2.
  46.  
  47. ii) If you wish to have 2GBFIX apply in all DOS and WIN-OS/2 sessions,
  48. edit the \AUTOEXEC.BAT file on the drive that OS/2 boots from and add a
  49. line that loads 2GBFIX (recommended). If you only wish to have it
  50. loaded for a specific DOS program, edit the batch file that starts the
  51. program (or create one if you don't currently have one) and add the
  52. line there.
  53.  
  54. iii) Start the program or WIN-OS/2 session. You should find that your
  55. drive(s) whos total or free space are over 2GB are now seen by that
  56. sesson as having just under 2GB.
  57.  
  58. iv) Cheer :-)
  59.  
  60.  
  61. 5. How the program works (for those who are interested)
  62.  
  63. The DOS calls that return disk capacity and free space return it as the
  64. following quantities:
  65.  
  66. (i)    Disk sector size in bytes
  67. (ii)    Sectors per cluster
  68. (iii)    Total number of clusters
  69. (iv)    Number of free clusters
  70.  
  71. thus the disk capacity is (i)*(ii)*(iii) bytes, and the free space is
  72. (i)*(ii)*(iv) bytes.
  73.  
  74. These are all 16-bit unsigned quantities (i.e. in the range 0..65535).
  75.  
  76. (i) is usually 512, though 2GBFIX does not assume this. (ii) is the
  77. problematic quantity. Under DOS, the maximum value of (ii) is 64
  78. (cluster size of 32 Kbytes) and thus the maximum 65535 clusters works
  79. out to just under 2GB. Under OS/2 however, a volume not formatted as
  80. FAT (e.g. HPFS) can easily exceed 2GB with currently available disks.
  81. Under HPFS, cluster sizes are essentially meaningless, however for
  82. compatibility purposes OS/2 emulates values consistent with a FAT
  83. volume of the same size (if such a thing existed). Unfortunately this
  84. is where problems set in. Firstly, programs that compute (i)*(ii)  with
  85. 16-bit arithmetic on a >2GB disk are likely to end up with a cluster
  86. size of zero due to integer overflow - thus all disk space calculations
  87. end up as zero. (Windows File Manager seems to do this.) Secondly, if
  88. the remaining calculation  is performed using 32-bit signed arithmetic,
  89. disk space exceeding 2GB will, again due to integer overflow, either be
  90. negative or be truncated modulo 2GB.
  91.  
  92. 2GBFIX corrects this by first checking if the cluster size in bytes
  93. exceeds 32768 bytes. If it does, the cluster size is forced to 32768
  94. bytes and the number of free and total clusters scaled up accordingly.
  95. If the scaled up values would exceed 65535, they are forced to 65535.
  96. Thus no disk will ever appear to have more than 65535 32KB clusters,
  97. the same limits as under real DOS.
  98.  
  99. 5. Additional information
  100.  
  101. 2GBFIX can be unloaded if required by running it with /U on the command
  102. line.
  103.  
  104. In keeping with the spirit of open-source software, the assembler
  105. source is included in the archive, in case someone wants to tweak it
  106. (e.g. for programs that can't even cope with a 2GB disk). To build the
  107. program from source you will need MASM 5.1 or a compatible assembler. I
  108. make no apology for this as I've owned MASM 5.1 a fair bit longer than
  109. I've owned OS/2. You will also need EXE2BIN or an equivalent to
  110. generate the COM file from an EXE file if using MASM 5.1.  Use of the
  111. source is subject to the restrictions in LICENSE.TXT.
  112.  
  113.  
  114. The author has only been able to test this software on a single 2.2GB
  115. HPFS partition, however the software has been written such that it
  116. should work on any size of partition supported by OS/2. Bugs, problems,
  117. suggestions, accolades, etc. can be emailed to jmah@isvr.soton.ac.uk.
  118. Please place 2GBFIX in the "Subject:" line. I will try to respond to
  119. all emails ASAP, but this is subject to the demands of my day job.
  120.  
  121.  
  122. 6. Acknowledgements
  123.  
  124. This program was written as the result of a thread on the
  125. OS2-L@NIC.SURFNET.NL mailing list during November 1998. The author
  126. would like to thank all members of that mailing list past and present
  127. for their collective expertise and wisdom from which the author has
  128. benefited on many occasions.
  129.  
  130.  
  131. Jon Hall
  132. November 1998
  133.