@msdn=https://msdn.microsoft.com/en-us/library/ff800835(v=vs.85).aspx @pinvoke=http://pinvoke.net/$$$.htm Summary: Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the storage device descriptor data for a device. !!!!C# Definition: [StructLayout(LayoutKind.Sequential)] struct STORAGE_DEVICE_DESCRIPTOR { public uint Version; public uint Size; public byte DeviceType; public byte DeviceTypeModifier; [MarshalAs(UnmanagedType.U1)] public bool RemovableMedia; [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing; public uint VendorIdOffset; public uint ProductIdOffset; public uint ProductRevisionOffset; public uint SerialNumberOffset; public STORAGE_BUS_TYPE BusType; public uint RawPropertiesLength; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x16)] public byte[] RawDeviceProperties; } !!!!VB Definition: Structure STORAGE_DEVICE_DESCRIPTOR Public TODO End Structure !!!!User-Defined Field Types: [STORAGE_BUS_TYPE] !!!!Sample Code: //To get the values of VendorIdOffset, ProductIdOffset, ProductRevisionOffset //IntPtr resultPtr is obtained from Kernel32.DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY control code var deviceInfo = (STORAGE_DEVICE_DESCRIPTOR)Marshal.PtrToStructure(resultPtr, typeof(STORAGE_DEVICE_DESCRIPTOR)); string vendorId, productId, firmwareRev, serialNumber; if(deviceInfo.VendorIdOffset != 0) vendorId = Marshal.PtrToStringAnsi(new IntPtr((long)resultPtr + deviceInfo.VendorIdOffset)); if(deviceInfo.ProductIdOffset != 0) productId = Marshal.PtrToStringAnsi(new IntPtr((long)resultPtr + deviceInfo.ProductIdOffset)); if(deviceInfo.ProductRevisionOffset != 0) firmwareRev = Marshal.PtrToStringAnsi(new IntPtr((long)resultPtr + deviceInfo.ProductRevisionOffset)); if(deviceInfo.SerialNumberOffset != 0) serialNumber = Marshal.PtrToStringAnsi(new IntPtr((long)resultPtr + deviceInfo.SerialNumberOffset)); Documentation: STORAGE_DEVICE_DESCRIPTOR@msdn on MSDN
Edit Structures.STORAG...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.