Another nice addition to the latest drop of the SDF is the ability to get the serial number and manufacturer ID of storage volumes that support it (like SD cards). We did this by simply extending the existing OpenNETCF.IO.DriveInfo class to add a couple new properties. Here’s a quick example of how it works:
foreach(var info in DriveInfo.GetDrives())
{
Debug.WriteLine(“Info for “ + info.RootDirectory);
Debug.WriteLine(“tSize: “ + info.TotalSize.ToString());
Debug.WriteLine(“tFree: “ + info.AvailableFreeSpace.ToString());
Debug.WriteLine(“tManufacturer: “ + info.ManufacturerID ?? “[Not available]”);
Debug.WriteLine(“tSerial #: “ + info.SerialNumber ?? “[Not available]”);
Debug.WriteLine(string.Empty);
}
Does this return the serial sumber of the SD Card itself, or the volume on the SD Card? If it’s actually getting the serial number of the SD Card, that value will not change if the card is reformatted.
LikeLike
It is (assuming the storage driver was implemented right) the serial number of the card itself, so no, it shouldn’t change after a format.
LikeLike
I have been scouring around the net trying to find some code that will run under Windows Mobile that can read the volume serial number(the number that changes with each format) I can find nothing. I have seen posts going back as far as 2003, I find it hard to believe nobody has found a straight forward wy to get this info as of yet. I have been able with pInvoke to get the device serial but don’t want that.
LikeLike