Difference between revisions of "Truxton get device id"

From truxwiki.com
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Retrieves the version of the Truxton application object.
+
Retrieves the identifier of the hardware Truxton is running on.
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
void truxton_get_device_id( uint64_t trutxon_handle, char * destination_string, size_t max_size );
+
void truxton_get_device_id( uint64_t truxton_handle, char * destination_string, size_t max_size );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
 
==<code>truxton_handle</code>==
 
==<code>truxton_handle</code>==
 
 
The handle created by the [[truxton_create]] call.
 
The handle created by the [[truxton_create]] call.
  
 
==<code>destination_string</code>==
 
==<code>destination_string</code>==
 
 
The string to be written to.
 
The string to be written to.
  
Line 19: Line 17:
  
 
=Remarks=
 
=Remarks=
 
+
A device ID in Truxton is a [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] that uniquely identifies the hardware.
A device ID in Truxton is a [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] that uniquely identifies the machine.
 
 
The source of this identifier is the [https://en.wikipedia.org/wiki/BIOS BIOS] of the computer running your program.
 
The source of this identifier is the [https://en.wikipedia.org/wiki/BIOS BIOS] of the computer running your program.
 
It can be retrieved using <code>[https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic wmic]</code> using these parameters:
 
It can be retrieved using <code>[https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic wmic]</code> using these parameters:
<syntaxhighlight lang="bat">
+
<source lang="bat">
 
wmic path Win32_ComputerSystemProduct get UUID
 
wmic path Win32_ComputerSystemProduct get UUID
</syntaxhighlight>
+
</source>
  
 
This identifier is also written to the <code>[[Depot#bios_id|bios_id]]</code> field of the header of a Depot File.
 
This identifier is also written to the <code>[[Depot#bios_id|bios_id]]</code> field of the header of a Depot File.
  
 
=Sample=
 
=Sample=
 
+
<source lang="C" highlight="9">
<syntaxhighlight lang="C" highlight="9">
+
void main( void )
void main()
 
 
{
 
{
 
     char id[256];
 
     char id[256];
Line 40: Line 36:
 
     uint64_t truxton = truxton_create();
 
     uint64_t truxton = truxton_create();
  
     truxton_get_device_id(truxton, id, sizeof(id));
+
     truxton_get_device_id( truxton, id, sizeof(id) );
  
     printf("%s\n", id);
+
     printf( "%s\n", id );
  
     truxton_destroy(truxton);
+
     truxton_destroy( truxton );
  
 
     truxton_stop();
 
     truxton_stop();
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 10:53, 3 February 2024

Retrieves the identifier of the hardware Truxton is running on.

Syntax

void truxton_get_device_id( uint64_t truxton_handle, char * destination_string, size_t max_size );

Parameters

truxton_handle

The handle created by the truxton_create call.

destination_string

The string to be written to.

max_size

The maximum number of characters that can be written to destination_string

Remarks

A device ID in Truxton is a GUID that uniquely identifies the hardware. The source of this identifier is the BIOS of the computer running your program. It can be retrieved using wmic using these parameters:

wmic path Win32_ComputerSystemProduct get UUID

This identifier is also written to the bios_id field of the header of a Depot File.

Sample

void main( void )
{
    char id[256];

    truxton_start();

    uint64_t truxton = truxton_create();

    truxton_get_device_id( truxton, id, sizeof(id) );

    printf( "%s\n", id );

    truxton_destroy( truxton );

    truxton_stop();
}