Device Unique ID

Hello,

i'm trying to get the unique DEVICEID from some PocketPC with the function:

KernelIoControl(IOCTL_HAL_GET_DEVICEID, IntPtr.Zero, 0, OutputBuffer, OutputBufferSize, ref BytesReturned);

...this works fine.

...But for some OEM device this function returns always the same code...

How can i get a unique identifier for that device

thanks for suggestions

Andrea C.



Answer this question

Device Unique ID

  • duck thing

    Andrea,

    We've used the following function successfully on all Symbol Mobile devices and it works:

    Public Function GetDeviceID() As String

    Dim len As Int32 = 256, cb As Int32 = 0

    Dim buffer(256) As Byte

    Dim ret As Int32

    buffer(0) = 0

    buffer(1) = 1

    Try

    ret = KernelIoControl(&H1010054, IntPtr.Zero, 0, buffer, len, cb)

    Catch ex As Exception

    ShowError(ex, "GetDeviceID")

    End Try

    Dim dwPresetIDOffsset As Int32 = BitConverter.ToInt32(buffer, 4)

    Dim dwPlatformIDOffset As Int32 = BitConverter.ToInt32(buffer, &HC)

    Dim dwPlatformIDSize As Int32 = BitConverter.ToInt32(buffer, &H10)

    Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder

    sb.Append(String.Format("{0:X8}-{1:X4}-{2:X4}-{3:X4}-", _

    BitConverter.ToInt32(buffer, dwPresetIDOffsset), _

    BitConverter.ToInt16(buffer, dwPresetIDOffsset + 4), _

    BitConverter.ToInt16(buffer, dwPresetIDOffsset + 6), _

    BitConverter.ToInt16(buffer, dwPresetIDOffsset + 8)))

    For i As Int32 = dwPlatformIDOffset To dwPlatformIDOffset + dwPlatformIDSize - 1

    sb.Append(String.Format("{0:X2}", buffer(i)))

    Next i

    Return sb.ToString

    End Function

    Hope this helps.



  • One Touch

    You can not since OEM failed to include unique ID. Please consider using something else for identification purposes.



  • ManishMenon

    thanks for your suggestions...

    but this is the same code i use... for some device this code return the same ID

    Andrea


  • deputydawg219

    Hummm ....

    We tested this on about 20 different handhelds (all from Symbol Technologies) and different models and the id was different everytime. Are you using a consumer-grade device If so, that may have something to do with it. Not sure ....

    Have you tried maybe the SDK from the hardware manufacturer assuming one is available

    Good luck.



  • Device Unique ID