Obtain the unique machine number of the Windows Mobile collector

Source: Internet
Author: User

Find a method to obtain the unique machine number of a Windows Mobile System machine on the Internet and mark it here for ease of searching.

Getdeviceuniqueid: http://blogs.msdn.com/ B /windowsmobile/archive/2006/01/09/510997.aspx

 

There is a new API that can be used to retrieve device IDs on Windows Mobile 5.0 for handheld computers and smartphones. The first question: why is there something wrong with a new method for getting the device ID, old? Answer: You Need To Know What device ID is. There is a very good and detailed explanation here, but it is essentially from hardware-specific information and is unique for each device with 16-byte code. This ID is not the same as the IMEI number, or both of them can be changed, but this code lives and ends with the phone number found on the device based on the phone.

Therefore, device IDs are very useful. The purpose of software is your device, such as replication protection, or immutable identity that provides Web service calls. Similarly, it is a resource that should be protected to reduce the risk of identity information theft.

Obtaining device IDS is straightforward, but requires some C ++ or a reasonable number of codes for interoperability. The API is something like this:

Kerneliocontrol (ioctl_hal_get_deviceid, 0, 0 buffer guidlength, out bytesreturned );

The operation that protects the device ID is currently used as the kerneliocontrol API privilege of the smart phone security model means that your code must run in a trusted code group that can access this API. But these two problems:

1> and include Pocket PC 2003se there is no security model to protect this API, so there is no device ID protected in the Pocket PC.

2> do they need to access this API when executing untrusted applications?

3> device IDs read and used by many applications may increase the attack surface of identity information theft.

Getdeviceuniqueid tries to solve these problems and reduces application dependencies on valuable device IDs. First, you can call getdeviceuniqueid from these trusted or Untrusted code, but the returned code is not kerneliocontrol, and the same 20-byte code is not a 16-byte code. The getdeviceuniqueid additional parameter is an array composed of char arrays defined by the application, and uses a unidirectional hash to combine the real device ID with the new 20-byte code char array parameter. This means that the application will always get the same 20-byte code, if the same device with the same char array calls getdeviceuniqueid. This also means that there is no practical way to claim the real device ID from a 20-byte key used by an application.

This is a public coredll. dll, so here is a hosted code snippet that shows how to obtain information through interoperability with the local API. Disclaimer of Standard Code

/*

Hresult getdeviceuniqueid (

Lpbyte pbapplicationdata

DWORD Value cbapplictiondata

DWORD Value: dwdeviceidversion

Lpbyte pbdeviceidoutput

DWORD Value * required deviceidoutput

);

*/

[Dllimport ("coredll. dll")]

Private external static int getdeviceuniqueid ([Middle and outer] Byte [] appdata,

Int cbapplictiondata

Int dwdeviceidversion

[Middle and outer] Byte [] deviceidouput,

Output uint into deviceidoutput );

 

Private byte [] (string appstring) getdeviceid

{

// Call, getdeviceuniqueid

Byte [] appdata = new byte [appstring. Length];

(Int count = 0; count <appstring. length; number ++)

Appdata [count] = (byte) appstring [count];

Int appdatasize = appdata. length;

[Deviceoutput] Byte = new byte [20];

Uint sizeout = 20;

Getdeviceuniqueid (appdata, appdatasize, 1, deviceoutput, output sizeout );

Return deviceoutput;

}

 

The complete project code is here.

 

Marcus

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.