From: p00168@psilink.com (James F. Tims)
Newsgroups: alt.lang.asm,comp.lang.pascal,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer
Subject: RE: LASTDRIVE function/asm/ect... Need one!
Date: 9 Nov 92 17:42:32 GMT
Organization: Semper Excelsior
X-Mailer: PSILink (3.2)

>DATE:   9 Nov 92 14:39:46 GMT
>FROM:   friesenda@skyfox.usask.ca
>
>In a previous article, "James F. Tims" <p00168@psilink.com> wrote:
>>>DATE:   8 Nov 92 11:02:32 GMT
>>>FROM:   John Villalovos <villalj@xanth.CS.ORST.EDU>
>>>
>>>In article <1992Nov8.081922.15576@ra.msstate.edu> jdz1@Ra.MsState.Edu (John D. Zitterkopf) writes:
>>>>Howdy,
>>>>
>>>>	As the subject says, I'm looking for some references on how to find
>>>>the LASTDRIVE on a particular system. Something like a INTerrupt or source
>>>>code that will allow me to do this. I did my best to search an interrupt list
>>>>to come up with a solution to do this but no luck. For Example, My lastdrive
>>>>is G, I'd like to make a TP6.0 function called LASTDRIVE that would return
>>>>a byte value of 7 or so. If it's in Assembly, I can convert it, ect. 
>> 
>>DOS interrupt 21h, function 52h -> ES:BX pointer to DOS info table.
                              ^^^ correction
>>Offset 21h is a byte value of LASTDRIVE in config.sys. (DOS 3.x at least).
>> 
>
>I needed the same sort of function a few months back and thought I had
>found the answer with some interrupt (I can't remember if it was 21h
>or not), but as it turned out, at least in my case, using the interrupt
>was useless.  I think the same goes for the above method.  Interrupt
>21h will return the value of LASTDRIVE in _CONFIG.SYS_. If you are

It does give only the LASTDRV value. 

>running a network, or have LASTDRIVE set to anything but the ACTUAL
>last drive on the machine you won't get the answer your looking for.
>For example, on our network, O: is connected to a file service and is
>the last drive on my machine.  If I use the above method it tells me
>that my last drive is Z: (which is what it is set to in CONFIG.SYS).
>
>A better way, and the way I finally solved the problem, is to start
>with drive Z: and work down testing if the disk exists, and stopping
>when you finally find one that does.  There are a couple of ways to
>do this. You could try to ChDir to that disk's root directory
>(ie. CD Z:\).  Turbo Pascal has a built in ChDir (or something like 
>that) function that will return an error code you can test.  Or
>you could test for the existance of a file (or the root directory).
>
>There's probably a better way, but this one is fairly quick and 
>painless.
>
>- Darryl
>
>-----------------------------------------------------------------------------
>Darryl Friesen          |  "The vet let me keep them... they're my testicles"
>Univ. of Saskatchewan   |   - Far Side cartoon: dog talking to his buddy.
>friesenda@sask.usask.ca |

On Novell, at least, there is an INT21 function (which I can't recall
but I could find out if Novell is your net) which returns a
pointer to a 26 byte table that defines each drive as local, network, or 
unassigned. Your way might run into a drive that was down, say a
subst to a floppy or some such, or a restricted account that could give
you a false drive.  (Not likely, I admit.) I would imagine that any network
has a similar interrupt, but they don't always give you anything that
tells you what it is. 8^(  Sorry.



-- 
jim tims 
"And if you're a miner, when you're too tired and old and sick and stupid
to do your job properly, you have to go, whereas just the opposite applies
with the judges."  Beyond the Fringe
Newsgroups: alt.lang.asm