Limited Promotion: Mesa 2 and Allegro 2/3 Accessories
search

Platform and Device Identification in Software

8 Aug 2018

Note: This information is provided as a reference and does not imply that Juniper Systems will be able to provide full support for the use of any specific third-party software with a Juniper Systems product.

Identifying the platform can be useful to ensure software compatibility. Similarly, uniquely identifying individual devices can be useful for software licensing (copyright protection).

 

Mesa 2

In the Microsoft Windows 10 Pro operating system version 1607 (Anniversary Update) and later, a general method for platform and unique device identification is described at the following web pages.

https://docs.microsoft.com/en-us/uwp/api/windows.system.profile.systemidentification

https://stackoverflow.com/questions/40387615/how-to-get-unique-device-ids-on-windows-10-anniversary-update

 

An example is as follows.

var idInfo = Windows.System.Profile.SystemIdentification.GetSystemIdForPublisher();
if (idInfo?.Id != null)
{
    using (var reader = DataReader.FromBuffer(idInfo.Id))
    {
        var bytes = new byte[idInfo.Id.Length];
        reader.ReadBytes(bytes);
        var id = BitConverter.ToString(bytes);
    }
}
 
 

If wanting a more platform specific function, there is a M2DLLInfo.dll that is built into the Mesa 2. The function to get the Serial Number is as follows.

bool GetSerialNumber( char* pSerialNumber, DWORD * pdwStrLen);

 

This function should return our unique Serial Number that is saved in the BIOS. If you are using C# you could PInvoke this function if needed.  Otherwise, we were previously recommending to run the following (Power Shell) command.

WMIC BIOS get serialnumber

 

This command returns our unique serial number that is recorded in a few bits of the following Windows registry key.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\mssmbios\Data]

SMBiosData BINARY

 

 

March 2012

Microsoft Windows Embedded Handheld (formerly Windows Mobile)

One location in the Windows registry that contains such information by default is [HKEY_LOCAL_MACHINE\Ident], though that information can be changed by the user. More permanent identity information can be obtained using the methods described in the sections below.

 

Platform Identification

Some methods to identify the platform (Allegro 2, Archer 2, Mesa, TK6000, classic Archer, Allegro MX, CX, CE, etc.) on which your software is running include the following.

 

Microsoft API

Microsoft has an API that will work on our Windows Embedded Handheld (formerly Windows Mobile) handhelds as explained at the following webpage.

http://msdn.microsoft.com/en-us/library/aa932539.aspx

 

Specifically, using the SPI_GETPLATFORMNAME Parameter will return a simple identifier such as "Allegro MX" or "Archer".

Additional or alternative methods are described at the following web page.

 

http://www.christec.co.nz/blog/archives/77

 

Juniper Systems API (JSAPI)

We provide an API for identifying our newer Microsoft Windows Mobile 6.1 handhelds (failure to load this DLL for this API could also possibly be used to identify our older handhelds or operating systems) as explained at the following webpage.

http://junipersys.com/design/junipersys/JSAPIDocumentation/html/_j_s_a_p_i_8h.html#7327c4d679b09087b43c29248a222b84

 

For our Allegro product models, successfully loading the DLL for our now deprecated Allegro APIs (which has since been replaced by JSAPIs) could identify our older handheld platforms as explained at the following webpage.

http://junipersys.com/index.php/Juniper-Systems/support/Developers/Archer-Field-PC/Archer-Field-PC/Custom-APIs-Application-Programming-Interfaces

 

Device Indentification

The functions described below are to be used when developing software to identify each individual Field PC device to which the software has been installed. This can be useful when creating software licensing (for copyright protection), confirming that the correct version of software is being installed, and other needs requiring the identification of specific devices.

 

Windows Mobile Field PCs

Microsoft recommends to use the GetDeviceUniqueID() function that was incorporated into all Windows Mobile 5.0 and newer devices (though it has become more standard on Windows Mobile 6.0 and newer devices). Using this function prevents the need for software developers to create different unique builds of their software application or having to incorporate multiple methods simply for identifying individual devices from different device manufacturers.

This function returns a 16 byte code derived from hardware specific information that is unique to each device. For more information, please visit the following website:

http://msdn2.microsoft.com/en-us/library/ms893522.aspx

 

Additional information can also be obtained from:

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

 

The GetDeviceUniqueID() function returns a "hash" of the manufacturer assigned serial number and other information to give each device a unique number. It is unique to each device, but it is not the serial number assigned to each device by Juniper Systems.

If you are writing software specific to our Windows Mobile Field PCs, or have pre-existing software which already uses the multiple, varied methods for retrieving the individual serial number from different hardware device manufacturers, you can programmatically identify the Juniper Systems assigned hardware serial number using the JSAPI GetSerialNumber function as explained at our Custom APIs (Application Programming Interfaces) developer links.

Alternatively, it is possible to call the unique ID from an inserted card (like an SD card) so software can be locked to only the device that currently has that specific card inserted (which could be moved between devices when needed). Though this currently requires access to some low level function calls which are normally only provided to device manufacturers (Platform Builder).

 

Windows CE Field PCs (Allegro CX and older, not Allegro 2 or MX)

To determine the platform, call SystemParametersInfo(uiAction, uiParam, pvParam, 0) with uiAction equal to SPI_GETPLATFORMTYPE. The uiParam parameter specifies the length of the buffer in pvParam, which on successful return will contain Allegro F/PC (Allegro CE/DOS), Allegro CE, or Allegro CX (depending on the Allegro you are using) in Unicode characters.

To get the serial number, the Allegro contains a unique DLL called "AllegroAPI" that provides functions such as one to return the serial number. The "GetAllegroSerialNumber" function in the AllegroAPI.dll is as follows:

ALEGROAPI BOOL AllegroGetSerialNumber( PTCHAR szSerialString, PDWORD pdwLen );

 

The AllegroGetSerialNumber function returns the unique serial number of the device in a zero-terminated, fixed length (leading zeros) character string. If you only want to know the length of the serial number (to allocate space, for example) pass NULL for szSerialString.

 

Below is a sample of some C++ code for getting the serial number.

#include "AllegroAPI.h"
TCHAR serialID[10];
DWORD dwLen = sizeof(serialID); AllegroGetSerialNumber(serialID,&dwLen);

 

The Allegro SDK must be used and the AllegroAPI.lib must be added to the linker under Project\Settings and Link Tab.The AllegroAPI.dll is on the Allegro in the Windows directory, but is not viewable to the user, even when viewing hidden files. Calling the above function will work. The same function is called for viewing the Device Name in the Control Panel under Communications or System.

If using Embedded Visual Basic or a Microsoft .NET programming language, you will need to P/Invoke the AllegroGetSerialNumber function. You will need to declare the header similar to:

[DllImport("AllegroAPI.dll", SetLastError=true)]
private static extern bool AllegroGetSerialNumber(ref
StringBuilder szSerialString, ref long pdwLen);