BBS: Inland Empire Archive Date: 04-17-92 (22:33) Number: 191 From: LOGAN ASHBY Refer#: NONE To: DICK DENNISON Recvd: NO Subj: # Of Disk Drives 2/2 Conf: (2) Quik_Bas
- - - - - - - - - - - continued from last message - - - - - - - - -
FUNCTION IsRemoveable%(DrvNum%)
'| We need to test for a floppy with this method, as the truename
'| function will poll the hardware, and generate a crit. error
'| if no floppy in drive/door open
RegsX.ax = &H4408
RegsX.bx = DrvNum% + 1
CALL InterruptX(&H21, RegsX, RegsX)
IF (RegsX.Flags AND 1) THEN
'| Could handle this error better. For now, just assume
'| it's not a floppy, as this code generates an error
'| for a Novell mapped drive.
IsRemoveable% = FALSE
ELSE
IF (RegsX.ax ) THEN
IsRemoveable% = FALSE
ELSE
IsRemoveable% = TRUE
END IF
END IF
END FUNCTION
SUB TrueName(DrvNum%, Logical%, Remapped$)
DIM DrvPath AS STRING * 128
'| The period after the backslash here avoids a Novell bug
DrvLtr$ = CHR$(DrvNum% + 65) + ":\." + Null$
IF (IsRemoveable%(DrvNum%)) THEN
'| Not sure, but this is probably a bug. I'm not sure what
'| will happen on systems w/ only one floppy. Don't have
'| one handy to test with.
Logical% = FALSE
ReMappedTo$ = ""
ELSE
DrvPath = DrvLtr$ '| TrueName function
RegsX.ax = &H6000
RegsX.di = VARPTR(DrvPath) '| We use the same buffer
RegsX.si = VARPTR(DrvPath) '| for the input and output
RegsX.ds = VARSEG(DrvPath)
RegsX.es = VARSEG(DrvPath)
CALL InterruptX(&H21, RegsX, RegsX)
DrvLtr$ = LEFT$(DrvLtr$, INSTR(DrvLtr$, ".") - 1)
TmpPath$ = LEFT$(DrvPath, INSTR(DrvPath, Null$) - 1)
IF ( DrvLtr$ <> TmpPath$) THEN
Logical% = TRUE
ReMapped$ = LEFT$(DrvPath, INSTR(DrvPath, Null$))
ELSE
Logical% = FALSE
ReMapped$ = ""
END IF
END IF
END SUB
- - - - - - - - - - - - end of code - - - - - - - - - - - - -
Dick, as you can see from the comments, I don't have a lot of confidence in
this code being bullet-proof. The things I left unfixed
were because I couldn't find a way around them. Maybe
somebody else can either come up with something better or a
way to fix this. Hope it helps, let me know what you
think. A good place to check for a method to do this
correctly would be Schulman's book 'Undocumented DOS'.
It's next on my book budget list, but right now 'the better
half' is threatening homicide over that very list. B-) She
seems to think eating comes before computer books. Sheesh,
some people just don't have their priorities right. <grin>
seeya,
Logan A. Ashby, QB Pilgrim B-)
--- GoldED 2.40
* Origin: Lurker's Lounging Point (1:398/1.2)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET