int DumpGFCU(byte[] data, int startaddr) { int i = 0; for (; i < GFCU_ENTS_MAXCNT; i++) { int pos = startaddr + i * GFCU_EN_SIZE; byte[] entry = Oper.returnportion(data, pos, GFCU_EN_SIZE); int eof = ReadUInt32_LE(entry, GFCU_EN_EOF_START); if (eof == GFCU_EN_EOF_MAGIC) { return(i - 1); } string fn = Oper.ByteArrayToString_v2(entry, GFCU_EN_FN_START, GFCU_EN_FN_LENGTH); int sz = ReadUInt32_LE(entry, GFCU_EN_SIZE_START); int blk = ReadUInt32_LE(entry, GFCU_EN_BLOCK_START); int un = ReadUInt32_LE(entry, GFCU_EN_UNKNOWN_START); GFCU gfcu = new GFCU(pos, fn, sz, blk, un); gfcu_arr.Add(gfcu); } return(i - 1); }
void PrintSFBX() { Console.WriteLine("SFBX Entries"); Console.WriteLine("-----------\n"); int i = 0; foreach (SFBX sfbx in sfbx_arr) { if (sfbx.SIZE == 0) { continue; } Console.WriteLine("'Entry 0x{0:02X} : found @ pos: {1:08X}", i, sfbx.POSITION); Console.WriteLine("\tLBA: {0:08X} (addr {1:09X})", sfbx.LBA, sfbx.LBA * LOG_BLOCK_SZ); Console.WriteLine("\tSize: {0:08X} ({0} Bytes, {1}kB, {2}MB)", sfbx.SIZE * LOG_BLOCK_SZ, (sfbx.SIZE * LOG_BLOCK_SZ) / 1024, (sfbx.SIZE * LOG_BLOCK_SZ) / 1024 / 1024); if (sfbx.MAGIC != null) { Console.WriteLine("*** MAGIC: {0} ***", Oper.ByteArrayToString_v2(sfbx.MAGIC)); } } }
void ExtractSFBXData(string fn) { //infile = open(fn, 'r+b') //foldername = os.path.basename(fn).replace('.','_') //MakeDir(foldername) foreach (SFBX sfbx in sfbx_arr) { if (sfbx.SIZE != 0) { int addr = sfbx.LBA * LOG_BLOCK_SZ; int size = sfbx.SIZE * LOG_BLOCK_SZ; byte[] magic = sfbx.MAGIC; string ext; if (magic != null) { ext = Oper.ByteArrayToString_v2(magic); } else { ext = "BIN"; } //string fn_out = '{:X}_{:X}.{}'.format(addr,addr+size,ext); // path_out = os.path.join(foldername, fn_out) // outfile = open(path_out, 'w+b') //Console.WriteLine("Extracting @ {0:#08x}, size: {1}kb to '{2}'", addr, size / 1024, fn_out); // infile.seek(addr) // outfile.write(infile.read(size)) // outfile.close() } } //infile.close() }
string DumpKernelVer(byte[] data) { return(Oper.ByteArrayToString_v2(data, KRNL_VER_START, KRNL_VER_LENGTH)); }