#pragma pack(?) changed to #include "*pack*.h"
diff --git a/include/aspi.h b/include/aspi.h
index 57703e0..f899e46 100644
--- a/include/aspi.h
+++ b/include/aspi.h
@@ -3,7 +3,7 @@
#if !defined(ASPI_H)
#define ASPI_H
-#pragma pack(1)
+#include "pshpack1.h"
#define SS_PENDING 0x00
#define SS_COMP 0x01
@@ -115,6 +115,6 @@
typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
-#pragma pack(4)
+#include "poppack.h"
#endif
diff --git a/include/cursoricon.h b/include/cursoricon.h
index bb5d377..e4ecb5a 100644
--- a/include/cursoricon.h
+++ b/include/cursoricon.h
@@ -9,7 +9,7 @@
#include "windef.h"
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct
{
@@ -64,7 +64,7 @@
} CURSORICONFILEDIR;
-#pragma pack(4)
+#include "poppack.h"
#define CID_RESOURCE 0x0001
#define CID_WIN32 0x0004
diff --git a/include/dialog.h b/include/dialog.h
index dbd90fe..0932681 100644
--- a/include/dialog.h
+++ b/include/dialog.h
@@ -14,7 +14,7 @@
* sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30).
*/
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct
{
@@ -34,7 +34,7 @@
HGLOBAL16 hDialogHeap;
} DIALOGINFO;
-#pragma pack(4)
+#include "poppack.h"
#define DF_END 0x0001
diff --git a/include/display.h b/include/display.h
index b5830dd..1196501 100644
--- a/include/display.h
+++ b/include/display.h
@@ -11,13 +11,13 @@
struct tagCURSORICONINFO;
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct tagCURSORINFO
{
WORD wXMickeys;
WORD wYMickeys;
} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
-#pragma pack(4)
+#include "poppack.h"
WORD WINAPI DISPLAY_Inquire(LPCURSORINFO lpCursorInfo);
VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor );
diff --git a/include/dplay.h b/include/dplay.h
index 6fce9fc..e24ae83 100644
--- a/include/dplay.h
+++ b/include/dplay.h
@@ -3,7 +3,7 @@
#include "wine/obj_base.h"
-#pragma pack(1)
+#include "pshpack1.h"
/*****************************************************************************
* Predeclare the interfaces
@@ -585,6 +585,6 @@
#endif
-#pragma pack(4)
+#include "poppack.h"
#endif /* __WINE_DPLAY_H */
diff --git a/include/font.h b/include/font.h
index 28cccf5..90a0069 100644
--- a/include/font.h
+++ b/include/font.h
@@ -9,7 +9,7 @@
#include "gdi.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* GDI logical font object */
typedef struct
@@ -51,7 +51,7 @@
CHAR szFaceName[60]; /* dito */
} FONTDIR16, *LPFONTDIR16;
-#pragma pack(4)
+#include "poppack.h"
#define FONTCACHE 32 /* dynamic font cache size */
diff --git a/include/keyboard.h b/include/keyboard.h
index 1002817..1688811 100644
--- a/include/keyboard.h
+++ b/include/keyboard.h
@@ -9,7 +9,7 @@
#include "windef.h"
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct _KBINFO
{
BYTE Begin_First_Range;
@@ -18,7 +18,7 @@
BYTE End_Second_Range;
WORD StateSize;
} KBINFO, *LPKBINFO;
-#pragma pack(4)
+#include "poppack.h"
typedef VOID (CALLBACK *LPKEYBD_EVENT_PROC)(BYTE,BYTE,DWORD,DWORD);
diff --git a/include/miscemu.h b/include/miscemu.h
index 8a96777..6cdca60 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -14,7 +14,7 @@
extern int DOSCONF_ReadConfig(void);
/* msdos/dosmem.c */
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct
{
@@ -74,7 +74,7 @@
BYTE DiskDataRate; /* 8B: Last disk data rate selected */
} BIOSDATA;
-#pragma pack(4)
+#include "poppack.h"
extern HANDLE16 DOSMEM_BiosDataSeg;
extern HANDLE16 DOSMEM_BiosSysSeg;
diff --git a/include/mmsystem.h b/include/mmsystem.h
index b3197ec..e56a5ca 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -13,7 +13,7 @@
typedef LPSTR HPSTR; /* a huge version of LPSTR */
typedef LPCSTR HPCSTR; /* a huge version of LPCSTR */
-#pragma pack(1)
+#include "pshpack1.h"
#define MAXWAVEDRIVERS 10
#define MAXMIDIDRIVERS 10
@@ -2865,7 +2865,7 @@
DWORD dwParam1, DWORD dwParam2);
DWORD WINAPI wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
-#pragma pack(4)
+#include "poppack.h"
#ifdef __cplusplus
}
diff --git a/include/module.h b/include/module.h
index fa35eca..45ce685 100644
--- a/include/module.h
+++ b/include/module.h
@@ -84,7 +84,7 @@
/* Self-loading modules contain this structure in their first segment */
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct
{
@@ -118,7 +118,7 @@
DWORD dwReserved;
} LOADPARAMS;
-#pragma pack(4)
+#include "poppack.h"
/* internal representation of 32bit modules. per process. */
typedef enum {
diff --git a/include/mouse.h b/include/mouse.h
index 2b7d18d..94ba21a 100644
--- a/include/mouse.h
+++ b/include/mouse.h
@@ -11,7 +11,7 @@
struct tagCURSORICONINFO;
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct _MOUSEINFO
{
BYTE msExist;
@@ -24,7 +24,7 @@
WORD msYRes;
WORD msMouseCommPort;
} MOUSEINFO, *LPMOUSEINFO;
-#pragma pack(4)
+#include "poppack.h"
typedef VOID (CALLBACK *LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD);
diff --git a/include/poppack.h b/include/poppack.h
new file mode 100644
index 0000000..7104791
--- /dev/null
+++ b/include/poppack.h
@@ -0,0 +1,15 @@
+#ifdef __WINE_PSHPACK_H
+#undef __WINE_PSHPACK_H
+
+#if defined(__GNUC__) || defined(__SUNPRO_C)
+#pragma pack()
+#elif defined(__SUNPRO_CC)
+#warning "Assumes default alignment is 4"
+#pragma pack(4)
+#elif !defined(RC_INVOKED)
+#error "Restoration of the previous alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_C) ; !defined(RC_INVOKED) */
+
+#else /* defined(__WINE_PSHPACK_H) */
+#error "Popping alignment isn't possible since no alignment has been pushed"
+#endif /* defined(__WINE_PSHPACK_H) */
diff --git a/include/pshpack1.h b/include/pshpack1.h
new file mode 100644
index 0000000..775642d
--- /dev/null
+++ b/include/pshpack1.h
@@ -0,0 +1,13 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 1
+
+#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#pragma pack(1)
+#elif !defined(RC_INVOKED)
+#error "1 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
+
diff --git a/include/pshpack2.h b/include/pshpack2.h
new file mode 100644
index 0000000..8b7e29e
--- /dev/null
+++ b/include/pshpack2.h
@@ -0,0 +1,12 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 2
+
+#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#pragma pack(2)
+#elif !defined(RC_INVOKED)
+#error "2 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
diff --git a/include/pshpack4.h b/include/pshpack4.h
new file mode 100644
index 0000000..3904415
--- /dev/null
+++ b/include/pshpack4.h
@@ -0,0 +1,16 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 4
+
+#if defined(__GNUC__) || defined(__SUNPRO_CC)
+#pragma pack(4)
+#elif defined(__SUNPRO_C)
+#warning "Assumes default alignment is 4"
+#pragma pack()
+#elif !defined(RC_INVOKED)
+#error "4 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
+
diff --git a/include/pshpack8.h b/include/pshpack8.h
new file mode 100644
index 0000000..d0de263
--- /dev/null
+++ b/include/pshpack8.h
@@ -0,0 +1,12 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 8
+
+#if 0
+#pragma pack(8)
+#elif !defined(RC_INVOKED)
+#error "8 as alignment is not supported"
+#endif /* 0 ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
diff --git a/include/shell.h b/include/shell.h
index 63179be..570077f 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -59,7 +59,7 @@
/****************************************************************************
* SHITEMID, ITEMIDLIST, PIDL API
*/
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct
{ WORD cb; /* nr of bytes in this item */
BYTE abID[1];/* first byte in this item */
@@ -68,7 +68,7 @@
typedef struct
{ SHITEMID mkid; /* first itemid in list */
} ITEMIDLIST,*LPITEMIDLIST,*LPCITEMIDLIST;
-#pragma pack(4)
+#include "poppack.h"
DWORD WINAPI SHGetPathFromIDListA (LPCITEMIDLIST pidl,LPSTR pszPath);
DWORD WINAPI SHGetPathFromIDListW (LPCITEMIDLIST pidl,LPWSTR pszPath);
diff --git a/include/stackframe.h b/include/stackframe.h
index 0326abd..cbe87e0 100644
--- a/include/stackframe.h
+++ b/include/stackframe.h
@@ -10,7 +10,7 @@
#include "ldt.h"
#include "thread.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* 32-bit stack layout after CallTo16() */
typedef struct _STACK32FRAME
@@ -45,7 +45,7 @@
WORD cs; /* 1c */
} STACK16FRAME;
-#pragma pack(4)
+#include "poppack.h"
#define THREAD_STACK16(thdb) ((STACK16FRAME*)PTR_SEG_TO_LIN((thdb)->cur_stack))
#define CURRENT_STACK16 (THREAD_STACK16(THREAD_Current()))
diff --git a/include/task.h b/include/task.h
index c9f43a0..a0b6000 100644
--- a/include/task.h
+++ b/include/task.h
@@ -9,7 +9,7 @@
#include "windef.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* Process database (i.e. a normal DOS PSP) */
@@ -141,7 +141,7 @@
HTASK16 LockTDB; /* 14 hLockedTask */
} THHOOK;
-#pragma pack(4)
+#include "poppack.h"
extern THHOOK *pThhook;
extern void (*TASK_AddTaskEntryBreakpoint)( HTASK16 hTask );
diff --git a/include/toolhelp.h b/include/toolhelp.h
index e416ed0..b3deacb 100644
--- a/include/toolhelp.h
+++ b/include/toolhelp.h
@@ -9,7 +9,7 @@
#define MAX_PATH16 255
#define MAX_CLASSNAME 255
-#pragma pack(1)
+#include "pshpack1.h"
/* Global heap */
@@ -395,7 +395,7 @@
WORD wFlags;
} STACKTRACEENTRY;
-#pragma pack(4)
+#include "poppack.h"
/*
* Process Entry list as created by CreateToolHelp32Snapshot
diff --git a/include/win16drv.h b/include/win16drv.h
index 04fbe46..26c9899 100644
--- a/include/win16drv.h
+++ b/include/win16drv.h
@@ -110,7 +110,7 @@
LOADED_PRINTER_DRIVER *pLPD; /* Associated printer driver */
} PDEVICE_HEADER;
-#pragma pack(1)
+#include "pshpack1.h"
#define PCOLOR DWORD
typedef struct DRAWMODE
{
@@ -129,7 +129,7 @@
} DRAWMODE, *LPDRAWMODE;
-#pragma pack(4)
+#include "poppack.h"
typedef struct WINE_ENUM_PRINTER_FONT_CALLBACK
{
diff --git a/include/winaspi.h b/include/winaspi.h
index 0af1d5e..2b0ca58 100644
--- a/include/winaspi.h
+++ b/include/winaspi.h
@@ -1,7 +1,7 @@
#if !defined(WINASPI_H)
#define WINASPI_H
-#pragma pack(1)
+#include "pshpack1.h"
#define ASPI_DOS 1
#define ASPI_WIN16 2
@@ -97,6 +97,6 @@
typedef union SRB16 SRB16;
-#pragma pack(4)
+#include "poppack.h"
#endif
diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h
index a472a69..7097106 100644
--- a/include/wine/winbase16.h
+++ b/include/wine/winbase16.h
@@ -2,7 +2,7 @@
#define _INCLUDE_WINE_WINBASE16_H
#include "windef.h"
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct _SEGINFO {
UINT16 offSegment;
UINT16 cbSegment;
@@ -34,7 +34,7 @@
#define WF_WIN32WOW 0x4000 /* undoc */
#define WF_WLO 0x8000
-#pragma pack(4)
+#include "poppack.h"
HMODULE16 WINAPI GetModuleHandle16(LPCSTR);
HLOCAL16 WINAPI LocalAlloc16(UINT16,WORD);
diff --git a/include/wine/winuser16.h b/include/wine/winuser16.h
index 8b72291..ad26789 100644
--- a/include/wine/winuser16.h
+++ b/include/wine/winuser16.h
@@ -5,7 +5,7 @@
#include "winbase.h"
#include "winuser.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* SetWindowPlacement() struct */
typedef struct
@@ -473,7 +473,7 @@
DWORD itemData2 WINE_PACKED;
} COMPAREITEMSTRUCT16, *LPCOMPAREITEMSTRUCT16;
-#pragma pack(4)
+#include "poppack.h"
/* WM_COMMNOTIFY flags */
#define CN_RECEIVE 0x0001
diff --git a/include/winioctl.h b/include/winioctl.h
index d068556..d7a3d71 100644
--- a/include/winioctl.h
+++ b/include/winioctl.h
@@ -239,14 +239,14 @@
/* Important: All MS_DOS data structures must be packed on a one-byte boundary - good old 16 bit. */
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct tagMID {
WORD midInfoLevel;
DWORD midSerialNum;
BYTE midVolLabel[11];
BYTE midFileSysType[8];
} MID, *PMID;
-#pragma pack(4)
+#include "poppack.h"
/* End VWIN32 information */
diff --git a/include/winnt.h b/include/winnt.h
index 90e25cf..a99763f 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -9,7 +9,7 @@
#include "windef.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* Defines */
/* Argument 1 passed to the DllEntryProc. */
@@ -332,8 +332,8 @@
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
+#include "poppack.h"
-#pragma pack(4)
/*
* function pointer to a exception filter
*/
@@ -378,7 +378,7 @@
#ifndef _SECURITY_DEFINED
#define _SECURITY_DEFINED
-#pragma pack(1)
+#include "pshpack1.h"
typedef struct {
BYTE Value[6];
@@ -437,8 +437,12 @@
#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
+#include "poppack.h"
+
#endif /* _SECURITY_DEFINED */
+#include "pshpack1.h"
+
/*
* SID_AND_ATTRIBUTES
*/
@@ -784,6 +788,6 @@
#define DACL_SECURITY_INFORMATION 0x00000004
#define SACL_SECURITY_INFORMATION 0x00000008
-#pragma pack(4)
+#include "poppack.h"
#endif /* __WINE_WINNT_H */
diff --git a/include/winsock.h b/include/winsock.h
index c364e32..217764f 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -29,7 +29,7 @@
#include "windef.h"
#include "task.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* Win16 socket-related types */
@@ -160,7 +160,7 @@
SEGPTR lpVendorInfo;
} WSADATA, *LPWSADATA;
-#pragma pack(4)
+#include "poppack.h"
/* ----------------------------------- no Win16 structure defs beyond this line! */
diff --git a/include/wnaspi32.h b/include/wnaspi32.h
index 8f6981c..9260a03 100644
--- a/include/wnaspi32.h
+++ b/include/wnaspi32.h
@@ -1,7 +1,7 @@
#if !defined(WNASPI32_H)
#define WNASPI32_H
-#pragma pack(1)
+#include "pshpack1.h"
typedef union SRB * LPSRB;
@@ -93,6 +93,6 @@
typedef union SRB SRB;
-#pragma pack(4)
+#include "poppack.h"
#endif
diff --git a/include/x11font.h b/include/x11font.h
index b831153..4c22e69 100644
--- a/include/x11font.h
+++ b/include/x11font.h
@@ -9,7 +9,7 @@
#include "gdi.h"
#include "x11drv.h"
-#pragma pack(1)
+#include "pshpack1.h"
/* this is a part of the font resource header, should
* make it easier to implement dynamic softfont loading */
@@ -42,7 +42,7 @@
LPCSTR dfFace;
} IFONTINFO16, *LPIFONTINFO16;
-#pragma pack(4)
+#include "poppack.h"
/* internal flags */