|
-
March 10th, 2005, 02:51 AM
#1
How to get a HDD serial number?
Hi there . I'm trying to get a HDD serial number using
DeviceIoControl (
handlePhysicalDrive,
IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER, //0x00074080
IntPtr.Zero,
0,
ref mediaData,
(uint)Marshal.SizeOf(mediaData),
ref l_nBytesReturned,
System.IntPtr.Zero);
I cant correctly translate the C struct to C#
//C struct
typedef struct _MEDIA_SERIAL_NUMBER_DATA {
ULONG SerialNumberLength;
ULONG Result;
ULONG Reserved[2];
UCHAR SerialNumberData[];
} ;
//my translation
[StructLayout(LayoutKind.Sequential)]
public struct MEDIA_SERIAL_NUMBER_DATA{
public ulong SerialNumberLength;
public ulong Result;
public ulong Reserved;
public string SerialNumberData;
}
Please, can somebody help me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|