private void fixup_header(ref byte[] header, byte[] pttable) { crc32 c = new crc32(); byte[] chk_gpt_pt = BitConverter.GetBytes(c.CRC(pttable)); header.Replace(chk_gpt_pt, 88, 4); header.Replace(Oper.StringToByteArray(DISK_GUID), 56, 16); for (int i = 16; i <= 19; i++) { header[i] = 0x00; } c = new crc32(); byte[] chk_header = BitConverter.GetBytes(c.CRC(Oper.returnportion(header, 0, 0x5C))); header.Replace(chk_header, 16, 4); }
private void fixup_part_table(ref byte[] pttable) { pttable.Replace(Oper.StringToByteArray(TEMP_CONTENT_GUID), 16, 16); pttable.Replace(Oper.StringToByteArray(USER_CONTENT_GUID), 144, 16); pttable.Replace(Oper.StringToByteArray(SYSTEM_SUPPORT_GUID), 272, 16); pttable.Replace(Oper.StringToByteArray(SYSTEM_UPDATE_GUID), 400, 16); pttable.Replace(Oper.StringToByteArray(SYSTEM_UPDATE2_GUID), 528, 16); for (int i = 56; i <= 127; i++) { if (i - 56 < TEMP_CONTENT_L.Length) { pttable[i] = (byte)TEMP_CONTENT_L[i - 56]; } else { pttable[i] = 0x00; } } for (int i = 184; i <= 255; i++) { if (i - 184 < USER_CONTENT_L.Length) { pttable[i] = (byte)USER_CONTENT_L[i - 184]; } else { pttable[i] = 0x00; } } for (int i = 312; i <= 383; i++) { if (i - 312 < SYSTEM_SUPPORT_L.Length) { pttable[i] = (byte)SYSTEM_SUPPORT_L[i - 312]; } else { pttable[i] = 0x00; } } for (int i = 440; i <= 511; i++) { if (i - 440 < SYSTEM_UPDATE_L.Length) { pttable[i] = (byte)SYSTEM_UPDATE_L[i - 440]; } else { pttable[i] = 0x00; } } for (int i = 568; i <= 639; i++) { if (i - 568 < SYSTEM_UPDATE2_L.Length) { pttable[i] = (byte)SYSTEM_UPDATE2_L[i - 568]; } else { pttable[i] = 0x00; } } }
private void btnAdvanced_Click(object sender, EventArgs e) { if (nand != null && nand.ok) { HexEdit.KVViewer k = new HexEdit.KVViewer(Nand.Nand.decryptkv(nand._rawkv, Oper.StringToByteArray(nand._cpukey))); k.Show(); } }