Writing icons to PE File Formats in Java

262 Views Asked by At

I'm in the process of writing a read/write library for Windows PE files using Java (and eventually hope to release it as OpenSource). For now though this is for cross platform compatibility and will allow me to modify strings/version info/icons/resources etc from an Ant build system or command line/terminal etc.

The problem I have reached is that I can now embed icons in the .rsrc section from a source BMP file and have it display them but unfortunately (Even though the data is correct) the icon comes out within Windows Explorer (and CFF Explorer/ Visual Studio etc) as incorrect. It has a sort of pattern across the raster data as if the image something has be Xor'd or digitally signed.

Any ideas what i'm doing wrong when adding this data?

On a side note I'm also a bit confused as to why I need to modify the height part of the BMP header so that its marked as 2x its real size.

Thanks In Advance. - Tim.

0

There are 0 best solutions below