I have taken the VS_VERSIONINFO structure from a file and the Value (VS_FIXEDFILEINFO) is padded with 32 bits.
According to MSDN, Value should be padded to fall on a 32 bit boundary.
Padding1
Type: WORD
Contains as many zero words as necessary to align the Value member on a 32-bit boundary.
But value is already on a 32 bit boundary.
Why is VS_FIXEDFILEINFO padded with 32 bits on a 32 bit boundary, anyway?
To align data on a 32 bit boundary, only padding with less than 32 bits would make sense.
I'm asking this because I need to parse an RC script and generate this resource.
Padding is added to structures and their members so that the CPU can access the memory holding those members using addresses that are aligned to the CPU's word width.
Back in the dark days some CPUs could be persuaded to generate a bus error if you did a non-aligned access but these days it's just slower, particularly if you miss the onboard caches.
VS_FIXEDFILEINFO
is arbitrary data of arbitrary length therefore some padding may appear after it to bring the subsequent VS_VERSIONINFO
structure members back into alignment.
The wording of MS's documentation for the wLength
member of VS_VERSIONINFO
implies that you shouldn't consider padding between the VS_VERSIONINFO
that you're looking at and the next one in memory. i.e. do not subtract the address of the next structure from the first one and use that as wLength
because you may bring in some padding bytes between the two structures that you don't want.