From c30c89d1e1d2b7019940f0f3b1e0f019971e3d3b Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 12 Sep 2018 13:33:20 +0200 Subject: [PATCH] Improved in -report_system_area recognition of appended GPT partitions --- xorriso/iso_img.c | 17 ++++++++++++++--- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index b9712968..8dd7c420 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -1673,6 +1673,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, char **app_pseudo_paths= NULL; struct tm tm_erg; int was_force_bootable= 0; + uint64_t gpt_bheader_block= 0; struct mbr_par { uint8_t ptype; @@ -1928,6 +1929,9 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, idx= num[0] - 1; mbrpts[idx].has_path= 1; + } else if(strcmp(name, "GPT lba range :") == 0) { + gpt_bheader_block= num[2]; + } else if(strcmp(name, "GPT type GUID :") == 0) { idx= num[0] - 1; if(strcmp(textpt, "a2a0d0ebe5b9334487c068b6b72699c7") == 0) @@ -1976,8 +1980,15 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, } } - if(!have_protective_msdos) - appended_as_gpt= 0; + if(appended_as_gpt && !have_protective_msdos) { + if(mbr_count != 1) { + appended_as_gpt= 0; + } else if(mbrpts[0].ptype != 0xee || mbrpts[0].start_block != 1) { + appended_as_gpt= 0; + } else if(gpt_bheader_block != mbrpts[0].block_count) { + appended_as_gpt= 0; + } + } iso_part_blocks= img_blocks; for(mbr_idx = 0; mbr_idx < mbr_count; mbr_idx++) { @@ -2184,7 +2195,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, else part_type= 0xcd; - if(high_block < num[1] && num[2] > 0 && !gpts[idx].is_gap) { + if(high_block * 4 < num[1] && num[2] > 0 && !gpts[idx].is_gap) { for(mbr_idx = 0; mbr_idx < mbr_count; mbr_idx++) { if(mbrpts[mbr_idx].start_block == num[1]) { if(mbrpts[mbr_idx].block_count != num[2] && !(flag & 1)) { diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 6081e6be..551d6400 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2018.09.09.130316" +#define Xorriso_timestamP "2018.09.12.113255"