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.