I have been running this program in my ASUS A716 PPC for checking the
serial number of the SD card. It is interesting that HP/DELL/ACER with
PPC2003 report both Manufacturer ID and Serial ID in hexidecimal
format, while Asus A716 report only the Serial ID (Manafacturer ID
reported as not available), and the Serial ID is in decimal format.
What's more strange is that the serial ID reported is not correct.
Any body has any idea? (attached with my testing program)
Best regards,
John(john@sky-power.com.hk)
==================================================================
#include "stdafx.h"
#include <winioctl.h>
#include <storemgr.h>
extern "C" __declspec(dllimport)
#define IOCTL_DISK_GET_STORAGEID
CTL_CODE(FILE_DEVICE_DISK,0x709,METHOD_BUFFERED,FILE_ANY_ACCESS)
BOOL KernelIoControl(DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD);
typedef struct _STORAGE_IDENTIFICATION
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwManufactureIDOffset;
DWORD dwSerialNumOffset;
} STORAGE_IDENTIFICATION;
typedef struct _PPC_STOAGEID
{
STORAGE_IDENTIFICATION StorageID;
unsigned char Data[64];
} PPC_STORAGE_ID;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR
lpCmdLine,int nCmdShow)
{
PPC_STORAGE_ID idSD;
HANDLE hSD;
DWORD dwLength;
DWORD dwError;
BOOL bResult;
// I have checked the registry profile that the SD card is DSK1:
TCHAR sDeviceName[10]=_T("DSK1:");
memset(&idSD,0,sizeof(PPC_STORAGE_ID));
idSD.StorageID.dwSize=sizeof(PPC_STORAGE_ID);
hSD=CreateFile(sDeviceName,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
if(hSD)
{
bResult=DeviceIoControl(hSD,IOCTL_DISK_GET_STORAGEID,NULL,0,&idSD,sizeof(PPC_STORAGE_ID),&dwLength,NULL);
// Most HP, Dell and Acer with PPC2003 return both manufacturer ID
and serial ID
// Asus A716 only return a serial ID, but the serial ID is not
correct
// Asus reported "2014249026" (which is 780F0042 in HEX)
// but the correct ID should be 780F662D in HEX
if(bResult==FALSE)
dwError=GetLastError();
CloseHandle(hSD);
}
return 0;
}