ddraw.h structure alignment
stefandoesinger at gmx.at
Sun Oct 11 10:15:13 CDT 2009
Am 11.10.2009 um 14:42 schrieb Markus Stockhausen:
> Am Sonntag, den 11.10.2009, 13:18 +0200 schrieb Markus Stockhausen:
>> Then I'm somehow in trouble. How can one explain the following
>> error: Application calls IDirectDraw GetDeviceIdentifier of
>> DDRAW7 but only reserves memory with sizeof(DDEVICEIDENTIFIER)
>> instead of sizeof(DDEVICEIDENTIFIER2) bytes. Wine returns the
>> required structure but with the contents of dwWHQLLevel
>> stack contents are overwritten.
> Source of error was found. DDEVICEIDENTIFIER2 is aligned to 8 bytes
> therefore 4 bytes too large (at least on my 64 bit Linux). Should a
> patch include a pragma pack handling in the ddraw.h file itself or is
> there any other location where one can fix that?
Does a pragma pack fix the issue? If yes, then that's probably the
Its probably worth writing a test that allocates e.g. a char data,
then passes this to GetDeviceIdentifier, fill it with non-zero data,
and check how much is overwritten.
Otoh I find it strange that the struct is aligned to 8 bytes. Are you
running wine in 64 bit? Or do you have some other compiler flags that
make the compiler use 8 byte alignment?
More information about the wine-devel