Difference between revisions of "Truxton enumeration get scope id"
Jump to navigation
Jump to search
(Created page with "Retrieves the next item in the enumeration. =Syntax= <source lang="C"> void truxton_enumeration_get_scope_id( uint64_t enumeration_handle, char * destination_string, size_t m...") |
(→Sample) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | Retrieves the | + | Retrieves the identifier of the scope of the enumeration. |
=Syntax= | =Syntax= | ||
| Line 30: | Line 30: | ||
} | } | ||
| − | void main() | + | void main( void ) |
{ | { | ||
char investigation_name[256]; | char investigation_name[256]; | ||
Latest revision as of 10:49, 3 February 2024
Retrieves the identifier of the scope of the enumeration.
Syntax
void truxton_enumeration_get_scope_id( uint64_t enumeration_handle, char * destination_string, size_t max_size );
Parameters
enumeration_handle
The handle returned by calling truxton_enumeration_create().
destination_string
The string to be written to.
max_size
The maximum number of characters that can be written to destination_string
Sample
void print_details( uint64_t enumerator )
{
char uuid[40];
uint64_t scope = truxton_enumeration_get_scope( enumerator );
uint64_t target = truxton_enumeration_get_target( enumerator );
truxton_enumeration_get_scope_id( enumerator, uuid, sizeof( uuid ) );
printf( "%" PRIu64 " - %s - %" PRIu64 "\n", scope, scope_id, target );
}
void main( void )
{
char investigation_name[256];
truxton_start();
uint64_t truxton = truxton_create();
uint64_t enumerator = truxton_enumeration_create( truxton );
truxton_enumeration_set_target( enumerator, Type_Investigation );
uint64_t investigation_handle = truxton_enumeration_get_next( enumerator );
uint64_t count = 0;
print_details( enumerator );
while( investigation_handle != 0 )
{
count++
investigation_handle = truxton_enumeration_get_next( enumerator );
}
printf( "%" PRIu64 " investigations\n", count );
truxton_enumeration_destroy( enumerator );
truxton_destroy( truxton );
truxton_stop();
}
The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned integer in C.
Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.