Truxton child file create usb

From truxwiki.com
Revision as of 22:06, 17 November 2020 by Sam (talk | contribs)
Jump to navigation Jump to search

This creates a USB device object sourced from this file that you can use in the USB Device Visit API. A USB object is how you add records to the [USBDevice] table. The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.

Syntax

uint64_t truxton_child_file_create_usb( uint64_t child_handle );

Parameters

child_handle

The handle created by the truxton_child_file_create or truxton_file_create_child call.

Return value

A handle to a USB device object.

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");

   truxton_child_file_set_origin(child, ORIGIN_GENERATED);

   if ( truxton_child_file_save(child) == 0 )
   {
      printf( "Failed to add child to Truxton\n" );
   }

   uint64_t usb = truxton_child_file_create_usb(child);

   truxton_usb_set_vendor_id(usb, 0x1234);
   truxton_usb_set_product_id(usb, 0x5678);
   truxton_usb_set_when(usb, truxton_file_get_modified( parent_file ) );
   truxton_usb_save(usb);
   truxton_usb_destroy(usb);

   truxton_child_file_destroy(child);
}