views:

827

answers:

3

I need to generate unique machine ID for a CE 6.0 device. On Windows OS, I was using the WMI to obtain some hardware identifiers from which I constructed this ID. Apparently, WMI is not supported on Win CE so I am looking for alternatives.

At the moment I am playing with OS image that I have constructed in Platform Builder and testing my app in emulator, only later I will be delivered the real WinCE device.

I have tried both GetDeviceUniqueID and KernelIoControl(IOCTL_HAL_GET_DEVICEID,... but they both return ERROR_NOT_SUPPORTED ( 0x80070032 ).

  1. Do I need to include some package from the wince catalog in order to enable this feature?
  2. Is this limitation only on emulators? (i mean, could it be that OEM's are implementing this unique-id-feature for real devices?

  3. Do you have any other idea how I could construct this value? Like getting hardware / OS serials etc. and how?

A: 

Not sure if it's old hat, but this thread seems relevant. It seems to mention folks using emulators both getting "real-looking" ID:s, and folks getting constant 0.

unwind
I came to that link also while searching for the solution. Its not clear, but I suspect that those who got 0 as ID had the same issue as me. Actually, on my first attempt I also got 0 but only later checked the HRESULT and noticed the error. So I presume they are also getting some error code (and ignoring the HRESULT).
Sasha
+2  A: 

If you're building the OS, then you need to implement the IOCTL so that KernelIoControl returns something. How its derived is completely up to you. I've seen the MAC as a base, as well as the serial number of on-board flash.

How you'd do that for your particular platform I can't say, but as an example for x86 you might clone the code at %WINCEROOT&\PLATFORM\COMMON\SRC\X86\COMMON\IOCTL\devinfo.c and modify the clone (don't modify the common code, obviously).

ctacke
A: 

http://vedatsivri.wordpress.com/2010/06/04/how-can-i-get-machine-id-from-windows-ce-device/

vedatsivri
He needs to generate the ID - this link shows how to retrieve it, which he's already done and found that it returns ERROR_NOT_SUPPORTED.
ctacke
then, device does not supported. there is nothing to do. because, coredll.dll just only support windows base devices. :(
vedatsivri
The question explicitly states that he's the one creating the OS image, so yes there is plenty he can do. He can implement the IOCTL, just like the accepted answer suggests.
ctacke