Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

STORAGE_DEVICE_DESCRIPTOR (Structures)
 
.
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 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));

Notes:

None.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions