Difference between revisions of "Truxton child file create"
Jump to navigation
Jump to search
(→Syntax) |
(→Sample) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
=Syntax= | =Syntax= | ||
<source lang="C"> | <source lang="C"> | ||
| − | uint64_t truxton_child_file_create( uint64_t | + | uint64_t truxton_child_file_create( uint64_t truxton_handle ); |
</source> | </source> | ||
| Line 16: | Line 16: | ||
=Sample= | =Sample= | ||
<source lang="C" highlight="5"> | <source lang="C" highlight="5"> | ||
| − | void add_folder(uint64_t truxton, uint64_t parent_file) | + | void add_folder( uint64_t truxton, uint64_t parent_file ) |
{ | { | ||
| − | truxton_start_adding_files(truxton); | + | truxton_start_adding_files( truxton ); |
| − | uint64_t child = truxton_child_file_create(truxton); | + | uint64_t child = truxton_child_file_create( truxton ); |
char id[40]; | char id[40]; | ||
| − | truxton_file_get_id(parent_file, id, sizeof(id)); | + | truxton_file_get_id( parent_file, id, sizeof(id) ); |
| − | truxton_child_file_set_parent_id(child, id); | + | truxton_child_file_set_parent_id( child, id ); |
| − | truxton_child_file_set_type(child, Type_Directory); | + | truxton_child_file_set_type( child, Type_Directory ); |
| − | truxton_child_file_set_name(child, "Custom Exploits Folder"); | + | truxton_child_file_set_name( child, "Custom Exploits Folder" ); |
| − | + | uint64_t now = truxton_time_now(); | |
| − | + | truxton_child_file_set_created( child, now ); | |
| + | truxton_child_file_set_accessed( child, now ); | ||
| + | truxton_child_file_set_modified( child, now ); | ||
| − | + | truxton_child_file_set_origin( child, ORIGIN_GENERATED ); | |
| − | + | if ( truxton_child_file_save( child ) == 0 ) | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | if ( truxton_child_file_save(child) == 0 ) | ||
{ | { | ||
printf( "Failed to add child to Truxton\n" ); | printf( "Failed to add child to Truxton\n" ); | ||
} | } | ||
| − | truxton_child_file_destroy(child); | + | truxton_child_file_destroy( child ); |
} | } | ||
</source> | </source> | ||
Latest revision as of 17:02, 13 April 2024
This creates a child file object that you can populate with information before adding it to Truxton.
Syntax
uint64_t truxton_child_file_create( uint64_t truxton_handle );
Parameters
truxton_handle
The Truxton instance this child file will belong.
This handle comes from calling truxton_create().
Return value
A non-zero value on success, zero on failure.
Sample
void add_folder( uint64_t truxton, uint64_t parent_file )
{
truxton_start_adding_files( truxton );
uint64_t child = truxton_child_file_create( truxton );
char id[40];
truxton_file_get_id( parent_file, id, sizeof(id) );
truxton_child_file_set_parent_id( child, id );
truxton_child_file_set_type( child, Type_Directory );
truxton_child_file_set_name( child, "Custom Exploits Folder" );
uint64_t now = truxton_time_now();
truxton_child_file_set_created( child, now );
truxton_child_file_set_accessed( child, now );
truxton_child_file_set_modified( child, now );
truxton_child_file_set_origin( child, ORIGIN_GENERATED );
if ( truxton_child_file_save( child ) == 0 )
{
printf( "Failed to add child to Truxton\n" );
}
truxton_child_file_destroy( child );
}