Getting Unique Device ID using GetDeviceUniqueID API

Download the source code

The API GetDeviceUniqueID is used to retrieve unique device hash that can be used to uniquely identify the device. To use this function we have to supply an application specific value that will be used to create the unique hash value. Giving the same application specific value will generate the same hash value even if the device is re-flashed or cold-booted.

The syntax of the function is:

HRESULT GetDeviceUniqueID(LPBYTE pbApplicationData,DWORD cbApplictionData,DWORD dwDeviceIDVersion,LPBYTE pbDeviceIDOutput,DWORD *pcbDeviceIDOutput);

The first parameter is the application specific value and the second is the length of application specific value. This value should be at least 8 characters in length otherwise the API will fail. The third parameter should be 1. Fourth is an out paramter which will be filled with the device specific unique id. The fifth one is the length of the fourth paramter. Before calling this API we set this parameter to the size of the fourth one and when the API returns this will contain the length of the hash value generated. This size should be at least GETDEVICEUNIQUEID_V1_OUTPUT which is 20 bytes.

The sample application get the unique id and just display it on and edit control.

2 Comments

Add yours →

  1. That’s really a great article work as a charm..
    Can we use this project in Asp.Net C#,Mobile Application for wap.Actuallly I have to develop a WAP application which I am developing in Asp.Net 3.5(C#) , and need to get the device id which is used as a parameter to all the web services.But, I am not able to find any way to do so though searching for a lot of links.
    Please help me in this regard. Can I use this project in my web application ,if yes, how ? or is there any way to find the Device Id of the device on which my application is running on??

    Thanks ,
    Ajay

  2. That’s really a great article work as a charm..
    Can we use this project in Asp.Net C#,Mobile Application for wap.Actuallly I have to develop a WAP application which I am developing in Asp.Net 3.5(C#) , and need to get the device id which is used as a parameter to all the web services.But, I am not able to find any way to do so though searching for a lot of links.
    Please help me in this regard. Can I use this project in my web application ,if yes, how ? or is there any way to find the Device Id of the device on which my application is running on??

    Thanks ,
    Ajay

Leave a Reply