private static void writeSection(PE pe, DataEntry entry, IDataWriter dw)
throws IOException {
SectionTable st = pe.getSectionTable();
SectionHeader sh = st.getHeader(entry.index);
SectionData sd = st.getSection(entry.index);
int prd = sh.getPointerToRawData();
if (prd > dw.getPosition()) {
byte[] pa = sd.getPreamble();
if (pa != null) {
dw.writeBytes(pa);
} else {
dw.writeByte(0, prd - dw.getPosition());
}
}
byte[] b = sd.getData();
dw.writeBytes(b);
}