New -report_system_area mode "gpt_disk_guid"

master
Thomas Schmitt 6 years ago
parent 237852c4e1
commit adcd2386eb
  1. 25
      xorriso/iso_img.c
  2. 23
      xorriso/lib_mgt.c
  3. 2
      xorriso/xorriso_timestamp.h
  4. 3
      xorriso/xorrisoburn.h

@ -2702,8 +2702,9 @@ static void Xorriso_report_lines(struct XorrisO *xorriso,
int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag)
{
int ret, line_count, cmd_count= 0, et_line_count= 0, sa_line_count= 0;
int do_cmd= 0, as_mkisofs= 0, i;
int do_cmd= 0, as_mkisofs= 0, i, bin_count;
char **lines = NULL, **et_lines= NULL, **sa_lines= NULL, **cmds= NULL;
uint8_t guid[16];
IsoImage *image;
if(strcmp(form, "cmd") == 0 || strcmp(form, "as_mkisofs") == 0 || (flag & 2))
@ -2763,6 +2764,28 @@ int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag)
Xorriso_result(xorriso,0);
goto ex;
} else if(strcmp(form, "gpt_disk_guid") == 0 && !(flag & 1)) {
ret= Xorriso_get_volume(xorriso, &image, 0);
if(ret <= 0)
goto ex;
ret= iso_image_report_system_area(image, &sa_lines, &sa_line_count, 0);
if(ret <= 0)
goto ex;
for(i= 0; i < sa_line_count; i++) {
if(strncmp(sa_lines[i], "GPT disk GUID : ", 26) == 0) {
ret= Hex_to_bin(sa_lines[i] + 26, 16, &bin_count, guid, 0);
if(ret < 0 || bin_count != 16)
break;
Xorriso_format_guid(xorriso, guid, xorriso->result_line, 0);
strcat(xorriso->result_line, "\n");
Xorriso_result(xorriso,0);
ret= 1;
goto ex;
}
}
ret= 1;
goto ex;
} else {
sprintf(xorriso->info_text,
"%s form parameter not recognized: ",

@ -979,21 +979,19 @@ int Xorriso_set_data_cache(struct XorrisO *xorriso, void *o,
return(ret);
}
int Xorriso_make_guid(struct XorrisO *xorriso, char *line, int flag)
int Xorriso_format_guid(struct XorrisO *xorriso, uint8_t guid[16], char *line,
int flag)
{
uint8_t guid[16];
int i;
line[0]= 0;
iso_generate_gpt_guid(guid);
for(i= 0; i < 4; i++)
for(i= 3; i >= 0; i--)
sprintf(line + strlen(line), "%-2.2x", guid[i]);
sprintf(line + strlen(line), "-");
for(i= 4; i < 6; i++)
for(i= 5; i >= 4; i--)
sprintf(line + strlen(line), "%-2.2x", guid[i]);
sprintf(line + strlen(line), "-");
for(i= 6; i < 8; i++)
for(i= 7; i >= 6; i--)
sprintf(line + strlen(line), "%-2.2x", guid[i]);
sprintf(line + strlen(line), "-");
for(i= 8; i < 10; i++)
@ -1004,3 +1002,14 @@ int Xorriso_make_guid(struct XorrisO *xorriso, char *line, int flag)
return(1);
}
int Xorriso_make_guid(struct XorrisO *xorriso, char *line, int flag)
{
uint8_t guid[16];
int ret;
iso_generate_gpt_guid(guid);
ret= Xorriso_format_guid(xorriso, guid, line, 0);
return(ret);
}

@ -1 +1 @@
#define Xorriso_timestamP "2016.08.15.102443"
#define Xorriso_timestamP "2016.08.15.175002"

@ -644,6 +644,9 @@ int Xorriso_graftable_pathspec(struct XorrisO *xorriso, char *in_pathspec,
int Xorriso_parse_gpt_guid(struct XorrisO *xorriso, char *text, int flag);
int Xorriso_format_guid(struct XorrisO *xorriso, uint8_t guid[16], char *line,
int flag);
int Xorriso_make_guid(struct XorrisO *xorriso, char *line, int flag);
#endif /* Xorrisoburn_includeD */

Loading…
Cancel
Save