?? libewf_internal_handle.c
字號:
LIBEWF_WARNING_PRINT( "libewf_internal_handle_get_hash_value: invalid handle.\n" ); return( -1 ); } if( identifier == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_get_hash_value: invalid indentifier.\n" ); return( -1 ); } if( value == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_get_hash_value: invalid value.\n" ); return( -1 ); } if( internal_handle->hash_values == NULL ) { return( 0 ); } return( libewf_hash_values_get_value( internal_handle->hash_values, identifier, value, length ) );}/* Sets the header and its byte size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_header( LIBEWF_INTERNAL_HANDLE *internal_handle, EWF_HEADER *header, size_t size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_header: invalid handle.\n" ); return( -1 ); } internal_handle->header = header; internal_handle->header_size = size; return( 1 );}/* Sets the header2 and its byte size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_header2( LIBEWF_INTERNAL_HANDLE *internal_handle, EWF_HEADER2 *header2, size_t size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_header2: invalid handle.\n" ); return( -1 ); } internal_handle->header2 = header2; internal_handle->header2_size = size; return( 1 );}/* Sets the xheader and its byte size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_xheader( LIBEWF_INTERNAL_HANDLE *internal_handle, EWF_HEADER2 *xheader, size_t size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_xheader: invalid handle.\n" ); return( -1 ); } internal_handle->xheader = xheader; internal_handle->xheader_size = size; return( 1 );}/* Sets the xhash and its byte size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_xhash( LIBEWF_INTERNAL_HANDLE *internal_handle, EWF_HEADER2 *xhash, size_t size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_xhash: invalid handle.\n" ); return( -1 ); } internal_handle->xhash = xhash; internal_handle->xhash_size = size; return( 1 );}/* Sets the MD5 hash value * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_stored_md5_hash( LIBEWF_INTERNAL_HANDLE *internal_handle, EWF_DIGEST_HASH *md5_hash ){ size_t size = EWF_DIGEST_HASH_SIZE_MD5; if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_stored_md5_hash: invalid handle.\n" ); return( -1 ); } internal_handle->stored_md5_hash = (EWF_DIGEST_HASH *) libewf_common_alloc( size ); if( internal_handle->stored_md5_hash == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_stored_md5_hash: unable to create MD5 hash.\n" ); return( -1 ); } if( libewf_common_memcpy( internal_handle->stored_md5_hash, md5_hash, size ) == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_stored_md5_hash: unable to set MD5 hash.\n" ); libewf_common_free( internal_handle->stored_md5_hash ); internal_handle->stored_md5_hash = NULL; return( -1 ); } return( 1 );}/* Sets the media values * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_media_values( LIBEWF_INTERNAL_HANDLE *internal_handle, uint32_t sectors_per_chunk, uint32_t bytes_per_sector ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_media_values: invalid handle.\n" ); return( -1 ); } if( internal_handle->media == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_media_values: invalid handle - missing subhandle media.\n" ); return( -1 ); } if( ( internal_handle->write != NULL ) && ( internal_handle->write->values_initialized != 0 ) ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_media_values: write values were initialized, therefore media values cannot be changed anymore.\n" ); return( -1 ); } if( sectors_per_chunk == 0 ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_media_values: invalid sectors per chunk.\n" ); return( -1 ); } if( bytes_per_sector == 0 ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_media_values: invalid bytes per sectors.\n" ); return( -1 ); } internal_handle->media->sectors_per_chunk = sectors_per_chunk; internal_handle->media->bytes_per_sector = bytes_per_sector; internal_handle->media->chunk_size = sectors_per_chunk * bytes_per_sector; return( 1 );}/* Returns 1 if the GUID is set, or -1 on error */int8_t libewf_internal_handle_set_guid( LIBEWF_INTERNAL_HANDLE *internal_handle, uint8_t *guid, size_t size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_guid: invalid handle.\n" ); return( -1 ); } if( guid == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_guid: invalid guid.\n" ); return( -1 ); } if( size < 16 ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_guid: guid too small.\n" ); return( -1 ); } if( ( internal_handle->write != NULL ) && ( internal_handle->write->values_initialized != 0 ) ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_guid: write values were initialized, therefore media values cannot be changed anymore.\n" ); return( -1 ); } if( libewf_common_memcpy( internal_handle->guid, guid, 16 ) == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_guid: unable to set guid.\n" ); return( -1 ); } return( 1 );}/* Sets the write segment file size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_segment_file_size( LIBEWF_INTERNAL_HANDLE *internal_handle, uint32_t segment_file_size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_segment_file_size: invalid handle.\n" ); return( -1 ); } if( internal_handle->write == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_segment_file_size: invalid handle - missing subhandle write.\n" ); return( -1 ); } if( internal_handle->write->values_initialized != 0 ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_segment_file_size: write values were initialized and cannot be changed anymore.\n" ); return( -1 ); } if( ( segment_file_size == 0 ) || ( segment_file_size > (uint32_t) INT32_MAX ) ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_segment_file_size: invalid value segment file size only values below 2^32 are supported.\n" ); return( -1 ); } internal_handle->write->segment_file_size = segment_file_size; return( 1 );}/* Sets the write error granularity * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_error_granularity( LIBEWF_INTERNAL_HANDLE *internal_handle, uint32_t error_granularity ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_error_granularity: invalid handle.\n" ); return( -1 ); } if( internal_handle->media == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_error_granularity: invalid handle - missing subhandle media.\n" ); return( -1 ); } if( ( internal_handle->write != NULL ) && ( internal_handle->write->values_initialized != 0 ) ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_error_granularity: write values were initialized, therefore media values cannot be changed anymore.\n" ); return( -1 ); } internal_handle->media->error_granularity = error_granularity; return( 1 );}/* Sets the write compression values * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_compression_values( LIBEWF_INTERNAL_HANDLE *internal_handle, int8_t compression_level, uint8_t compress_empty_block ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_compression_values: invalid handle.\n" ); return( -1 ); } if( internal_handle->write == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_compression_values: invalid handle - missing subhandle write.\n" ); return( -1 ); } internal_handle->compression_level = compression_level; /* Compress empty block is only useful when no compression is used */ if( compression_level == EWF_COMPRESSION_NONE ) { internal_handle->write->compress_empty_block = compress_empty_block; } return( 1 );}/* Sets the write output media type * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_media_type( LIBEWF_INTERNAL_HANDLE *internal_handle, uint8_t media_type, uint8_t volume_type ){ uint8_t media_flags = 0; if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_media_type: invalid handle.\n" ); return( -1 ); } if( internal_handle->media == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_media_type: invalid handle - missing subhandle media.\n" ); return( -1 ); } internal_handle->media->media_type = media_type; media_flags = internal_handle->media->media_flags; if( volume_type == LIBEWF_VOLUME_TYPE_LOGICAL ) { /* Uses 1-complement of EWF_MEDIA_FLAGS_IS_PHYSICAL */ media_flags &= ~EWF_MEDIA_FLAGS_IS_PHYSICAL; } else if( volume_type == LIBEWF_VOLUME_TYPE_PHYSICAL ) { media_flags |= EWF_MEDIA_FLAGS_IS_PHYSICAL; } else { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_media_type: unsupported volume type.\n" ); return( -1 ); } return( libewf_internal_handle_set_write_media_flags( internal_handle, media_flags ) );}/* Sets the write output media flags * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_media_flags( LIBEWF_INTERNAL_HANDLE *internal_handle, uint8_t media_flags ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_media_flags: invalid handle.\n" ); return( -1 ); } if( internal_handle->media == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_media_flags: invalid handle - missing subhandle media.\n" ); return( -1 ); } internal_handle->media->media_flags = media_flags; return( 1 );}/* Sets the write output format * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_format( LIBEWF_INTERNAL_HANDLE *internal_handle, uint8_t format ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_format: invalid handle.\n" ); return( -1 ); } internal_handle->format = format; return( 1 );}/* Sets the write input write size * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_write_input_write_size( LIBEWF_INTERNAL_HANDLE *internal_handle, uint64_t input_write_size ){ if( internal_handle == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_input_write_size: invalid handle.\n" ); return( -1 ); } if( internal_handle->write == NULL ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_input_write_size: invalid handle - missing subhandle write.\n" ); return( -1 ); } if( internal_handle->write->values_initialized != 0 ) { LIBEWF_WARNING_PRINT( "libewf_internal_handle_set_write_input_write_size: write values were initialized and cannot be changed anymore.\n" ); return( -1 ); } internal_handle->write->input_write_size = input_write_size; return( 1 );}/* Sets the header value specified by the identifier * Returns 1 if successful, -1 on error */int8_t libewf_internal_handle_set_header_value( LIBEWF_INTERNAL_HANDLE *internal_handle, LIBEWF_CHAR *identifier, LIBEWF_CHAR *value, size_t length ){ if( internal_handle == NULL ) {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -