Microsoft KB Archive/43784

= Obtaining the Local Drive Name and Network Name; INT 21 Hex =

Article ID: 43784

Article Last Modified on 11/21/2006



This article was previously published under Q43784



SUMMARY
MS-DOS Interrupt 21 Hex function 5F Hex, subfunction 02 allows you to return the local drive name and the network name of a device that has been redirected. An example of this is when you connect to a server and use it as the logical drive. If you wanted to obtain the drive name and the path to the server from within a QuickBasic program, you could CALL this MS-DOS interrupt.

The following requirements need to be observed when calling this interrupt:
 * 1) The MS-DOS network utility SHARE.EXE must be run before you can successfully call this interrupt.
 * 2) It is important that the network being used is a Microsoft Network configuration, such as IBM PC-NET. Otherwise, the information that is returned may not be correct.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and Microsoft Basic PDS Version 7.00 for MS-DOS.



Code Example
'*****************GET REDIRECTION LIST ENTRY****************** 'If you are using Basic PDS 7.00 the INCLUDE file should be 'QBX.BI' '$INCLUDE: 'QB.BI' DIM inregs AS RegTypeX DIM devname%(8) DIM networkname%(64)

inregs.ax = &H5F02 inregs.bx = &H0 inregs.ds = VARSEG(devname%(0)) inregs.si = VARPTR(devname%(0)) inregs.es = VARSEG(networkname%(0)) inregs.di = VARPTR(networkname%(0))

CLS CALL INTERRUPTX(&H21, inregs, inregs) PRINT &quot;REDIRECTED LOCAL DEVICE NAMES:&quot; X% = CSRLIN LOCATE X% + 1, 15 DEF SEG = inregs.ds   FOR looper = 0 TO 7 PRINT (CHR$(PEEK(inregs.si + looper))); NEXT DEF SEG PRINT PRINT PRINT &quot;NETWORK NAME(S):&quot; X% = CSRLIN LOCATE X% + 1, 15 DEF SEG = inregs.es   FOR llooper = 0 TO 63 PRINT (CHR$(PEEK(inregs.di + llooper))); NEXT DEF SEG END

Additional query words: QuickBas BasicCom

Keywords: KB43784

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.