PDA

View Full Version : Strange questions in Disk enumerating




MayPeng
Mar 29, 2012, 04:59 AM
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!



Red Menace
Mar 29, 2012, 10:00 AM
What are you using to get the disk names? The home and net disks are placeholders for networked volumes, and can't be deleted.

larkost
Mar 29, 2012, 09:58 PM
My guess is that one is bound to LDAP or ActiveDirectory, and one is not.

MayPeng
Mar 29, 2012, 10:05 PM
What are you using to get the disk names? The home and net disks are placeholders for networked volumes, and can't be deleted.

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?

gnasher729
Mar 30, 2012, 04:10 AM
result = FSGetVolumeInfo(kFSInvalidVolumeRefNum,
volumeIndex,
&refNum,
kFSVolInfoNone,
NULL,
&volumeName,
NULL);

How to control the code or other methods not to list the home and net drive?

A first step would be to pass something other than kFSVolInfoNone and NULL.

MayPeng
Mar 30, 2012, 04:38 AM
A first step would be to pass something other than kFSVolInfoNone and NULL.

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