/* Prints the items to a stream * Returns 1 if successful or -1 on error */ int info_handle_items_fprint( info_handle_t *info_handle, libcerror_error_t **error ) { static char *function = "info_handle_items_fprint"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( info_handle->root_item == NULL ) { if( libolecf_file_get_root_item( info_handle->input_file, &( info_handle->root_item ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve root item.", function ); return( -1 ); } } fprintf( info_handle->notify_stream, "Storage and stream items:\n" ); if( info_handle_item_fprint( info_handle, info_handle->root_item, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print root item.", function ); return( -1 ); } fprintf( info_handle->notify_stream, "\n" ); return( 1 ); }
/* Exports the file * Returns 1 if successful or -1 on error */ int export_handle_export_file( export_handle_t *export_handle, log_handle_t *log_handle, libcerror_error_t **error ) { libolecf_item_t *root_item = NULL; static char *function = "export_handle_export_file"; int result = 0; if( export_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid export handle.", function ); return( -1 ); } fprintf( export_handle->notify_stream, "Exporting items.\n" ); #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libcpath_path_make_directory_wide( export_handle->items_export_path, error ); #else result = libcpath_path_make_directory( export_handle->items_export_path, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_WRITE_FAILED, "%s: unable to create directory: %" PRIs_SYSTEM "", function, export_handle->items_export_path ); goto on_error; } log_handle_printf( log_handle, "Created directory: %" PRIs_SYSTEM ".\n", export_handle->items_export_path ); result = libolecf_file_get_root_item( export_handle->input_file, &root_item, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve root item.", function ); goto on_error; } else if( result == 0 ) { return( 1 ); } if( export_handle_export_sub_items( export_handle, root_item, export_handle->items_export_path, export_handle->items_export_path_size - 1, log_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_OUTPUT, LIBCERROR_OUTPUT_ERROR_GENERIC, "%s: unable to export root item.", function ); goto on_error; } if( libolecf_item_free( &root_item, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free root item.", function ); goto on_error; } return( 1 ); on_error: if( root_item != NULL ) { libolecf_item_free( &root_item, NULL ); } return( -1 ); }
/* Prints the document summary information to a stream * Returns 1 if successful or -1 on error */ int info_handle_document_summary_information_fprint( info_handle_t *info_handle, libcerror_error_t **error ) { uint8_t guid_data[ 16 ]; libcstring_system_character_t guid_string[ 48 ]; libfguid_identifier_t *guid = NULL; libolecf_item_t *property_set_stream = NULL; libolecf_property_set_t *property_set = NULL; libolecf_property_section_t *property_section = NULL; libolecf_property_value_t *property_value = NULL; const char *property_value_identifier_string = NULL; static char *function = "info_handle_document_summary_information_fprint"; uint32_t property_value_identifier = 0; uint32_t property_value_type = 0; int number_of_properties = 0; int number_of_sections = 0; int property_index = 0; int result = 0; int section_index = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( info_handle->root_item == NULL ) { if( libolecf_file_get_root_item( info_handle->input_file, &( info_handle->root_item ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve root item.", function ); return( -1 ); } } /* Using \005 because \x05 also absorbes the D */ result = libolecf_item_get_sub_item_by_utf8_name( info_handle->root_item, (uint8_t *) "\005DocumentSummaryInformation", 27, &property_set_stream, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub item.", function ); goto on_error; } else if( result != 0 ) { fprintf( info_handle->notify_stream, "Document summary information:\n" ); if( libolecf_property_set_stream_get_set( property_set_stream, &property_set, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set stream.", function ); goto on_error; } if( libfguid_identifier_initialize( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create GUID.", function ); goto on_error; } if( libolecf_property_set_get_class_identifier( property_set, guid_data, 16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set class identifier.", function ); goto on_error; } if( libfguid_identifier_copy_from_byte_stream( guid, guid_data, 16, LIBFGUID_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to GUID.", function ); goto on_error; } #if defined( LIBCSTRING_HAVE_WIDE_SYSTEM_CHARACTER ) result = libfguid_identifier_copy_to_utf16_string( guid, (uint16_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #else result = libfguid_identifier_copy_to_utf8_string( guid, (uint8_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy GUID to string.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tClass identifier\t: %" PRIs_LIBCSTRING_SYSTEM "\n", guid_string ); if( libolecf_property_set_get_number_of_sections( property_set, &number_of_sections, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of sections.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tNumber of sections\t: %d\n", number_of_sections ); fprintf( info_handle->notify_stream, "\n" ); for( section_index = 0; section_index < number_of_sections; section_index++ ) { fprintf( info_handle->notify_stream, "\tSection: %d\n", section_index + 1 ); if( libolecf_property_set_get_section_by_index( property_set, section_index, &property_section, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set section: %d.", function, section_index ); goto on_error; } if( libolecf_property_section_get_class_identifier( property_section, guid_data, 16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property section class identifier.", function ); goto on_error; } if( libfguid_identifier_copy_from_byte_stream( guid, guid_data, 16, LIBFGUID_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to GUID.", function ); goto on_error; } #if defined( LIBCSTRING_HAVE_WIDE_SYSTEM_CHARACTER ) result = libfguid_identifier_copy_to_utf16_string( guid, (uint16_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #else result = libfguid_identifier_copy_to_utf8_string( guid, (uint8_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy GUID to string.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tClass identifier\t: %" PRIs_LIBCSTRING_SYSTEM "\n", guid_string ); if( libolecf_property_section_get_number_of_properties( property_section, &number_of_properties, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of properties.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tNumber of properties\t: %d\n", number_of_properties ); fprintf( info_handle->notify_stream, "\n" ); for( property_index = 0; property_index < number_of_properties; property_index++ ) { fprintf( info_handle->notify_stream, "\tProperty: %d\n", property_index + 1 ); if( libolecf_property_section_get_property_by_index( property_section, property_index, &property_value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value.", function, property_index ); goto on_error; } if( libolecf_property_value_get_identifier( property_value, &property_value_identifier, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value identifier.", function, property_index ); goto on_error; } if( libolecf_property_value_get_value_type( property_value, &property_value_type, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value type.", function, property_index ); goto on_error; } property_value_identifier_string = NULL; if( memory_compare( guid_data, info_handle_class_identifier_document_summary_information, 16 ) == 0 ) { switch( property_value_type ) { /* TODO */ case LIBOLECF_VALUE_TYPE_INTEGER_16BIT_SIGNED: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_CODEPAGE: property_value_identifier_string = "PIDDSI_CODEPAGE"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_INTEGER_32BIT_SIGNED: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_BYTE_COUNT: property_value_identifier_string = "PIDDSI_BYTECOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_LINE_COUNT: property_value_identifier_string = "PIDDSI_LINECOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_PARAGRAPH_COUNT: property_value_identifier_string = "PIDDSI_PARCOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_SLIDE_COUNT: property_value_identifier_string = "PIDDSI_SLIDECOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_NOTE_COUNT: property_value_identifier_string = "PIDDSI_NOTECOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_HIDDEN_SLIDE_COUNT: property_value_identifier_string = "PIDDSI_HIDDENCOUNT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_MMCLIP_COUNT: property_value_identifier_string = "PIDDSI_MMCLIPCOUNT"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_BOOLEAN: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_SCALE: property_value_identifier_string = "PIDDSI_SCALE"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_LINKS_DIRTY: property_value_identifier_string = "PIDDSI_LINKSDIRTY"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_STRING_ASCII: case LIBOLECF_VALUE_TYPE_STRING_UNICODE: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_CATEGORY : property_value_identifier_string = "PIDDSI_CATEGORY"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_PRESENTATION_TARGET: property_value_identifier_string = "PIDDSI_PRESFORMAT"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_MANAGER: property_value_identifier_string = "PIDDSI_MANAGER"; break; case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_COMPANY: property_value_identifier_string = "PIDDSI_COMPANY"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_MULTI_VALUE_VARIANT: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_HEADING_PAIRS: property_value_identifier_string = "PIDDSI_HEADINGPAIR"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_MULTI_VALUE_STRING_ASCII: case LIBOLECF_VALUE_TYPE_MULTI_VALUE_STRING_UNICODE: switch( property_value_identifier ) { case LIBOLECF_DOCUMENT_SUMMARY_INFORMATION_PID_DOCUMENT_PARTS: property_value_identifier_string = "PIDDSI_DOCPARTS"; break; default: break; } break; default: break; } } fprintf( info_handle->notify_stream, "\tValue identifier\t: " ); if( property_value_identifier_string != NULL ) { fprintf( info_handle->notify_stream, "%s (", property_value_identifier_string ); } fprintf( info_handle->notify_stream, "0x%08" PRIx32 "", property_value_identifier ); if( property_value_identifier_string != NULL ) { fprintf( info_handle->notify_stream, ")" ); } fprintf( info_handle->notify_stream, "\n" ); fprintf( info_handle->notify_stream, "\tValue type\t\t: %s (0x%08" PRIx32 ")\n", libfole_value_type_get_identifier( property_value_type ), property_value_type ); /* TODO print the properties */ if( libolecf_property_value_free( &property_value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property value.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\n" ); } if( libolecf_property_section_free( &property_section, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property section.", function ); goto on_error; } } if( libfguid_identifier_free( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free GUID.", function ); goto on_error; } if( libolecf_property_set_free( &property_set, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property set.", function ); goto on_error; } if( libolecf_item_free( &property_set_stream, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property set stream.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\n" ); } return( 1 ); on_error: if( property_value != NULL ) { libolecf_property_value_free( &property_value, NULL ); } if( property_section != NULL ) { libolecf_property_section_free( &property_section, NULL ); } if( guid != NULL ) { libfguid_identifier_free( &guid, NULL ); } if( property_set != NULL ) { libolecf_property_set_free( &property_set, NULL ); } if( property_set_stream != NULL ) { libolecf_item_free( &property_set_stream, NULL ); } return( -1 ); }
/* Prints the summary information to a stream * Returns 1 if successful or -1 on error */ int info_handle_summary_information_fprint( info_handle_t *info_handle, libcerror_error_t **error ) { uint8_t guid_data[ 16 ]; libcstring_system_character_t guid_string[ 48 ]; libfguid_identifier_t *guid = NULL; libolecf_item_t *property_set_stream = NULL; libolecf_property_set_t *property_set = NULL; libolecf_property_section_t *property_section = NULL; libolecf_property_value_t *property_value = NULL; const char *property_value_identifier_string = NULL; static char *function = "info_handle_summary_information_fprint"; uint32_t property_value_identifier = 0; uint32_t property_value_type = 0; int number_of_properties = 0; int number_of_sections = 0; int property_index = 0; int result = 0; int section_index = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( info_handle->root_item == NULL ) { if( libolecf_file_get_root_item( info_handle->input_file, &( info_handle->root_item ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve root item.", function ); return( -1 ); } } result = libolecf_item_get_sub_item_by_utf8_name( info_handle->root_item, (uint8_t *) "\005SummaryInformation", 19, &property_set_stream, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub item.", function ); goto on_error; } else if( result != 0 ) { fprintf( info_handle->notify_stream, "Summary information:\n" ); if( libolecf_property_set_stream_get_set( property_set_stream, &property_set, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set stream.", function ); goto on_error; } if( libfguid_identifier_initialize( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create GUID.", function ); goto on_error; } if( libolecf_property_set_get_class_identifier( property_set, guid_data, 16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set class identifier.", function ); goto on_error; } if( libfguid_identifier_copy_from_byte_stream( guid, guid_data, 16, LIBFGUID_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to GUID.", function ); goto on_error; } #if defined( LIBCSTRING_HAVE_WIDE_SYSTEM_CHARACTER ) result = libfguid_identifier_copy_to_utf16_string( guid, (uint16_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #else result = libfguid_identifier_copy_to_utf8_string( guid, (uint8_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy GUID to string.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tClass identifier\t: %" PRIs_LIBCSTRING_SYSTEM "\n", guid_string ); if( libolecf_property_set_get_number_of_sections( property_set, &number_of_sections, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of sections.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tNumber of sections\t: %d\n", number_of_sections ); fprintf( info_handle->notify_stream, "\n" ); for( section_index = 0; section_index < number_of_sections; section_index++ ) { fprintf( info_handle->notify_stream, "\tSection: %d\n", section_index + 1 ); if( libolecf_property_set_get_section_by_index( property_set, section_index, &property_section, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property set section: %d.", function, section_index ); goto on_error; } if( libolecf_property_section_get_class_identifier( property_section, guid_data, 16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property section class identifier.", function ); goto on_error; } if( libfguid_identifier_copy_from_byte_stream( guid, guid_data, 16, LIBFGUID_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to GUID.", function ); goto on_error; } #if defined( LIBCSTRING_HAVE_WIDE_SYSTEM_CHARACTER ) result = libfguid_identifier_copy_to_utf16_string( guid, (uint16_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #else result = libfguid_identifier_copy_to_utf8_string( guid, (uint8_t *) guid_string, 48, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy GUID to string.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tClass identifier\t: %" PRIs_LIBCSTRING_SYSTEM "\n", guid_string ); if( libolecf_property_section_get_number_of_properties( property_section, &number_of_properties, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of properties.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\tNumber of properties\t: %d\n", number_of_properties ); fprintf( info_handle->notify_stream, "\n" ); for( property_index = 0; property_index < number_of_properties; property_index++ ) { fprintf( info_handle->notify_stream, "\tProperty: %d\n", property_index + 1 ); if( libolecf_property_section_get_property_by_index( property_section, property_index, &property_value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value.", function, property_index ); goto on_error; } if( libolecf_property_value_get_identifier( property_value, &property_value_identifier, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value identifier.", function, property_index ); goto on_error; } if( libolecf_property_value_get_value_type( property_value, &property_value_type, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve property: %d value type.", function, property_index ); goto on_error; } property_value_identifier_string = NULL; if( memory_compare( guid_data, info_handle_class_identifier_summary_information, 16 ) == 0 ) { switch( property_value_type ) { case LIBOLECF_VALUE_TYPE_INTEGER_16BIT_SIGNED: switch( property_value_identifier ) { case LIBOLECF_SUMMARY_INFORMATION_PID_CODEPAGE: property_value_identifier_string = "PIDSI_CODEPAGE"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_INTEGER_32BIT_SIGNED: switch( property_value_identifier ) { case LIBOLECF_SUMMARY_INFORMATION_PID_NUMBER_OF_PAGES: property_value_identifier_string = "PIDSI_PAGECOUNT"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_NUMBER_OF_WORDS: property_value_identifier_string = "PIDSI_WORDCOUNT"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_NUMBER_OF_CHARACTERS: property_value_identifier_string = "PIDSI_CHARCOUNT"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_SECURITY: property_value_identifier_string = "PIDSI_SECURITY"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_STRING_ASCII: case LIBOLECF_VALUE_TYPE_STRING_UNICODE: switch( property_value_identifier ) { case LIBOLECF_SUMMARY_INFORMATION_PID_TITLE: property_value_identifier_string = "PIDSI_TITLE"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_SUBJECT: property_value_identifier_string = "PIDSI_SUBJECT"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_AUTHOR: property_value_identifier_string = "PIDSI_AUTHOR"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_KEYWORDS: property_value_identifier_string = "PIDSI_KEYWORDS"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_COMMENTS: property_value_identifier_string = "PIDSI_COMMENTS"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_TEMPLATE: property_value_identifier_string = "PIDSI_TEMPLATE"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_LAST_SAVED_BY: property_value_identifier_string = "PIDSI_LASTAUTHOR"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_REVISION_NUMBER: property_value_identifier_string = "PIDSI_REVNUMBER"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_APPLICATION_NAME: property_value_identifier_string = "PIDSI_APPNAME"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_FILETIME: switch( property_value_identifier ) { case LIBOLECF_SUMMARY_INFORMATION_PID_EDITING_TIME: property_value_identifier_string = "PIDSI_EDITTIME"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_LAST_PRINTED_TIME: property_value_identifier_string = "PIDSI_LASTPRINTED"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_CREATION_TIME: property_value_identifier_string = "PIDSI_CREATE_DTM"; break; case LIBOLECF_SUMMARY_INFORMATION_PID_LAST_WRITTEN_TIME: property_value_identifier_string = "PIDSI_LASTSAVE_DTM"; break; default: break; } break; case LIBOLECF_VALUE_TYPE_CLIPBOARD_FORMAT: switch( property_value_identifier ) { case LIBOLECF_SUMMARY_INFORMATION_PID_THUMBNAIL: property_value_identifier_string = "PIDSI_THUMBNAIL"; break; default: break; } break; default: break; } } fprintf( info_handle->notify_stream, "\tValue identifier\t: " ); if( property_value_identifier_string != NULL ) { fprintf( info_handle->notify_stream, "%s (", property_value_identifier_string ); } fprintf( info_handle->notify_stream, "0x%08" PRIx32 "", property_value_identifier ); if( property_value_identifier_string != NULL ) { fprintf( info_handle->notify_stream, ")" ); } fprintf( info_handle->notify_stream, "\n" ); fprintf( info_handle->notify_stream, "\tValue type\t\t: %s (0x%08" PRIx32 ")\n", libfole_value_type_get_identifier( property_value_type ), property_value_type ); /* TODO print the properties */ if( libolecf_property_value_free( &property_value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property value.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\n" ); } if( libolecf_property_section_free( &property_section, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property section.", function ); goto on_error; } } if( libfguid_identifier_free( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free GUID.", function ); goto on_error; } if( libolecf_property_set_free( &property_set, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property set.", function ); goto on_error; } if( libolecf_item_free( &property_set_stream, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free property set stream.", function ); goto on_error; } fprintf( info_handle->notify_stream, "\n" ); } return( 1 ); on_error: if( property_value != NULL ) { libolecf_property_value_free( &property_value, NULL ); } if( property_section != NULL ) { libolecf_property_section_free( &property_section, NULL ); } if( guid != NULL ) { libfguid_identifier_free( &guid, NULL ); } if( property_set != NULL ) { libolecf_property_set_free( &property_set, NULL ); } if( property_set_stream != NULL ) { libolecf_item_free( &property_set_stream, NULL ); } return( -1 ); }