1/ 两个IMGE 是否使用同一个SD卡驱动程序,如果是, 这个函数你可能用错了.如果否,建议使用同一个;
2/仔细看函数的使用说名,以下为他的解释:
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);
3/ 看看说明下面的哪个注意事项 :
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.
百思不得其解,后来看到msdn中有这样一句
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
是不是说api是微软定的,但是具体执行方式则是由OEM自己填充,这才可以解释为什么有的机器运行该函数返回TRUE但是实际上什么也没做。