Subj : Re: How to detect RAM disks To : Jasen.Betts@xspamp42.f531.n640.z3.f From : Matthias Paul Date : Mon Feb 25 2002 07:30 am From: Matthias.Paul@f3.n342.z1.cereal.mv.com (Matthias Paul) Subject: Re: How to detect RAM disks From: "Matthias Paul" On 2002-02-24, Jasen Betts wrote: >> SET RAMDRIVE=:: >> @CALL TDSK %1 >> IF "::"=="%RAMDRIVE%" GOTO nochg >> %RAMDRIVE% >> :nochg > > what's in tdsk.bat ? > what does %1 represent? TDSK.BAT does not necessarily exist, the "CALL" is there just in case someone would replace a direct call to TDSK.EXE (f.e. in the %PATH%) by a batchjob later. In large batch projects I have seen too many faults like this in the past, so I have come to the habit to *always* use CALL in front of any references to externals - it cannot harm, as long as it is not a requirement to run on DOS 2.xx. ;-) Of course, it's still not 100% safe, because someone could call another batchjob from inside of TDSK.BAT without prepending it with CALL, and - bang! - it would not return to the original caller. But I thought, that always using %COMSPEC% /C instead of CALL is a bit too expensive for this example. Anyway, don't worry about that, you can replace this by a direct reference to: @c:\sys\ramdisk\tdsk.243\tdsk.exe or similar, if you like. TDSK takes several parameters, but for this little demonstration I thought it would be enough to just indicate that there /may/ be parameters. %1 would be the size of the RAM disk in case you would want to specify a different size (TDSK is a resizeable RAM disk). The parameter is not necessary in any way; if you don't give it, TDSK will just report its current status - and still set the environment variable. BTW. It will set the variable in any environment block in the system, so this will work even from inside secondary shells. I do not particularly like that part of the game, but there also is no 100% reliable method to find the /right/ environment. Hence I plan to add an alternative mode of operation, where TDSK will use errorlevels to return the info - like FINDRAMD. This is more difficult to check for in batchjobs, but it is "cleaner" in terms of the general process model. Anyway, the variable will only be patched, if it is in a very specific format, so this should be reasonable safe in practice. You can download TDSK 2.42 BETA as part of the FreeDOS project from ibiblio, although the FreeDOS distro still has Ciriaco Garcia de Celis' TDSK 2.30 only. TDSK 2.43 BETA is still under development and not publically available. > the definition of ram disk is becoming a little blurred, is a > memory stick (tm) a ram disk? Yeah, I know what you mean. But a "virtual disk" is also not a precise definition any more... I leave it to others to find the definitive term for it. I guess we all know what we mean here, don't we? ;-) >>> Functions like %@DISKOEM[d:]% = "12345678" and %@RAMDISK[d:]% = 0,1. >> >> also %@DiskSerial[d:] Yep, I keep suggesting to add this (and many other things) to 4DOS literally for years, but apparently they still have not heart enough voices, who want it... >> And %@FILEDATE[]% refuses to return the date of a disk label, >> unfortunately. > > That's partly because labels aren't files... (you're allowed to have > a file with the same name as the disk label...) Well, what I meant was the file with the volume attribute set (and *only* the volume attribute set). I know, there can be two volume labels (and one OEM label), but anyway... >> PS. Apparently a good "FINDRAMD" replacement is still needed in >> many places. Any volunteer to develop one for FreeDOS >> (www.freedos.org)? It would certainly be useful. > > findramd.exe can easily be patched with a new target string... not really > suitable for redistribution though. Well, if you know in advance what the RAM disk driver is, you probably don't need a RAM disk detection, anyway... ;-) Greetings, Matthias -- ; http://www.uni-bonn.de/~uzs180/mpdokeng.html; http://mpaul.drdos.org -- |Fidonet: Matthias Paul 1:342/3 | | Origin: The Cereal Port BBS (603)899-3335 199.125.78.133 (1:132/152) --- # Origin: (1:132/152.4) * Origin: Baddog BBS (1:218/903) .