Strange questions in Disk enumerating

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

  1. MayPeng macrumors member

    Joined:
    Nov 21, 2010
    #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. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #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. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #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

    MayPeng thread starter macrumors member

    Joined:
    Nov 21, 2010
    #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. gnasher729 macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #5
    A first step would be to pass something other than kFSVolInfoNone and NULL.
     
  6. MayPeng thread starter macrumors member

    Joined:
    Nov 21, 2010
    #6
    Pass null in the forth parameter other than kFSVolInfoNone ???
    THKS!
     

Share This Page