Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!csource!david From: david@csource.OZ.AU (david nugent) Newsgroups: comp.sys.ibm.pc Subject: Re: Retrieving the value of FILES=??? Keywords: Global File Handle Table Message-ID: <529@csource.OZ.AU> Date: 17 Jun 90 03:30:05 GMT References: <605@digigw.digital.co.jp> <4057@jato.Jpl.Nasa.Gov> Organization: Unique Computing Pty Ltd, Melb, Aust. Lines: 54 In <4057@jato.Jpl.Nasa.Gov> kaleb@mars.jpl.nasa.gov (Kaleb Keithley) writes: >How about: (in psuedo-code) >#ifdef DOS > fopen ("/CONFIG.SYS", "r"); > fscanf (..., "FILES=", ...); > fscanf (..., value, ...); > fclose (...); >#else > other method appropriate for architecture >#end >Since all DOS machines have to have CONFIG.SYS in the root directory, it >would work for any DOS box. If the fopen fails, then assume the default. Several pitfalls; How do you determine what drive the system booted from? (and don't say looking at COMSPEC - even my own system boots DOS from a floppy and I have "SHELL=C:\COMMAND.COM ..." on it, which makes that assumption completely invalid), How can you guarantee that CONFIG.SYS hasn't been edited since boot, Some application may have adjusted the number of allowed handles using DOS Fn 67H, What if there's no FILES= statement (use the MS-DOS default - but since DOS Fn 67H exists, that's also a problem), How do you handle workstations on a network using an auto- boot PROM where CONFIG.SYS is no longer available since the system boots from what is essentially a temporary memory image, What about a dual boot OS/2 system which might use something like CONFIG.DOS instead of CONFIG.SYS, How do you handle "DOS-like" environments such as PC-MOS/386 where a FILES= statement is invalid, yet there IS no practical limit to the number of handles; certainly the DOS default does NOT apply Reading CONFIG.SYS is a kludge, at best. If you need this information, it's for a reason - and relying on extremely unreliable sources can get you into trouble very quickly. david -- * Unique Computing Pty Ltd, Melbourne, Australia. * david@csource.oz.au 3:632/348@fidonet 28:4100/1@signet