on 10/18/06 6:46 AM, Meyer Jim at [EMAIL PROTECTED] wrote:
> Hi all......
>
> After a remote volume has been mounted, is there any way to determine
> if it is AFP, SMB or other?
>
If you're comfortable with declares there is. Here's a snippet of C code
that was posted to the Carbon mailing list:
// Get volume kind: SAMBA/AppleShare/local Apple/Local other
MyVolKind GL_GetVolumeKind( const FSRef *fileRef )
{
OSStatus error;
MyVolKind volKind = kindUnknown;
FSVolumeRefNum vRefNum;
SInt16 volMountInfoSize;
FSVolumeInfo volInfo;
VolumeMountInfoHeader * vmiHeader;
error = FSGetVRefNum( fileRef, &vRefNum );
if ( error ) return volKind;
error = FSGetVolMountInfoSize( vRefNum, &volMountInfoSize );
if ( error )
{ // When FSGetVolMountInfoSize return error, volume is local.
// So, call FSGetVolumeInfo.
error = FSGetVolumeInfo( vRefNum, 0, nil, kFSVolInfoFSInfo,
&volInfo, nil, nil );
if ( !error )
{
if ( volInfo.filesystemID != 0 ) volKind = localOther;
else volKind = localApple;
}
}
else
{
vmiHeader = (VolumeMountInfoHeader *)malloc( volMountInfoSize );
error = FSGetVolMountInfo( vRefNum, vmiHeader );
if ( !error )
{
switch ( vmiHeader->media )
{
case 'cifs': volKind = remoteSamba;
break;
case 'afpm': volKind = remoteAppleShare;
break;
case 'crbm': volKind = localOther;
break;
default: break;
}
}
free( vmiHeader );
}
return volKind;
}
Chris
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>