From: jdz1@Ra.MsState.Edu (John D. Zitterkopf)
Subject: Re: LASTDRIVE function/asm/ect... Need one!
Organization: Mississippi State University
Date: Mon, 9 Nov 1992 19:33:07 GMT

In article <9NOV92.14394645@skyfox.usask.ca> friesenda@skyfox.usask.ca writes:

>>DOS interrupt 21h, function 52 -> ES:BX pointer to DOS info table.
>>Offset 21h is a byte value of LASTDRIVE in config.sys. (DOS 3.x at least).
>> 
>>Do what you will.

	The problem with this that as far as I can tell this mystry function
of the DOS INTs it an INTERNAL call for DOS. I have tryed both the MSDOS and
ASMembly in TP6.0 to call this function, but after the INT 21 or MSDOS()
calls the ES:BX call NEVER changes. Infact, the MSDOS procedure in TP6.0
comes back with ERROR 208: overlay manager not loaded. If I put OVERLAY in
my USES statement, the machine locks up requiring a COLDBOOT. 

>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
>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).

	Well, isn't it good advice to set the LASTDRIVE to the lastdrive in
the system? I belive that it conserves some memory. 
>
>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).

	I've used this "way" in one of my previous programs, except I used
the TP6.0 DISKFREE function. The problem with this is that I stops my CDROM
from playing AUDIO CDs. Will a CD X:\ not mess with my CD? I don't think so.
Hence, the reason I'd like to know the LAST drive in the system. At least
this way, if I get an invalid drive, I'd have a starting point. 
	
RE: Timo's responce.
	Timo came back with a function in his "list" that would allow me to
do this. This is =fine= except for 2 things. 1) I don't have the source so
that I can modify it for my needs. 2) This is part of an new version of my
shareware package "The HardDisk Accomplice". Therefore, I don't belive that
this is the "best" soln. If he could just post some "pointers" on how he 
did it... "Trade Secret?"

Thanks for the Responses so far,
	I'll post when I figure it out, "IF ever".

John

--
 ____________   _------_  |||IBM & |      EE majors Do it Best 8-)
  --------\\ ] ~-______-~ |||Atari |~~~~~~~~~John D. Zitterkopf~~~~~~~~~~~~~
     (~~~~~\\|_(__ ~~    / | \Rules!jdz1@ra.MsState.edu  jdz1@MsState.bitnet
      \______| (        /  |  \    |AOL: zitt@aol.com  jdz1@isis.MsState.edu 
Newsgroups: alt.lang.asm,comp.lang.pascal,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer