ddraw.h structure alignment

Markus Stockhausen markus.stockhausen at collogia.de
Sun Oct 11 10:20:53 CDT 2009

Am Sonntag, den 11.10.2009, 17:15 +0200 schrieb Stefan Dösinger:
> Does a pragma pack fix the issue? If yes, then that's probably the  
> correct fix.
> Its probably worth writing a test that allocates e.g. a char data[64],  
> 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?

You are right.

- I'm working on 64 bit (gcc 4.3.3)
- #pragma pack(push,4) / #pragma pack(pop) around DDDEVICEIDENTIFIER2
  fixes the behaviour
- a testcase fails without pragma:

   ok(sizeof(DDDEVICEIDENTIFIER2)==0x42c, "DDDEVICEIDENTIFIER2 too large

I'll send a patch

More information about the wine-devel mailing list