entry.Data.position(0);
// System.out.println("DataEntry found : " + entry + " (size=" + entry.Data.remaining() + ")");
entry.Data.position(0);
ResIconDir rid = new ResIconDir(entry.Data);
// System.out.println("ResIconDir :");
// System.out.println(rid.toString());
int iconid = rid.getEntries()[0].dwImageOffset;
// System.out.println("Icon Index: " + iconid);
PEResourceDirectory.DataEntry iconentry = resdir.getData("#3", "#" + iconid, null);
iconentry.Data.position(0);
// System.out.println("Icon :");
// System.out.println(icon.toString());
rid.getEntries()[0].bWidth = (short)icon.Width;
rid.getEntries()[0].bHeight = (short)(icon.Height / 2);
rid.getEntries()[0].bColorCount = (short)(1 << icon.BitsPerPixel);
rid.getEntries()[0].wBitCount = icon.BitsPerPixel;
rid.getEntries()[0].dwBytesInRes = icon.getData().remaining();
iconentry.Data = icon.getData();
iconentry.Size = iconentry.Data.remaining();
entry.setData(rid.getData());
}