ewfinfo.c:		if( handle->header2 != NULL )
ewfinfo.c:			header_values = libewf_header_values_parse_header( handle->header2, date_format );
ewfinfo.c:		else if( handle->header != NULL )
ewfinfo.c:			header_values = libewf_header_values_parse_header( handle->header, date_format );
ewfinfo.c:		fprintf( stdout, "\tAmount of sectors:\t%" PRIu32 "\n", handle->sector_count );
ewfinfo.c:			handle->guid[ 0 ], handle->guid[ 1 ], handle->guid[ 2 ], handle->guid[ 3 ],
ewfinfo.c:			handle->guid[ 4 ], handle->guid[ 5 ], handle->guid[ 6 ], handle->guid[ 7 ],
ewfinfo.c:			handle->guid[ 8 ], handle->guid[ 9 ], handle->guid[ 10 ], handle->guid[ 11 ],
ewfinfo.c:			handle->guid[ 12 ], handle->guid[ 13 ], handle->guid[ 14 ], handle->guid[ 15 ]
ewfinfo.c:		if( handle->error2_error_count > 0 )
ewfinfo.c:			fprintf( stdout, "\ttotal amount: %" PRIu64 "\n", handle->error2_error_count );
ewfinfo.c:			while( iterator < handle->error2_error_count )
ewfinfo.c:				uint32_t sector       = convert_32bit( handle->error2_sectors[ iterator ].sector );
ewfinfo.c:				uint32_t sector_count = convert_32bit( handle->error2_sectors[ iterator ].sector_count );
file.c:	handle->segment_table = libewf_segment_table_set_values( handle->segment_table, fields_segment, filename, file_descriptor );
file.c:	handle->segment_table = libewf_segment_table_set_values( handle->segment_table, 0, filename, -1 );
file.c:	if( handle->index_build != 0 )
file.c:	for( segment = 1; segment < handle->segment_table->amount; segment++ )
file.c:	handle->index_build = 1;
file.c:	for( iterator = 0; iterator < handle->segment_table->amount; iterator++ )
file.c:		if( handle->segment_table->file_descriptor[ iterator ] > 0 )
file.c:			close( handle->segment_table->file_descriptor[ iterator ] );
file.c:	if( handle->index_build == 0 )
file.c:	return( handle->offset_table->amount * handle->chunk_size );
file.c:	if( handle->index_build == 0 )
file.c:	if( handle->md5hash == NULL )
file.c:	return( ewf_md5hash_to_string( handle->md5hash ) );
file.c:	if( handle->index_build == 0 )
file.c:	char *data = (char *) malloc( handle->chunk_size );
file.c:	for( iterator = 0; iterator <= handle->offset_table->last; iterator++ )
file.c:		uint64_t offset = iterator * handle->chunk_size;
file.c:		int64_t count   = libewf_read_random( handle, data, handle->chunk_size, offset );
file_read.c:	if( handle->chunk_size != bytes_per_chunk )
file_read.c:		handle->chunk_size = bytes_per_chunk;
file_read.c:	handle->offset_table           = libewf_offset_table_values_alloc( handle->offset_table, volume_chunk_count );
file_read.c:	handle->secondary_offset_table = libewf_offset_table_values_alloc( handle->secondary_offset_table, volume_chunk_count );
file_read.c:	handle->chunk_count       = convert_32bit( volume->chunk_count );
file_read.c:        handle->sectors_per_chunk = convert_32bit( volume->sectors_per_chunk );
file_read.c:        handle->bytes_per_sector  = convert_32bit( volume->bytes_per_sector );
file_read.c:        handle->sector_count      = convert_32bit( volume->sector_count );
file_read.c:	memcpy( (uint8_t *) handle->guid, (uint8_t *) volume->guid, 16 );
file_read.c:	handle->offset_table = libewf_offset_table_read( handle->offset_table, section_list, file_descriptor, size );
file_read.c:	if( handle->offset_table->size[ 0 ] - handle->chunk_size == EWF_CRC_SIZE )
file_read.c:		handle->chunk_crc = 1;
file_read.c:	handle->secondary_offset_table = libewf_offset_table_read( handle->secondary_offset_table, section_list, file_descriptor, size );
file_read.c:	libewf_compare_offset_tables( handle->offset_table, handle->secondary_offset_table );
file_read.c:	handle->error2_error_count = error_count;
file_read.c:	handle->error2_sectors     = sectors;
file_read.c:	if( libewf_segment_table_values_is_set( handle->segment_table, segment ) == 0 )
file_read.c:	int file_descriptor  = libewf_segment_table_get_file_descriptor( handle->segment_table, segment );
file_read.c:		libewf_section_list_append( handle->segment_table->section_list[ segment ], file_descriptor, previous_offset, offset_end );
file_read.c:		libewf_section_data_read_segment( handle, segment, section, file_descriptor, handle->segment_table->section_list[ segment ] );
file_read.c:				char *filename = libewf_segment_table_get_filename( handle->segment_table, segment );
file_read.c:	if( handle->index_build == 0 )
file_read.c:	if( chunk >= handle->offset_table->amount )
file_read.c:	int file_descriptor = handle->offset_table->file_descriptor[ chunk ];
file_read.c:	uint64_t size       = handle->offset_table->size[ chunk ];
file_read.c:	uint64_t offset     = handle->offset_table->offset[ chunk ];
file_read.c:	if( size > ( handle->chunk_size + EWF_CRC_SIZE ) )
file_read.c:	if( handle->chunk_crc != 0 )
file_read.c:	if( handle->index_build == 0 )
file_read.c:	uint32_t chunk = (uint32_t) ( offset / handle->chunk_size );
file_read.c:	if( chunk >= handle->offset_table->amount )
file_read.c:	uint64_t buffer_offset = offset % handle->chunk_size;
file_read.c:		if( chunk >= handle->offset_table->amount )
file_read.c:		if( handle->cached_chunk != chunk )
file_read.c:			handle = libewf_handle_cache_wipe( handle, handle->chunk_size );
file_read.c:			int64_t chunk_read_count = libewf_read_chunk( handle, chunk, handle->chunk_data );
file_read.c:			if( chunk_data_size > handle->chunk_size )
file_read.c:			if( handle->alternative_read_method == 1 )
file_read.c:				if( chunk_data_size < handle->chunk_size )
file_read.c:					if( handle->offset_table->compressed[ chunk ] == 0 )
file_read.c:				if( handle->offset_table->compressed[ chunk ] != 0 )
file_read.c:				uint32_t raw_data_size = handle->chunk_size;
file_read.c:				int result = ewf_sectors_chunk_uncompress( handle->raw_data, &raw_data_size, handle->chunk_data, chunk_read_count );
file_read.c:					if( ( handle->alternative_read_method == 1 ) && ( chunk == handle->offset_table->last ) )
file_read.c:						( chunk + 1 ), handle->offset_table->amount,
file_read.c:						(int) ( ( handle->offset_table->last > 0 ) ? ( ( chunk * 100 ) / handle->offset_table->last ) : 1 ) ) ;
file_read.c:						memcpy( (uint8_t *) handle->raw_data, (uint8_t *) handle->chunk_data, chunk_data_size );
file_read.c:						handle->cached_data_size = chunk_data_size;
file_read.c:						( chunk + 1 ), handle->offset_table->amount,
file_read.c:						(int) ( ( handle->offset_table->last > 0 ) ? ( ( chunk * 100 ) / handle->offset_table->last ) : 1 ) ) ;
file_read.c:					( chunk + 1 ), handle->offset_table->amount,
file_read.c:					(int) ( ( handle->offset_table->last > 0 ) ? ( ( chunk * 100 ) / handle->offset_table->last ) : 1 ) ) ;
file_read.c:					handle->compression_used = 1;
file_read.c:					handle->cached_data_size = raw_data_size;
file_read.c:				( chunk + 1 ), handle->offset_table->amount,
file_read.c:				(int) ( ( handle->offset_table->last > 0 ) ? ( ( chunk * 100 ) / handle->offset_table->last ) : 1 ) ) ;
file_read.c:				memcpy( (uint8_t *) handle->raw_data, (uint8_t *) handle->chunk_data, chunk_data_size );
file_read.c:				handle->cached_data_size = chunk_data_size;
file_read.c:			handle->cached_chunk = chunk;
file_read.c:		uint64_t available = handle->cached_data_size - buffer_offset;
file_read.c:		memcpy( (uint8_t *) ( buffer + count_read ), (uint8_t *) ( handle->raw_data + buffer_offset ), available );
file_read.c:	uint64_t total_size = ( handle->offset_table->amount * handle->chunk_size );
file_read.c:	if( handle->index_build == 0 )
file_read.c:	char *data = (char *) malloc( handle->chunk_size );
file_read.c:	for( iterator = 0; iterator < handle->offset_table->amount; iterator++ )
file_read.c:		uint64_t offset = iterator * handle->chunk_size;
file_read.c:		int64_t count   = libewf_read_random( handle, data, handle->chunk_size, offset );
file_read.c:	if( handle->md5hash != NULL )
file_read.c:		char *stored_md5hash_string = ewf_md5hash_to_string( handle->md5hash );
file_read.c:		if( memcmp( calculated_md5hash, handle->md5hash, 16 ) != 0 )
file_write.c:	revert_32bit( handle->chunk_count, volume->chunk_count );
file_write.c:	revert_32bit( handle->sectors_per_chunk, volume->sectors_per_chunk );
file_write.c:	revert_32bit( handle->bytes_per_sector, volume->bytes_per_sector );
file_write.c:	revert_32bit( handle->sector_count, volume->sector_count );
file_write.c:	revert_32bit( handle->chunk_count, data->chunk_count );
file_write.c:	revert_32bit( handle->sectors_per_chunk, data->sectors_per_chunk );
file_write.c:	revert_32bit( handle->bytes_per_sector, data->bytes_per_sector );
file_write.c:	revert_32bit( handle->sector_count, data->sector_count );
file_write.c:	if( ( handle->format == LIBEWF_FORMAT_ENCASE1 ) || ( handle->format == LIBEWF_FORMAT_ENCASE2 ) || ( handle->format == LIBEWF_FORMAT_ENCASE3 ) )
file_write.c:		handle->header = libewf_header_values_generate_header_string_encase3( header_values );
file_write.c:	else if( handle->format == LIBEWF_FORMAT_FTK )
file_write.c:		handle->header = libewf_header_values_generate_header_string_ftk( header_values );
file_write.c:	else if( handle->format == LIBEWF_FORMAT_ENCASE4 )
file_write.c:		handle->header  = libewf_header_values_generate_header_string_encase4( header_values );
file_write.c:		handle->header2 = libewf_header_values_generate_header_string_encase4( header_values );
file_write.c:	else if( handle->format == LIBEWF_FORMAT_ENCASE5 )
file_write.c:		handle->header  = libewf_header_values_generate_header_string_encase4( header_values );
file_write.c:		handle->header2 = libewf_header_values_generate_header2_string_encase5( header_values );
file_write.c:	if( handle->header == NULL )
file_write.c:	uint32_t header_size         = strlen( (char *) handle->header );
file_write.c:	if( ( handle->format == LIBEWF_FORMAT_ENCASE2 ) || ( handle->format == LIBEWF_FORMAT_ENCASE3 ) || ( handle->format == LIBEWF_FORMAT_FTK ) )
file_write.c:		write_count          = libewf_section_header_write( handle, file_descriptor, segment_file_offset, handle->header, header_size );
file_write.c:		write_count          = libewf_section_header_write( handle, file_descriptor, segment_file_offset, handle->header, header_size );
file_write.c:	else if( ( handle->format == LIBEWF_FORMAT_ENCASE4 ) || ( handle->format == LIBEWF_FORMAT_ENCASE5 ) )
file_write.c:		if( handle->header2 == NULL )
file_write.c:		uint32_t header2_size = strlen( (char *) handle->header2 );
file_write.c:		write_count          = libewf_section_header2_write( handle, file_descriptor, segment_file_offset, handle->header2, header2_size );
file_write.c:		write_count          = libewf_section_header2_write( handle, file_descriptor, segment_file_offset, handle->header2, header2_size );
file_write.c:		write_count          = libewf_section_header_write( handle, file_descriptor, segment_file_offset, handle->header, header_size );
file_write.c:	handle->input_file_size   = input_file_size;
file_write.c:	handle->sectors_per_chunk = sectors_per_chunk;
file_write.c:	handle->bytes_per_sector  = bytes_per_sector;
file_write.c:	handle->ewf_file_size     = ewf_file_size;
file_write.c:	handle->compression_level = compression_level;
file_write.c:	handle->format            = format;
file_write.c:	handle->chunk_size        = sectors_per_chunk * bytes_per_sector;
file_write.c:	handle->chunks_per_file   = ( ewf_file_size - EWF_FILE_HEADER_SIZE - EWF_DATA_SIZE ) / handle->chunk_size;
file_write.c:	handle->chunk_count = handle->input_file_size / handle->chunk_size;
file_write.c:	if ( handle->input_file_size % handle->chunk_size != 0 )
file_write.c:		handle->chunk_count += 1;
file_write.c:	handle->sector_count = handle->input_file_size / handle->bytes_per_sector;
file_write.c:	LIBEWF_VERBOSE_PRINT( "libewf_set_write_parameters: input file size: %" PRIu32 ".\n", handle->input_file_size );
file_write.c:	LIBEWF_VERBOSE_PRINT( "libewf_set_write_parameters: requested ewf segment file size: %" PRIu64 ".\n", handle->ewf_file_size );
file_write.c:	if( handle->chunk_size <= 0 )
file_write.c:	uint16_t filename_size = strlen( handle->segment_table->filename[ 0 ] );
file_write.c:	if( read_cache_size > handle->input_file_size )
file_write.c:		read_cache_size = handle->input_file_size;
file_write.c:	maximum_compressed_data_size = handle->chunk_size + 1024;
file_write.c:	while( total_read_count < handle->input_file_size )
file_write.c:		snprintf( filename, ( filename_size + 5 ), "%s.e%.2" PRIx32, handle->segment_table->filename[ 0 ], segment );
file_write.c:		if( handle->segment_table->amount <= segment )
file_write.c:			handle->segment_table = libewf_segment_table_values_realloc( handle->segment_table, ( segment + 1 ) );
file_write.c:		handle->segment_table = libewf_segment_table_set_values( handle->segment_table, segment, filename, -1 );
file_write.c:			write_count        = libewf_last_section_write( handle, handle->segment_table->file_descriptor[ segment - 1 ], "next", segment_file_offset );
file_write.c:			close( handle->segment_table->file_descriptor[ segment - 1 ] );
file_write.c:		handle->segment_table->file_descriptor[ segment ] = open( handle->segment_table->filename[ segment ], O_WRONLY | O_CREAT | O_TRUNC, 0644 );
file_write.c:		write_count = ewf_file_header_write( file_header, handle->segment_table->file_descriptor[ segment ] );
file_write.c:			write_count          = libewf_headers_write( handle, handle->segment_table->file_descriptor[ segment ], segment_file_offset );
file_write.c:			write_count          = libewf_section_volume_write( handle, handle->segment_table->file_descriptor[ segment ], segment_file_offset );
file_write.c:			write_count          = libewf_section_data_write( handle, handle->segment_table->file_descriptor[ segment ], segment_file_offset );
file_write.c:		uint64_t sectors_size = handle->ewf_file_size;
file_write.c:		sectors_size -= ( 4 * EWF_SECTION_SIZE ) + ( 2 * handle->chunks_per_file * sizeof( EWF_TABLE_OFFSET ) );
file_write.c:		uint32_t sectors_chunk_amount   = sectors_size / ( handle->chunk_size + EWF_CRC_SIZE );
file_write.c:		uint32_t remaining_chunk_amount = handle->chunk_count - chunk_write_count;
file_write.c:		if( remaining_chunk_amount < handle->chunks_per_file )
file_write.c:		sectors_size = sectors_chunk_amount * ( handle->chunk_size + EWF_CRC_SIZE );
file_write.c:		write_count          = libewf_section_write( handle, handle->segment_table->file_descriptor[ segment ], "sectors", sectors_size, segment_file_offset );
file_write.c:			handle = libewf_handle_cache_wipe( handle, handle->chunk_size );
file_write.c:			LIBEWF_VERBOSE_PRINT( "libewf_write_from_file_descriptor: reading chunk: %d with size: %" PRIu64 "\n", chunk, handle->chunk_size );
file_write.c:			read_count        = libewf_file_cache_read( file_read_cache, input_file_descriptor, handle->raw_data, handle->chunk_size );
file_write.c:			read_count        = read( input_file_descriptor, handle->raw_data, handle->chunk_size );
file_write.c:			else if( read_count < handle->chunk_size )
file_write.c:				if( total_read_count != handle->input_file_size )
file_write.c:				callback( total_read_count, handle->input_file_size );
file_write.c:			LIBEWF_MD5_UPDATE( &md5, handle->raw_data, read_count );
file_write.c:			if( handle->compression_level != Z_NO_COMPRESSION )
file_write.c:				int result = ewf_sectors_chunk_compress( handle->chunk_data, &compressed_data_size, handle->raw_data, read_count, handle->compression_level );
file_write.c:			if( compressed_data_size < handle->chunk_size )
file_write.c:				write_count = ewf_sectors_chunk_write( handle->chunk_data, handle->segment_table->file_descriptor[ segment ], write_size );
file_write.c:				memcpy( (uint8_t *) &crc, (uint8_t *) &handle->chunk_data[ compressed_data_size - EWF_CRC_SIZE ], EWF_CRC_SIZE );
file_write.c:				crc = ewf_crc( (void *) handle->raw_data, read_count, 1 );
file_write.c:				revert_32bit( crc, &handle->raw_data[ read_count ] );
file_write.c:				write_count = ewf_sectors_chunk_write( handle->raw_data, handle->segment_table->file_descriptor[ segment ], write_size );
file_write.c:		if( lseek( handle->segment_table->file_descriptor[ segment ], (off_t) sectors_section_offset, SEEK_SET ) == -1 )
file_write.c:		libewf_section_write( handle, handle->segment_table->file_descriptor[ segment ], "sectors", sectors_write_count, sectors_section_offset );
file_write.c:		if( lseek( handle->segment_table->file_descriptor[ segment ], (off_t) segment_file_offset, SEEK_SET ) == -1 )
file_write.c:		write_count          = libewf_section_table_write( handle, handle->segment_table->file_descriptor[ segment ], segment_file_offset, offsets, sectors_chunk_amount, "table" );
file_write.c:		write_count          = libewf_section_table_write( handle, handle->segment_table->file_descriptor[ segment ], segment_file_offset, offsets, sectors_chunk_amount, "table2" );
file_write.c:		write_count          = libewf_section_data_write( handle, handle->segment_table->file_descriptor[ segment - 1 ], segment_file_offset );
file_write.c:	if( ( handle->format == LIBEWF_FORMAT_ENCASE5 ) && ( read_error_count > 0 ) )
file_write.c:		write_count          = libewf_section_error2_write( handle, handle->segment_table->file_descriptor[ segment - 1 ], segment_file_offset, handle->error2_sectors, read_error_count );
file_write.c:	write_count          = libewf_section_hash_write( handle, handle->segment_table->file_descriptor[ segment - 1 ], segment_file_offset, calculated_md5hash );
file_write.c:	write_count          = libewf_last_section_write( handle, handle->segment_table->file_descriptor[ segment - 1 ], "done", segment_file_offset );
file_write.c:	close( handle->segment_table->file_descriptor[ segment - 1 ] );
handle.c:	handle->chunk_size              = EWF_MINIMUM_CHUNK_SIZE;
handle.c:	handle->sectors_per_chunk       = 64;
handle.c:	handle->bytes_per_sector        = 512;
handle.c:	handle->chunk_count             = 0;
handle.c:	handle->sector_count            = 0;
handle.c:	handle->input_file_size         = 0;
handle.c:	handle->ewf_file_size           = 650000000;
handle.c:	handle->chunks_per_file         = ( 650000000 - EWF_FILE_HEADER_SIZE - EWF_DATA_SIZE ) / EWF_MINIMUM_CHUNK_SIZE;
handle.c:	handle->segment_table           = libewf_segment_table_alloc( segment_amount );
handle.c:	handle->offset_table            = libewf_offset_table_alloc();
handle.c:	handle->secondary_offset_table  = libewf_offset_table_alloc();
handle.c:	handle->error2_error_count      = 0;
handle.c:	handle->error2_sectors          = NULL;
handle.c:	handle->header                  = NULL;
handle.c:	handle->header2                 = NULL;
handle.c:	handle->md5hash                 = NULL;
handle.c:	handle->chunk_crc               = 0;
handle.c:	handle->compression_used        = 0;
handle.c:	handle->alternative_read_method = 0;
handle.c:	handle->compression_level       = Z_NO_COMPRESSION;
handle.c:	handle->format                  = LIBEWF_FORMAT_UNKNOWN;
handle.c:	handle->index_build             = 0;
handle.c:	handle->cached_chunk            = 0;
handle.c:	handle->cached_data_size        = 0;
handle.c:	handle = libewf_handle_cache_alloc( handle, handle->chunk_size );
handle.c:	handle->raw_data     = ewf_sectors_chunk_alloc( size );
handle.c:	handle->chunk_data   = ewf_sectors_chunk_alloc( size + EWF_CRC_SIZE );
handle.c:	handle->cached_chunk = -1;
handle.c:	handle->raw_data     = ewf_sectors_chunk_realloc( handle->raw_data, size );
handle.c:	handle->chunk_data   = ewf_sectors_chunk_realloc( handle->chunk_data, ( size + EWF_CRC_SIZE ) );
handle.c:	handle->cached_chunk = -1;
handle.c:	handle->raw_data     = ewf_sectors_chunk_wipe( handle->raw_data, size );
handle.c:	handle->chunk_data   = ewf_sectors_chunk_wipe( handle->chunk_data, ( size + EWF_CRC_SIZE ) );
handle.c:	handle->cached_chunk = -1;
handle.c:	libewf_segment_table_free( handle->segment_table );
handle.c:	libewf_offset_table_free( handle->offset_table );
handle.c:	libewf_offset_table_free( handle->secondary_offset_table );
handle.c:	if( handle->error2_sectors != NULL )
handle.c:		ewf_error2_sectors_free( handle->error2_sectors );
handle.c:	if( handle->header != NULL )
handle.c:		ewf_header_free( handle->header );
handle.c:	if( handle->header2 != NULL )
handle.c:		ewf_header_free( handle->header2 );
handle.c:	if( handle->md5hash != NULL )
handle.c:		ewf_md5hash_free( handle->md5hash );
handle.c:	free( handle->raw_data );
handle.c:	free( handle->chunk_data );
handle.c:	return( handle->header != NULL );
handle.c:	return( handle->header2 != NULL );
handle.c:	handle->header = header;
handle.c:	handle->header2 = header2;
handle.c:	handle->md5hash = ewf_md5hash_alloc();
handle.c:	memcpy( (uint8_t *) handle->md5hash, (uint8_t *) md5hash, EWF_MD5HASH_SIZE );
