QA: How can I get a serial number of a Pocket PC 2002 device?
Vassili Philippov (vasja@spbteam.com), December 27, 2001.
Question
As far as I know all Pocket PC 2002 devices support built-in serial
numbers. How can I read it?
Answer
Even in Pocket PC 2000 it was recommended for OEM vendors to implement
a built-in serial number and provide access using KernelIoControl
function. But no OEM vendor did it.
As I understand now (in Pocket PC 2002) Microsoft forced OEM vendors
to implement a built-in serial number with access by KernelIoControl.
All Pocket PC 2002 devices I tested support this method.
Source code
Here is a sample code that returns a serial number as a string:
#include
extern "C" __declspec(dllimport)
BOOL KernelIoControl(
DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize,
LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned
);
#define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
CString GetSerialNumberFromKernelIoControl()
{
DWORD dwOutBytes;
const int nBuffSize = 4096;
byte arrOutBuff[nBuffSize];
BOOL bRes = ::KernelIoControl(IOCTL_HAL_GET_DEVICEID,
0, 0, arrOutBuff, nBuffSize, &dwOutBytes);
if (bRes) {
CString strDeviceInfo;
for (unsigned int i = 0; i
Note: this serial number is not equal to serial number written
on the device. It is because I did not know how to format the bits
extracted from the buffer. So you can consider this string as
a string that is unique for each Pocket PC device.
Related resources:
-
http://www.pocketpcdn.com/sections/deviceinfo.html
Section: Device Information
-
http://www.pocketpcdn.com/articles/serial_number.html
QA: How can I get the serial number of a Pocket PC 2000 device?
-
http://www.pocketpcdn.com/articles/ownerinformation.html
Article: Retrieving Owner Information on Pocket PC