Microsoft KB Archive/69211

= How to Get the Names of All Mounted Macintosh Disk Volumes =

Article ID: 69211

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0
 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q69211



SUMMARY
The following is a short demonstration program that shows how to get all the mounted disk volume names in Microsoft QuickBASIC versions 1.00, 1.00a, and 1.00b for Apple Macintosh.



MORE INFORMATION
The Macintosh File Manager keeps information about mounted disk volumes in a volume-control-block queue; each entry consists of a volume control block. A volume control block is a 178-byte nonrelocatable block that contains volume-specific information. For a description of the structure of a volume control block, see page 176 of &quot;Inside Macintosh,&quot; Volume 4, by Apple Computer Inc. (published by Addison-Wesley).

The location of the default volume control block is &H352. The first entry in each block is a pointer to the next entry. If this value is a zero, the end of the queue has been reached. The volume name is located at bytes 44 to 70 (27 bytes long) from the head of the block.

The following is a code example: 'Program to demonstrate the use of the Volume Control Block '      to get the names of all mounted volumes

DIM VolName$(10)       'Array to hold the names VolCount% = 0          'Counter to hold total number of volumes ptr& = &H352           'Pointer to default Volume Control Block vol& = PEEKL(ptr&)     'Get pointer to next entry in queue WHILE vol& <> 0 'Loop until null pointer vol& = PEEKL(ptr&) ptr& = vol& IF vol& <> 0 THEN VolCount% = VolCount% + 1 x$ = &quot;&quot; st = PEEK(vol& + 44) FOR i = 1 TO st 'Skip i = 0 (Length of String) x$=x$ + CHR$(PEEK(vol& + 44 + i)) NEXT i               VolName$(VolCount%) = x$                PRINT &quot;[&quot;;VolName$(VolCount%);&quot;]&quot; INPUT a ' pause program using input statement END IF WEND

Additional query words: MQuickB

Keywords: KB69211

-

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

© Microsoft Corporation. All rights reserved.