Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / October 2005



Tip: Looking for answers? Try searching our database.

volume serial number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rolasa - 25 Oct 2005 09:24 GMT
is there an equivalent for the windows "GetVolumeInformation" API that I
could use to get the volume serial number for Mac OS 9 (or earlier)?
Gregory Weston - 25 Oct 2005 12:22 GMT
In article
<a7ca45868800aa31acf3105bfc83c6e6@localhost.talkaboutmac.com>,

> is there an equivalent for the windows "GetVolumeInformation" API that I
> could use to get the volume serial number for Mac OS 9 (or earlier)?

The volume serial number under Windows is just a string composed of some
arbitrary bits of information like the format date and capacity. It's
very distinctly _not_ the serial number of the drive hardware. The
scheme I used to identify a volume was to call FSGetVolumeInfo to get
the creation date and size and then build a string of the 5 components
that make up those two values.

CFStringRef CreateVolumeIdentifierFromVolumeRefNum(FSVolumeRefNum
inVolume)
{
  CFStringRef theResult = NULL;
  FSVolumeInfo theVolumeInfo = {};
  FSVolumeInfoBitmap theBitmap = kFSVolInfoCreateDate | kFSVolInfoSizes;
 
  if(FSGetVolumeInfo(inVolume, 0, NULL, theBitmap, &theVolumeInfo,
NULL, NULL) == noErr)
  {
     theResult = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,
                                 CFSTR("%.4X%.8X%.4X%.16qX"),
                                 theVolumeInfo.createDate.highSeconds,
                                 theVolumeInfo.createDate.lowSeconds,
                                 theVolumeInfo.createDate.fraction,
                                 theVolumeInfo.totalBytes);
  }
 
  return theResult;
}

Signature

Goal 2005: Convincing James Hetfield to cover the Strawberry Shortcake
"Are You Berry Berry Happy?" song.

Simon Slavin - 29 Oct 2005 15:54 GMT
On 25/10/2005, rolasa wrote in message
<a7ca45868800aa31acf3105bfc83c6e6@localhost.talkaboutmac.com>:

> is there an equivalent for the windows "GetVolumeInformation" API that I
> could use to get the volume serial number for Mac OS 9 (or earlier)?

Macs don't use volume serial numbers.  In fact, Windows doesn't either:
it fakes them.  If you tell us why you think you want one we can probably
suggest some alternative strategies.

Simon.
Signature

http://www.hearsay.demon.co.uk

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.