mssip.h trouble

Patrik Stridvall ps at
Tue Sep 10 12:53:46 CDT 2002

> Patrik Stridvall <ps at> writes:
> > I'm totally at loss as to what to do. Not that it currently 
> matters since
> > the data structures isn't currently used but someday 
> somebody will...
> Well, we need to add explicit padding in the structures to respect the
> alignment that MSVC uses. That should only be required at the end of
> the structures I think, so it's not too bad.

Unfortunately its a little more complicated than that,
it effects the internal offset of fields as well in
some case. 

In the normal case below it doesn't matter whether n is 4 or 8.

#pragma pack(n)
typedef struct {
	char x;
	long y; /* offset is 4 both for n = 4 and n = 8 */
} long_n;
#pragma pack()

However is the case below is does matter whether n is 4 or 8:

#ifdef _MSC_VER
typedef __int64 longlong_t;
typedef long long longlong_t;

#pragma pack(n)
typedef struct {
	char x;
	longlong_t y; /* offset is 4 if n = 4, but is 8 if n = 8 */
} longlong_n;
#pragma pack()

In short, if the size of a field is larger than 4 it matters internally
whether alignment is 4 or 8.

Now in the case of mssip.h, I can't see any fields that have sizes larger
than 4 so we could easily handle that special case as you suggested.
However in general we can not...

More information about the wine-devel mailing list