The LMX_Hostid function retrieves the HostID values from the computer system.
Prototype
LMX_STATUS LMX_Hostid
(
LMX_HANDLE LmxHandle,
LMX_HOSTID_TYPE eHostidType,
LMX_HOSTID *lpHostid,
int *npHostids
);
Parameters
LmxHandle
[in/out] LM-X handle.
eHostidType
[in] Value that specifies the HostID type to be retrieved.
Possible values are:
Hostid Type |
Description |
LMX_HOSTID_ETHERNET |
Network card HostID |
LMX_HOSTID_USERNAME |
Username HostID |
LMX_HOSTID_HOSTNAME |
Hostname HostID |
LMX_HOSTID_IPADDRESS |
IP address HostID |
LMX_HOSTID_CUSTOM |
Custom HostID |
LMX_HOSTID_DONGLE_HASPHL |
HaspHL Dongle HostID |
LMX_HOSTID_HARDDISK |
HostID of physical harddisk |
LMX_HOSTID_LONG |
System-specific HostID |
LMX_HOSTID_BIOS |
Bios HostID |
LMX_HOSTID_WIN_PRODUCT_ID |
Windows product ID |
LMX_HOSTID_AWS_INSTANCE_ID |
Amazon EC2 Instance ID |
LMX_HOSTID_ALL |
All HostIDs |
lpHostid
[out] Pointer to array of LMX_HOSTID structures. See lmx.h for a description of LMX_HOSTID. The array must be of size LMX_MAX_HOSTIDS.
npHostids
[out] Pointer to a variable that will hold the number of HostIDs of a specific type retrieved. If no HostIDs are available of the type requested, this variable will be set to zero.
Return Values
On success, this function returns the status code LMX_SUCCESS.
On failure, this function returns an error code in the format described in Return codes.
Remarks
When using LMX_HOSTID_ALL, all HostIDs are returned, with the HostID type prefixing the HostID; for example, "ETHERNET=0123456789012345,USERNAME=MyUserName,HOSTNAME=MyHostName,...", etc. Otherwise, the HostID is returned without the HostID type prefixing the HostID; for example, for HostID type LMX_HOSTID_ETHERNET, the string in the preceding example would appear as "0123456789012345".
Examples:
LMX_HOSTID Hostids[LMX_MAX_HOSTIDS];
int nHostids;
int i, j;
LMX_Hostid(LmxHandle, LMX_HOSTID_ETHERNET, Hostid, &nHostids);
for (i = 0; i < nHostids; i++)
printf("Hostid: %s\n", Hostid[i].szValue);
To make use of custom HostIDs, you must set a callback function using LMX_SetOption with the flag LMX_OPT_CUSTOM_HOSTID_FUNCTION. See Using custom HostIDs for more information about using custom HostIDs.