private PEData loadData ( ) throws IOException { PESignature pesig = new PESignature ( file ) ; pesig . read ( ) ; checkState ( pesig . exists ( ) , "no valid pe file, signature not found" ) ; // read all headers try ( RandomAccessFile raf = new RandomAccessFile ( file , "r" ) ) { MSDOSHeader msdos = loadMSDOSHeader ( raf , pesig . getOffset ( ) ) ; COFFFileHeader coff = loadCOFFFileHeader ( pesig , raf ) ; OptionalHeader opt = loadOptionalHeader ( pesig , coff , raf ) ; SectionTable table = loadSectionTable ( pesig , coff , raf ) ; table . read ( ) ; // construct PEData instance PEData data = new PEData ( msdos , pesig , coff , opt , table , file ) ; /* reload headers in case of dual pe header */ // MemoryMappedPE mmBytes = MemoryMappedPE.newInstance(data, // new SectionLoader(data)); // TODO reload coff, msdos, .. // coff = reloadCOFFFileHeader(pesig, mmBytes, data); // data = new PEData(msdos, pesig, coff, opt, table, file); // opt = reloadOptionalHeader(pesig, mmBytes, data); // data = new PEData(msdos, pesig, coff, opt, table, file); // table.reload(mmBytes); // System.out.println(new ReportCreator(data).secTableReport()); // re-construct PEData instance return data ; } }
Loads the PE file header data into a PEData instance .