QA: How can I get the serial number of a Pocket PC 2000 device?
Vassili Philippov (vasja@spbteam.com), July 05, 2001.
Question
I need to get serial number of a Pocket PC 2000 device. How can I do it?
Answer
All existing information shows that you can do it only for Compaq iPAQ
Pocket PC devices. There is a standard way suggested to OEM vendors by
Microsoft but it isn't supported neither by Casio Cassiopeia nor by
HP Jornada nor even by Compaq iPAQ. You can find information about
reading serial number of Pocket PC 2002 devices in the article
QA: How can I get the serial number of a Pocket PC 2002 device?.
Compaq iPAQ
Run \windows\CreateAssetFile.exe file and then read
\windows\cpqAssetData.dat file - it will contain computer serial number.
Symbol PPT
Symbol support team wrote that Symbol PPT devices support serial number that could be read using
RCM_GETUNIQUEUNITID function. You should download and use
Symbol SDK.
Source code
Here is a sample code for iPAQ:
CString GetSerialNumber()
{
// Start CreateAssetFile.exe
PROCESS_INFORMATION pi;
if (!::CreateProcess(TEXT("\\windows\\CreateAssetFile.exe"),
NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
{
m_strCompaqIpaqId = _T("");
m_strErrorMessage += _T("Cannot run \\windows\\CreateAssetFile.exe file.");
return TEXT("");
}
// Wait until CreateAssetFile.exe will be finished
::WaitForSingleObject(pi.hProcess, INFINITE);
// Read data from cpqAssetData.dat file
HANDLE hInFile;
TCHAR strSN[65];
DWORD dwBytesRead;
hInFile = CreateFile(TEXT("\\windows\\cpqAssetData.dat"), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (hInFile == INVALID_HANDLE_VALUE) {
m_strCompaqIpaqId = _T("");
m_strErrorMessage += _T("Cannot read \\windows\\cpqAssetData.dat file.");
return TEXT("");
}
SetFilePointer(hInFile, 976, NULL, FILE_BEGIN);
memset(strSN, 0, 64 * sizeof(TCHAR));
ReadFile(hInFile, &strSN, 64, &dwBytesRead, NULL);
CloseHandle(hInFile);
return CString(strSN);
}
Related resources:
-
http://www.pocketpcdn.com/sections/deviceinfo.html
Section: Device Information
-
http://www.pocketpcdn.com/articles/serial_number2002.html
QA: How can I get the serial number of a Pocket PC 2002 device?
-
http://www.pocketpcdn.com/articles/ownerinformation.html
Article: Retrieving Owner Information on Pocket PC