/* Retrieves the data * Returns 1 if successful, 0 if not available or -1 on error */ int libevt_record_get_data( libevt_record_t *record, uint8_t *data, size_t data_size, libcerror_error_t **error ) { libevt_internal_record_t *internal_record = NULL; static char *function = "libevt_record_get_data"; if( record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid record.", function ); return( -1 ); } internal_record = (libevt_internal_record_t *) record; if( internal_record->record_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid internal record - missing record values.", function ); return( -1 ); } if( internal_record->record_values->data == NULL ) { return( 0 ); } if( libfvalue_value_copy_data( internal_record->record_values->data, data, data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy data.", function ); return( -1 ); } return( 1 ); }
/* Retrieves the location * The size should include the end of string character * Returns 1 if successful, 0 if no location or -1 on error */ int libmsiecf_redirected_get_location( libmsiecf_item_t *redirected, char *string, size_t string_size, libcerror_error_t **error ) { libmsiecf_internal_item_t *internal_item = NULL; static char *function = "libmsiecf_redirected_get_location"; if( redirected == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid redirected.", function ); return( -1 ); } internal_item = (libmsiecf_internal_item_t *) redirected; if( internal_item->item_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid item - missing item descriptor.", function ); return( -1 ); } if( internal_item->item_descriptor->type != LIBMSIECF_ITEM_TYPE_REDIRECTED ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: unsupported item type: %" PRIu8 ".", function, internal_item->item_descriptor->type ); return( -1 ); } if( internal_item->value == NULL ) { if( libmsiecf_item_read_values( internal_item, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read item values.", function ); return( -1 ); } if( internal_item->value == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid item values.", function ); return( -1 ); } } if( ( (libmsiecf_redirected_values_t *) internal_item->value )->location == NULL ) { return( 0 ); } if( libfvalue_value_copy_data( ( (libmsiecf_redirected_values_t *) internal_item->value )->location, (uint8_t *) string, string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy location data to string.", function ); return( -1 ); } return( 1 ); }