Difference between revisions of "Truxton enumeration get next"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "Retrieves the next item in the enumeration. =Syntax= <source lang="C"> uint64_t truxton_enumeration_get_next( uint64_t enumeration_handle ); </source> =Return value= A non-z...")
 
Line 5: Line 5:
 
uint64_t truxton_enumeration_get_next( uint64_t enumeration_handle );
 
uint64_t truxton_enumeration_get_next( uint64_t enumeration_handle );
 
</source>
 
</source>
 +
 +
=Parameters=
 +
==<code>enumeration_handle</code>==
 +
The handle returned by calling <code>[[truxton_enumeration_create]]</code>.
  
 
=Return value=
 
=Return value=

Revision as of 11:53, 5 May 2023

Retrieves the next item in the enumeration.

Syntax

uint64_t truxton_enumeration_get_next( uint64_t enumeration_handle );

Parameters

enumeration_handle

The handle returned by calling truxton_enumeration_create.

Return value

A non-zero value on success, zero on failure or the end of the enumeration.

Sample

void dump_media_in_investigation( uint64_t truxton_handle, uint64_t investigation_handle )
{
    char media_name[ 256 ];
    char investigation_id[ 65 ];

    truxton_investigation_get_id( investigation_handle, investigation_id, sizeof( investigation_id ) );

    uint64_t enumerator = truxton_enumeration_create( truxton );

    // Now setup the enumeration to get the media in a particular investigation
    truxton_enumeration_set_scope( enumerator, Type_Investigation );
    truxton_enumeration_set_scope_id( enumerator, investigation_id );
    truxton_enumeration_set_target( enumerator, Type_Media );

    uint64_t media_handle = truxton_enumeration_get_next( enumerator );

    while( media_handle != 0 )
    {
        truxton_media_get_name( media_handle, media_name, sizeof( media_name ) );
        printf( "Media: %s\n", media_name );

        media_handle = truxton_enumeration_get_next( enumerator );
    }

    truxton_enumeration_destroy( enumerator );
}

void main()
{
    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 );

    while( investigation_handle != 0 )
    {
        truxton_investigation_get_name( investigation_handle, investigation_name, sizeof( investigation_name ) );

        printf( "Investigation: %s\n", investigation_name );

        dump_media_in_investigation( truxton, investigation_handle );

        investigation_handle = truxton_enumeration_get_next( enumerator );
    }

    truxton_enumeration_destroy( enumerator );
    truxton_destroy( truxton );
    truxton_stop();
}