Share via


IOCTL_DISK_GET_STORAGEID (Compact 2013)

3/26/2014

This I/O control message returns the current STORAGE_IDENTIFICATION structure for a particular storage device. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to the device
    DWORD dwIoControlCode,    // use IOCTL_DISK_GET_STORAGEID
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned,  // number of bytes returned
    OVERLAPPED lpOverlapped,  // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device. This can be obtained by opening the FAT volume by its file system entry.
  • dwIoControlCode
    [in] The control code for the operation. Use IOCTL_DISK_GET_STORAGEID for this operation.
  • lpInBuffer
    [in] Set to NULL.
  • nInBufferSize
    [in] Set to zero
  • lpOutBuffer
    [out] Set to the address of an allocated STORAGE_IDENTIFICATION structure. This buffer receives the storage identifier data.
  • nOutBufferSize
    [out] Set to sizeof(STORAGE_IDENTIFICATION) and also additional memory for the identifiers. For Advanced Technology Attachment (ATA) disk devices, the identifiers consist of 20 bytes for a manufacturer identifier string, and also 10 bytes for the serial number of the disk.
  • lpBytesReturned
    [out] Pointer to receive the size of data returned in nOutBufferSize.
  • lpOverlapped
    [in] Ignored, set to NULL.

Return Values

If you provide support in a block device driver for IOCTL_DISK_GET_STORAGEID, then the driver returns TRUE if successful; otherwise, it returns FALSE.

Remarks

To get extended error information, call GetLastError. GetLastError may return other standard error messages as appropriate. An error of ERROR_INSUFFICIENT_BUFFER indicates that lpOutBuffer is too small to store the information.

Remarks

This IOCTL is required to implement Digital Rights Management.

Block device drivers implement this code.

The caller must allocate enough memory for the structure and the identifiers. If the buffer is not large enough to hold the data, the call will fail and dwSize will receive the size of the required buffer. Whether a block device driver supports this code depends on the implementation and whether the hardware contains storage identifier information.

You do not need to store the manufacturer identifier string and disk serial number. For ATA disk devices, the manufacturer identifier string and disk serial number read directly from the storage card.

Requirements

Header

diskio.h

See Also

Reference

Block Driver IOCTLs
DeviceIoControl
STORAGE_IDENTIFICATION