I’ve seen it written in C++ which I don’t know. I need a C# function that return SDCard’s serial in .NET CF. Could anyone kindly help me write a function with it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, I’ll say that if you buy the SDF ($50) you get the source for this function, which you could then pull into your project and obfuscate.
If, however, you have more time than money and want to implement it yourself, I can point you in the right direction. I leave it to you to string all of these pieces together, but here are the steps:
First, you have to open the Volume like this:
That gives you a handle to the drive. You then simply call an IOCTL to get the storage ID:
What this gives you is a binary representation of a STORAGE_IDENTIFICATION structure. Note that the structure is really only a desciption of the header of the data. It contains an offset to the actual serial number data, which is an ASCII string. Extracting it looks something like this: