Beispiel #1
0
/* Retrieves a specific unallocated block
 * Returns 1 if successful or -1 on error
 */
int libmsiecf_file_get_unallocated_block(
    libmsiecf_file_t *file,
    int unallocated_block_index,
    off64_t *offset,
    size64_t *size,
    libcerror_error_t **error )
{
    libmsiecf_internal_file_t *internal_file = NULL;
    static char *function                    = "libmsiecf_file_get_unallocated_block";
    intptr_t *value                          = NULL;

    if( file == NULL )
    {
        libcerror_error_set(
            error,
            LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
            LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
            "%s: invalid file.",
            function );

        return( -1 );
    }
    internal_file = (libmsiecf_internal_file_t *) file;

    if( libcdata_range_list_get_range_by_index(
                internal_file->unallocated_block_list,
                unallocated_block_index,
                (uint64_t *) offset,
                (uint64_t *) size,
                &value,
                error ) != 1 )
    {
        libcerror_error_set(
            error,
            LIBCERROR_ERROR_DOMAIN_RUNTIME,
            LIBCERROR_RUNTIME_ERROR_GET_FAILED,
            "%s: unable to retrieve unallocated block range: %d.",
            function,
            unallocated_block_index );

        return( -1 );
    }
    return( 1 );
}
Beispiel #2
0
/* Retrieves a checksum error
 * Returns 1 if successful or -1 on error
 */
int libewf_chunk_table_get_checksum_error(
     libewf_chunk_table_t *chunk_table,
     uint32_t error_index,
     uint64_t *start_sector,
     uint64_t *number_of_sectors,
     libcerror_error_t **error )
{
	static char *function = "libewf_chunk_table_get_checksum_error";
	intptr_t *value       = NULL;

	if( chunk_table == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid chunk table.",
		 function );

		return( -1 );
	}
	if( libcdata_range_list_get_range_by_index(
	     chunk_table->checksum_errors,
	     (int) error_index,
	     start_sector,
	     number_of_sectors,
	     &value,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve checksum error: %" PRIu32 " from range list.",
		 function,
		 error_index );

		return( -1 );
	}
	return( 1 );
}