1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Strange questions in Disk enumerating

Discussion in 'Mac Programming' started by MayPeng, Mar 29, 2012.

  1. macrumors member

    #1
    When enumerating the disk using the same Application , it will appear the following disk on one mac mini 10.7.3:
    +Macintosh HD
    +home
    +net
    but it will not appear the home and net disks on another mac mini 10.7.3

    How to delete the home and net disks?
    THS!
     
  2. macrumors 6502

    #2
    What are you using to get the disk names? The home and net disks are placeholders for networked volumes, and can't be deleted.
     
  3. macrumors 6502a

    #3
    My guess is that one is bound to LDAP or ActiveDirectory, and one is not.
     
  4. MayPeng, Mar 29, 2012
    Last edited: Mar 29, 2012

    macrumors member

    #4
    Code of listing the drive is the following:

    #Define MAX_LIST_DRIVE_NUM 50
    DriveNameInfo driveList[MAX_LIST_DRIVE_NUM ];
    memset(driveList, 0 , sizeof(driveList));

    OSErr result = noErr;
    int volumeIndex = 0;
    FSVolumeRefNum refNum;
    HFSUniStr255 volumeName;
    UInt16 nameLen = 0;

    for(volumeIndex = 1; result == noErr ; volumeIndex++)
    {
    result = FSGetVolumeInfo(kFSInvalidVolumeRefNum,
    volumeIndex,
    &refNum,
    kFSVolInfoNone,
    NULL,
    &volumeName,
    NULL);

    if(result == noErr )
    {
    //get the drive's info
    CFStringRef volumeNameRef = CFStringCreateWithCharactersNoCopy(
    kCFAllocatorDefault,
    volumeName.unicode,
    volumeName.length,
    kCFAllocatorDefault);

    //get the drive's name
    CFStringGetFileSystemRepresentation(volumeNameRef,
    driveList[voluneIndex -1].name,
    NAME_MAX);

    //Save length of the drive's name
    nameLen = volumeName.length < strlen(driveList[volumeIndex - 1].name) ? strlen(driveList[volumeIndex - 1].name) : volumeName.length;
    driveList[volumeIndex - 1].nameLen = CFSwapInt16HostToLittle(nameLen);

    //Fil in the attribute
    driveList[volumeIndex - 1].attribute = CFSwapInt16HostToLittle('l');
    }
    }

    How to control the code or other methods not to list the home and net drive?
     
  5. macrumors G5

    gnasher729

    #5
    A first step would be to pass something other than kFSVolInfoNone and NULL.
     
  6. macrumors member

    #6
    Pass null in the forth parameter other than kFSVolInfoNone ???
    THKS!
     

Share This Page