#include "project.h" int modify (DISK * d, int n, char *name, char *type_guid, uint64_t start, uint64_t end, char *part_guid) { GPT_headers h; GPT_entry e = { 0 }; h = headers_get (d); if (a_to_guid (type_guid, &e.type)) { fprintf (stderr, "GUID type %s was not parsed\n", type_guid); exit (1); } printf ("guid=%s became=%s\n", type_guid, guid_to_a (e.type)); if (part_guid) { if (a_to_guid (part_guid, &e.label)) { fprintf (stderr, "Partition GUID %s was not parsed\n", part_guid); exit (1); } } else { e.label = guid_random (); } e.start = start; e.end = end; ascii_to_utf16 (name, -1, e.name, sizeof (e.name)); entry_show (&e); /*Odd order because efi says so*/ entry_write (d, &h.header, n, &e); header_redo_ent_crc (d, &h.header); header_write (d, &h.header); entry_write (d, &h.alt_header, n, &e); header_redo_ent_crc (d, &h.alt_header); header_write (d, &h.alt_header); return 0; }