BITMAP resource
- Win32 RC compiler allows any DIB with header size >= 40 or exactly 12 (Win 2.0). DIBs with unknown or
BITMAPV4HEADER/BITMAPV5HEADERheaders will fail to be loaded at runtime by LoadBitmap/LoadImage, but they are not a compile error. - Does not support PNG at all. Side note: If a
.pngfile is specified in a.xmlfile run throughuicc.exe, it will generate a.rcfile with e.g.<id> IMAGE "image.png"which is a custom resource with the type as the stringIMAGE, while for.bmpfiles it will useBITMAP. - Win32
rc.exewill always try to writenumColorPaletteBytes(<number of bytes per color palette index> * numColors) bytes to the.res, filling in any bytes past the end of the file with the pixel data (this is a miscompilation I believe), and then0x00if it starts reading past the end of the file (note:numColorsisbiClrUsedfrom theBITMAPINFOHEADER).- If
numColorPaletteBytesis >= 2 GiB, thenrc.exewill fail without of memory, e.g. ifnumColorsis0x262C8ACF, thenrc.exewill attempt to allocate0x98B22B3Cbytes (2.386 GiB) and fail.- Certain values where
numColorPaletteBytesis >= 2 GiB seem avoid theout of memoryand have extremely long runtime (it seems like an infinite loop but will eventually finish), but I’m not sure exactly what the conditions are that avoid theout of memory.
- Certain values where
- If
numColorPaletteBytesis < 2 GiB, thenrc.exewill succeed (but may take a while)
- If
- Win32
rc.exewill miscompile bitmaps where thebfOffBitsfield of the bitmap file header is set larger than<the size of the bmp file> + <size of the DIB header>, in which case the ‘size’ of the resource will become negative and a resource with the size set to the underflowed size (e.g.-1will underflow/wrap to0xFFFFFFFF) but with no actual data.