Truxton file open id

From truxwiki.com
Revision as of 08:04, 31 May 2020 by Sam (talk | contribs) (Created page with "This retrieves entropy of the file contents. =Syntax= <syntaxhighlight lang="C"> uint64_t truxton_file_open_id( uint64_t truxton_handle, char const * guid_string ) </syntaxhi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This retrieves entropy of the file contents.

Syntax

uint64_t truxton_file_open_id( uint64_t truxton_handle, char const * guid_string )

Parameters

truxton_handle

The handle created by the truxton_create call.

guid_string

The string representation of the identifier of the file to get in Truxton. This corresponds to the ID column of the File table.

Return value

A handle to a read-only file in Truxton.

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

   FILETIME now;

   GetSystemTimeAsFileTime(&now);

   ULARGE_INTEGER ticks;

   ticks.LowPart = now.dwLowDateTime;
   ticks.HighPart = now.dwHighDateTime;

   truxton_child_file_set_created(child, ticks.QuadPart);
   truxton_child_file_set_accessed(child, ticks.QuadPart);
   truxton_child_file_set_modified(child, ticks.QuadPart);

   truxton_child_file_set_origin(child, ORIGIN_GENERATED);

   if ( truxton_child_file_save(child) == 0 )
   {
      printf( "Failed to add child to Truxton\n" );
   }
   else
   {
      double entropy = truxton_child_file_get_entropy(child_file);
      printf( "Entropy:s %lf\n", entropy );
   }

   truxton_child_file_destroy(child);
}