File::getVolumeSerialNumber negative?

When I calculate the integer representation of the hard disk serial number on my Windows7 64 bit PC with File::getVolumeSerialNumber(), I get a negative number for the C drive (when running the executable from e.g. the desktop and using currentApplicationFile for the file location). It works well on the D drive and on a USB stick (i.e. the identifiers are the same there when converted to hex as the ones I get with the DOS ‘vol’ command). Any ideas?

Ah, got it. When the integer representation is negative you have to multiply it with -1, convert to hex and subtract the result from ffffffff to get the corresponding ‘vol’ result.

…or just cast it to an unsigned int!

Rrright… :smiley: thanks!

What about the Mac side? Whatever special location I choose I always get back 0 for the VolumeSerialNumber… which is not surprising since int File::getVolumeSerialNumber() const { return 0; // xxx }
is what is written in juce_posix_shared_Code.h … is this a Windows thing only?

That’s right, only win32 provides a way of getting that value AFAIK

No, that’s wrong.

I’ve a code running on linux that does this, I’ve sent to you by email (to big to be pasted here).
No idea how it works on Mac.