IOCTL_DISK_GET_STORAGEID
This IOCTL returns the current STORAGE_IDENTIFICATION structure for a particular storage device. The DeviceIoControl function calls this IOCTL.
Parameters
hDevice
[in] Handle to the block device storage volume, which can be obtained by opening the FAT volume by its file system entry. The following code example shows how to open a PC Card storage volume.hVolume = CreateFile(TEXT("\Storage Card\Vol:"), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
dwIoControlCode
[in] Specifies this IOCTL.lpInBuf
[in] Set to NULL.nInBufSize
[in] Set to zero.lpOutBuf
[out] Set to the address of an allocated STORAGE_IDENTIFICATION structure. This buffer receives the storage identifier data when the IoControl call returns.nOutBufSize
[out] Set to the size of the STORAGE_IDENTIFICATION structure 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 that receives the number of bytes that lpOutBuf receives.lpOverlapped
Not used.
Return Values
If you provide support in a block device driver for IOCTL_DISK_GET_STORAGEID, then the driver should return TRUE on a successful operation, and return FALSE if this is a non-supported code. If FALSE returns, callers should call GetLastError for information. An error of ERROR_INSUFFICIENT_BUFFER indicates that lpOutBuf is too small to store the information.
Remarks
Block device drivers, such as the sample ATADISK driver, implement this code. For more information, see Sample ATADISK Driver.
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
OS Versions: Windows CE 3.0 and later.
Header: Diskio.h.
See Also
Block Drivers | DeviceIoControl | STORAGE_IDENTIFICATION | Sample ATADISK Driver
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.