Solved

finding volume reference numbers

Posted on 1998-09-13
2
181 Views
Last Modified: 2013-12-26
How can I find the volume reference numbers of ALL available  mounted volumes?
0
Comment
Question by:dwp090598
2 Comments
 

Author Comment

by:dwp090598
ID: 1291527
figured out the solution to my problem using:

pb.ioNamePtr = aString;
pb.ioVRefNum = 0;
      
      for(i=1; aErr != nsvErr; i++)
      {
          pb.ioVolIndex = i;
          aErr = PBHGetVInfo((HParmBlkPtr)&pb, false);
 }
0
 
LVL 3

Accepted Solution

by:
boonstra earned 100 total points
ID: 1291528
Actually, you want to start with ioVolIndex = 0:

  HParamBlockRec hpBlock;
  HVolumeParam *hpb = &hpBlock.volumeParam;
  OSErr err;
  Str31 volName;
  short volIndex;
  Boolean notDone = true;
 
  hpb->ioNamePtr = volName;
  hpb->ioResult = 0;
 
  volIndex=0;
 
  do {
        hpb->ioVRefNum = 0;
        hpb->ioVolIndex = volIndex++;
        err = PBHGetVInfo(&hpBlock,false);
        if (noErr != err) break;

        p2cstr(volName);
        printf("Volume [%d] %s vRefNum = %d\n",hpb->ioVolIndex,volName,hpb->ioVRefNum);

  } while (notDone);

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now