Trying to recognize isohybrid MBR for "Boot record :" message

This commit is contained in:
Thomas Schmitt 2008-10-27 14:28:05 +00:00
parent d5acc6e2be
commit 478d49bd5f
2 changed files with 32 additions and 7 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.10.26.142422"
#define Xorriso_timestamP "2008.10.27.142720"

View File

@ -3845,8 +3845,11 @@ int Xorriso_toc_line(struct XorrisO *xorriso, int flag)
*/
int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
{
int ret, bin_path_valid= 0;
int ret, bin_path_valid= 0,has_isolinux_mbr= 0, i;
unsigned int mbr_lba= 0;
off_t lb0_count;
char *respt, sfe[5*SfileadrL], path[SfileadrL];
unsigned char lb0[2048];
struct burn_drive_info *dinfo;
struct burn_drive *drive;
IsoImage *image= NULL;
@ -3884,11 +3887,33 @@ no_boot:;
else
ret= 0;
if(ret > 0) {
/* >>> Conditions for MBR recognition : first 512 bytes of LBA 0*/
/* >>> byte 432 to 435 holds the lba of bootimg_node */
/* >>> byte 510 is 0x55 , byte 511 is 0xaa */
/* Load and examine potential MBR */
ret= burn_read_data(drive, (off_t) 0, (char *) lb0, (off_t) 2048,
&lb0_count, 2);
if(ret > 0) {
has_isolinux_mbr= 1;
if(lb0[510] != 0x55 || lb0[511] != 0xaa)
has_isolinux_mbr= 0;
mbr_lba= lb0[432] | (lb0[433] << 8) | (lb0[434] << 16) | (lb0[435] << 24);
mbr_lba/= 4;
if(mbr_lba != xorriso->loaded_boot_bin_lba)
has_isolinux_mbr= 0;
if(has_isolinux_mbr) {
for(i= 0; i < 426; i++)
if(strncmp((char *) (lb0 + i), "isolinux", 8) == 0)
break;
if(i >= 426)
has_isolinux_mbr= 0;
}
for(i= 462; i < 510; i++)
if(lb0[i])
break;
if(i < 510)
has_isolinux_mbr= 0;
}
if(has_isolinux_mbr)
strcat(respt, " , ISOLINUX isohybrid MBR pointing to boot image");
else
strcat(respt, " , ISOLINUX boot image capable of isohybrid");
}
strcat(respt, "\n");