示例#1
0
void do_obj_info(void *data, unsigned len)
{
    uint16_t protection, obj_fmt, thumb_fmt, assoc_type;
    uint32_t stor_id, compressed_size;
    uint32_t thumb_compressed_size, thumb_pix_width, thumb_pix_height;
    uint32_t img_pix_width, img_pix_height, imx_pix_depth, parent;
    uint32_t assoc_desc, seq_nr;
    struct mtp_string_var filename, date_created, date_modified, keywords;

    start_unpack_data_block(data, len);
    bool ok = unpack_data_block_uint32_t(&stor_id) &&
        unpack_data_block_uint16_t(&obj_fmt) &&
        unpack_data_block_uint16_t(&protection) &&
        unpack_data_block_uint32_t(&compressed_size) &&
        unpack_data_block_uint16_t(&thumb_fmt) &&
        unpack_data_block_uint32_t(&thumb_compressed_size) &&
        unpack_data_block_uint32_t(&thumb_pix_width) &&
        unpack_data_block_uint32_t(&thumb_pix_height) &&
        unpack_data_block_uint32_t(&img_pix_width) &&
        unpack_data_block_uint32_t(&img_pix_height) &&
        unpack_data_block_uint32_t(&imx_pix_depth) &&
        unpack_data_block_uint32_t(&parent) &&
        unpack_data_block_uint16_t(&assoc_type) &&
        unpack_data_block_uint32_t(&assoc_desc) &&
        unpack_data_block_uint32_t(&seq_nr) &&
        unpack_data_block_string_var(&filename) &&
        unpack_data_block_string_var(&date_created) &&
        unpack_data_block_string_var(&date_modified) &&
        unpack_data_block_string_var(&keywords);
    if(ok)
    {
        const char *fmt_str = get_fmt_name(obj_fmt);
        if(fmt_str == NULL)
            fmt_str = "N/A";
        printf("Object Info(Handle=0x%x):\n", g_cur_cmd.param[0]);
        printf("  Storage ID: 0x%x\n", stor_id);
        printf("  Object Fmt: 0x%x (%s)\n", obj_fmt, fmt_str);
        printf("  Protection: 0x%x\n", protection);
        printf("  Compr Size: %d\n", compressed_size);
        printf("  Parent: 0x%x\n", parent);
        printf("  Assoc Type: 0x%x\n", assoc_type);
        printf("  Assoc Desc: 0x%x\n", assoc_desc);
        printf("  Filename: %S\n", str_var_to_wchar(&filename));
        printf("  Date Created: %S\n", str_var_to_wchar(&date_created));
        printf("  Date Mod: %S\n", str_var_to_wchar(&date_modified));
        printf("  Keywords: %S\n", str_var_to_wchar(&keywords));
    }
    else
        printf("failed to unpack ObjectInfo dataset\n");
}
示例#2
0
static int do_page(deark *c, lctx *d, int pagenum, de_int64 pos1)
{
	struct page_ctx *pg = NULL;
	int retval = 0;

	pg = de_malloc(c, sizeof(struct page_ctx));

	pg->fmt = identify_fmt(c, pos1);
	d->last_fmt = pg->fmt;
	pg->fmt_name = get_fmt_name(pg->fmt);
	if(pg->fmt==0) {
		de_err(c, "Not PNM/PAM format\n");
		goto done;
	}

	if(pagenum==0) {
		de_declare_fmt(c, pg->fmt_name);
	}

	if(pg->fmt==FMT_PAM) {
		if(!read_pam_header(c, d, pg, pos1)) goto done;
	}
	else {
		if(!read_pnm_header(c, d, pg, pos1)) goto done;
	}

	if(!do_image(c, d, pg, pg->hdr_parse_pos)) {
		goto done;
	}

	d->last_bytesused = (pg->hdr_parse_pos + pg->image_data_len) - pos1;

	retval = 1;
done:
	de_free(c, pg);
	return retval;
}