PDA

View Full Version : Know USB drive




Akshya4You
Oct 13, 2008, 01:00 AM
Hi,
I have to detect that, a drive is on USB or not.
our code was as

HParamBlockRec pb;
GetVolParmsInfoBuffer vParams;
pb.ioParam.ioNamePtr = NULL;
pb.ioParam.ioVRefNum = actualVolume;
pb.ioParam.ioBuffer = (Ptr)&vParams;
pb.ioParam.ioReqCount = sizeof(vParams);
OSErr gvperr = PBHGetVolParmsSync(&pb);


if (((vParams.vMExtendedAttributes & (1L << bIsEjectable)) != 0 ) ||
(vParams.vMServerAdr !=0 )){
//Ejectable or Network drive
continue;
}

But some cases it's not working properly.
Now am using one more flag "bIsOnExternalBus".
Is it ok??
Or there is any other way to know the Drives type(USB).