winnt.h should not be self-contained, it must depend on windef.h so
that STRICT works correctly; moved some definitions back to windef.h
where they belong, and removed a couple of definitions that don't
exist on Windows.

diff --git a/dlls/dplayx/dplobby.c b/dlls/dplayx/dplobby.c
index b3200cc..1f291d5 100644
--- a/dlls/dplayx/dplobby.c
+++ b/dlls/dplayx/dplobby.c
@@ -19,8 +19,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <string.h>
+
+#include "windef.h"
 #include "winerror.h"
-#include "winnt.h"
 #include "winreg.h"
 #include "winnls.h"
 #include "wine/debug.h"
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 134865d..c6d5166 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -21,7 +21,6 @@
 #include "config.h"
 #include "wine/port.h"
 
-#include "winnt.h"
 #include "winbase.h"
 #include "winuser.h"
 
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index 3a12fd0..5a9d859 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -25,7 +25,7 @@
 #include <assert.h>
 #include <signal.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winternl.h"
 #include "global.h"
 #include "wine/exception.h"
diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c
index 9f50de7..24d686d 100644
--- a/dlls/ntdll/large_int.c
+++ b/dlls/ntdll/large_int.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "winnt.h"
+#include "windef.h"
 #include "winternl.h"
 
 /*
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 3663a9f..2e10060 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -50,8 +50,8 @@
 # include <sys/signal.h>
 #endif
 
+#include "windef.h"
 #include "winternl.h"
-#include "winnt.h"
 #include "wine/library.h"
 
 #include "selectors.h"
diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c
index 7b0df2a..5e6c51a 100644
--- a/dlls/ntdll/signal_powerpc.c
+++ b/dlls/ntdll/signal_powerpc.c
@@ -50,8 +50,8 @@
 # include <sys/signal.h>
 #endif
 
+#include "windef.h"
 #include "winternl.h"
-#include "winnt.h"
 #include "wine/library.h"
 #include "wine/exception.h"
 #include "selectors.h"
diff --git a/dlls/oleaut32/parsedt.h b/dlls/oleaut32/parsedt.h
index 426708f..01b614a 100644
--- a/dlls/oleaut32/parsedt.h
+++ b/dlls/oleaut32/parsedt.h
@@ -45,7 +45,7 @@
 */
 
 #include <stdlib.h>
-#include <winnt.h> /* DateToTm use */
+#include "windef.h" /* DateToTm use */
 
 /* ----------------------------------------------------------------
  *				Section 1:	bool, true, false, TRUE, FALSE
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 588d789..a9f183b 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -1127,7 +1127,7 @@
  *   IInternetSecurityMgrSite
  *   IShellView
  */
-HRESULT WINAPI SHLWAPI_172(IUnknown *lpUnknown, PHWND lphWnd)
+HRESULT WINAPI SHLWAPI_172(IUnknown *lpUnknown, HWND *lphWnd)
 {
   /* FIXME: Wine has no header for this object */
   static const GUID IID_IInternetSecurityMgrSite = { 0x79eac9ed,
diff --git a/dlls/twain/twain.h b/dlls/twain/twain.h
index 212c106..08c31ff 100644
--- a/dlls/twain/twain.h
+++ b/dlls/twain/twain.h
@@ -52,7 +52,7 @@
 #ifndef TWAIN
 #define TWAIN
 
-#include "winnt.h"
+#include "windef.h"
 
 #define FAR
 #define huge
diff --git a/dlls/winedos/int17.c b/dlls/winedos/int17.c
index e9e87b8..4be7b50 100644
--- a/dlls/winedos/int17.c
+++ b/dlls/winedos/int17.c
@@ -20,10 +20,10 @@
 
 #include <stdlib.h>
 
+#include "windef.h"
 #include "miscemu.h"
 #include "wine/debug.h"
 #include "msdos.h"
-#include "winnt.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(int);
 
diff --git a/dlls/winedos/int29.c b/dlls/winedos/int29.c
index fa6f408..2167c8b 100644
--- a/dlls/winedos/int29.c
+++ b/dlls/winedos/int29.c
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#include "winnt.h"
+#include "windef.h"
 
 #include "miscemu.h"
 #include "dosexe.h"
diff --git a/dlls/winedos/int31.c b/dlls/winedos/int31.c
index 42a586d..50d8d93 100644
--- a/dlls/winedos/int31.c
+++ b/dlls/winedos/int31.c
@@ -697,12 +697,12 @@
 	NewRMCB->proc_sel = context->SegDs;
        NewRMCB->regs_ofs = DOSVM_IsDos32() ? context->Edi : LOWORD(context->Edi);
 	NewRMCB->regs_sel = context->SegEs;
-	SET_LOWORD( context->Ecx, HIWORD(NewRMCB->address) );
-	SET_LOWORD( context->Edx, LOWORD(NewRMCB->address) );
+	SET_CX( context, HIWORD(NewRMCB->address) );
+	SET_DX( context, LOWORD(NewRMCB->address) );
     }
     else
     {
-	SET_LOWORD( context->Eax, 0x8015 ); /* callback unavailable */
+	SET_AX( context, 0x8015 ); /* callback unavailable */
 	SET_CFLAG(context);
     }
 }
@@ -717,7 +717,7 @@
           CX_reg(context), DX_reg(context));
 
     if (DPMI_FreeRMCB(MAKELONG(DX_reg(context), CX_reg(context)))) {
-	SET_LOWORD( context->Eax, 0x8024 ); /* invalid callback address */
+	SET_AX( context, 0x8024 ); /* invalid callback address */
 	SET_CFLAG(context);
     }
 }
diff --git a/dlls/winedos/interrupts.c b/dlls/winedos/interrupts.c
index 8013f0f..4b50905 100644
--- a/dlls/winedos/interrupts.c
+++ b/dlls/winedos/interrupts.c
@@ -122,7 +122,7 @@
   if (IS_SELECTOR_32BIT(context->SegSs))
     context->Esp += islong ? -12 : -6;
   else
-    ADD_LOWORD( context->Esp, islong ? -12 : -6 );
+    context->Esp = (context->Esp & ~0xffff) | (WORD)((context->Esp & 0xffff) + (islong ? -12 : -6));
 }
 
 /**********************************************************************
diff --git a/dlls/wineps/ppd.c b/dlls/wineps/ppd.c
index d0b0919..64ec6ae 100644
--- a/dlls/wineps/ppd.c
+++ b/dlls/wineps/ppd.c
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
-#include "winnt.h" /* HEAP_ZERO_MEMORY */
+#include "windef.h" /* HEAP_ZERO_MEMORY */
 #include "wine/debug.h"
 #include "psdrv.h"
 #include "winspool.h"
diff --git a/dlls/wineps/truetype.c b/dlls/wineps/truetype.c
index 9448e88..573c7ee 100644
--- a/dlls/wineps/truetype.c
+++ b/dlls/wineps/truetype.c
@@ -61,7 +61,7 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winerror.h"
 #include "winreg.h"
 #include "psdrv.h"
diff --git a/dlls/wineps/type1afm.c b/dlls/wineps/type1afm.c
index 803bfdf..df8a608 100644
--- a/dlls/wineps/type1afm.c
+++ b/dlls/wineps/type1afm.c
@@ -39,7 +39,7 @@
 #include <float.h>  	    /* FLT_MAX */
 #endif
 
-#include "winnt.h"
+#include "windef.h"
 #include "winerror.h"
 #include "winreg.h"
 #include "psdrv.h"
diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c
index dde45ec..1b7b33f 100644
--- a/dlls/x11drv/xrender.c
+++ b/dlls/x11drv/xrender.c
@@ -27,7 +27,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "wownt32.h"
 #include "x11drv.h"
 #include "bitmap.h"
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index fe1ffc0..7577582 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -24,8 +24,8 @@
 
 #include <string.h>
 
+#include "windef.h"
 #include "bitmap.h"
-#include "winnt.h"
 #include "x11drv.h"
 #include "x11font.h"
 #include "ddrawi.h"
diff --git a/if1632/relay.c b/if1632/relay.c
index d94ec7a..f038f5d 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -25,8 +25,8 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "windef.h"
 #include "wine/winbase16.h"
-#include "winnt.h"
 #include "module.h"
 #include "stackframe.h"
 #include "selectors.h"
diff --git a/include/miscemu.h b/include/miscemu.h
index 311163d..ce3abc3 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -21,7 +21,7 @@
 #ifndef __WINE_MISCEMU_H
 #define __WINE_MISCEMU_H
 
-#include "winnt.h"
+#include "windef.h"
 #include "selectors.h"
 #include "wine/windef16.h"
 
diff --git a/include/msacm.h b/include/msacm.h
index 1fb7a05..a688a02 100644
--- a/include/msacm.h
+++ b/include/msacm.h
@@ -233,6 +233,10 @@
 DECLARE_HANDLE(HACMDRIVER);
 DECLARE_HANDLE(HACMSTREAM);
 DECLARE_HANDLE(HACMOBJ);
+typedef HACMDRIVERID *PHACMDRIVERID, *LPHACMDRIVERID;
+typedef HACMDRIVER   *PHACMDRIVER, *LPHACMDRIVER;
+typedef HACMSTREAM   *PHACMSTREAM, *LPHACMSTREAM;
+typedef HACMOBJ      *PHACMOBJ, *LPHACMOBJ;
 
 /***********************************************************************
  * Callbacks
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h
index d71c742..8658071 100644
--- a/include/msvcrt/stdlib.h
+++ b/include/msvcrt/stdlib.h
@@ -9,7 +9,7 @@
 #define __WINE_STDLIB_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
+#include "basetsd.h"
 #include "msvcrt/malloc.h"                /* For size_t, malloc & co */
 #include "msvcrt/search.h"                /* For bsearch and qsort */
 
diff --git a/include/windef.h b/include/windef.h
index 834ad38..e53d014 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -35,13 +35,144 @@
 # endif /* STRICT */
 #endif /* NO_STRICT */
 
-#include "winnt.h"
-
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* Calling conventions definitions */
+
+#ifdef __i386__
+# ifndef _X86_
+#  define _X86_
+# endif
+# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
+#  define __stdcall __attribute__((__stdcall__))
+#  define __cdecl   __attribute__((__cdecl__))
+# elif defined(_MSC_VER)
+/* Nothing needs to be done. __cdecl/__stdcall already exists */
+# else
+#  error You need gcc >= 2.7 to build Wine on a 386
+# endif  /* __GNUC__ */
+#else  /* __i386__ */
+# define __stdcall
+# define __cdecl
+#endif  /* __i386__ */
+
+#ifndef __WINE__
+
+#ifndef pascal
+#define pascal      __stdcall
+#endif
+#ifndef _pascal
+#define _pascal     __stdcall
+#endif
+#ifndef _stdcall
+#define _stdcall    __stdcall
+#endif
+#ifndef _fastcall
+#define _fastcall   __stdcall
+#endif
+#ifndef __fastcall
+#define __fastcall  __stdcall
+#endif
+#ifndef __export
+#define __export    __stdcall
+#endif
+#ifndef cdecl
+#define cdecl       __cdecl
+#endif
+#ifndef _cdecl
+#define _cdecl      __cdecl
+#endif
+
+#ifndef near
+#define near
+#endif
+#ifndef far
+#define far
+#endif
+#ifndef _near
+#define _near
+#endif
+#ifndef _far
+#define _far
+#endif
+#ifndef NEAR
+#define NEAR
+#endif
+#ifndef FAR
+#define FAR
+#endif
+
+#ifndef _declspec
+#define _declspec(x)
+#endif
+#ifndef __declspec
+#define __declspec(x)
+#endif
+
+#endif /* __WINE__ */
+
+#define CALLBACK    __stdcall
+#define WINAPI      __stdcall
+#define APIPRIVATE  __stdcall
+#define PASCAL      __stdcall
+#define CDECL       __cdecl
+#define _CDECL      __cdecl
+#define WINAPIV     __cdecl
+#define APIENTRY    WINAPI
+#define CONST       const
+
+/* Misc. constants. */
+
+#undef NULL
+#ifdef __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void*)0)
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE 0
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE  1
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#ifndef OPTIONAL
+#define OPTIONAL
+#endif
+
+/* Standard data types */
+
+typedef void                                   *LPVOID;
+typedef const void                             *LPCVOID;
+typedef int             BOOL,       *PBOOL,    *LPBOOL;
+typedef unsigned char   BYTE,       *PBYTE,    *LPBYTE;
+typedef unsigned char   UCHAR,      *PUCHAR;
+typedef unsigned short  WORD,       *PWORD,    *LPWORD;
+typedef unsigned short  USHORT,     *PUSHORT;
+typedef int             INT,        *PINT,     *LPINT;
+typedef unsigned int    UINT,       *PUINT;
+typedef long                                   *LPLONG;
+typedef unsigned long   DWORD,      *PDWORD,   *LPDWORD;
+typedef unsigned long   ULONG,      *PULONG;
+typedef float           FLOAT,      *PFLOAT;
+typedef double          DOUBLE;
+typedef double          DATE;
+
+#include "winnt.h"
 
 /* Macros to map Winelib names to the correct implementation name */
 /* depending on __WINE__ and UNICODE macros.                      */
@@ -76,7 +207,7 @@
 typedef DWORD           COLORREF, *LPCOLORREF;
 
 
-/* Handle types that exist both in Win16 and Win32. */
+/* Handle types */
 
 typedef int HFILE;
 DECLARE_HANDLE(HACCEL);
@@ -91,6 +222,7 @@
 DECLARE_HANDLE(HICON);
 DECLARE_HANDLE(HINSTANCE);
 DECLARE_HANDLE(HKEY);
+typedef HKEY *PHKEY;
 DECLARE_HANDLE(HKL);
 DECLARE_HANDLE(HMENU);
 DECLARE_HANDLE(HMETAFILE);
@@ -140,14 +272,6 @@
 #define SELECTOROF(ptr)     (HIWORD(ptr))
 #define OFFSETOF(ptr)       (LOWORD(ptr))
 
-#ifdef __WINE__
-/* macros to set parts of a DWORD (not in the Windows API) */
-#define SET_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
-#define SET_LOBYTE(dw,val)  ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
-#define SET_HIBYTE(dw,val)  ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
-#define ADD_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
-#endif
-
 /* min and max macros */
 #ifndef NOMINMAX
 #ifndef max
diff --git a/include/wine/exception.h b/include/wine/exception.h
index 8d1421a..49540fa 100644
--- a/include/wine/exception.h
+++ b/include/wine/exception.h
@@ -22,7 +22,7 @@
 #define __WINE_WINE_EXCEPTION_H
 
 #include <setjmp.h>
-#include "winnt.h"
+#include "windef.h"
 
 /* The following definitions allow using exceptions in Wine and Winelib code
  *
diff --git a/include/wine/rpcss_shared.h b/include/wine/rpcss_shared.h
index 11b82f6..2bbb0e8 100644
--- a/include/wine/rpcss_shared.h
+++ b/include/wine/rpcss_shared.h
@@ -22,7 +22,7 @@
 #define __WINE_RPCSS_SHARED_H
 
 #include "basetsd.h"
-#include "winnt.h"
+#include "windef.h"
 
 #include "rpcdcep.h"
 
diff --git a/include/winnt.h b/include/winnt.h
index ca0da52..9630177 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -29,102 +29,7 @@
 #include <string.h>
 #endif
 
-
-/* On Windows winnt.h depends on a few windef.h types and macros and thus
- * is not self-contained. Furthermore windef.h includes winnt.h so that it
- * would be pointless to try to use winnt.h directly.
- * But for Wine and Winelib I decided to make winnt.h self-contained by
- * moving these definitions to winnt.h. It makes no difference to Winelib
- * programs since they are not using winnt.h directly anyway, and it allows
- * us to use winnt.h and get a minimal set of definitions.
- */
-
-/**** Some Wine specific definitions *****/
-
-/* Calling conventions definitions */
-
-#ifdef __i386__
-# ifndef _X86_
-#  define _X86_
-# endif
-# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
-#  define __stdcall __attribute__((__stdcall__))
-#  define __cdecl   __attribute__((__cdecl__))
-# elif defined(_MSC_VER)
-/* Nothing needs to be done. __cdecl/__stdcall already exists */
-# else
-#  error You need gcc >= 2.7 to build Wine on a 386
-# endif  /* __GNUC__ */
-#else  /* __i386__ */
-# define __stdcall
-# define __cdecl
-#endif  /* __i386__ */
-
-#ifndef __WINE__
-
-#ifndef pascal
-#define pascal      __stdcall
-#endif
-#ifndef _pascal
-#define _pascal     __stdcall
-#endif
-#ifndef _stdcall
-#define _stdcall    __stdcall
-#endif
-#ifndef _fastcall
-#define _fastcall   __stdcall
-#endif
-#ifndef __fastcall
-#define __fastcall  __stdcall
-#endif
-#ifndef __export
-#define __export    __stdcall
-#endif
-#ifndef cdecl
-#define cdecl       __cdecl
-#endif
-#ifndef _cdecl
-#define _cdecl      __cdecl
-#endif
-
-#ifndef near
-#define near
-#endif
-#ifndef far
-#define far
-#endif
-#ifndef _near
-#define _near
-#endif
-#ifndef _far
-#define _far
-#endif
-#ifndef NEAR
-#define NEAR
-#endif
-#ifndef FAR
-#define FAR
-#endif
-
-#ifndef _declspec
-#define _declspec(x)
-#endif
-#ifndef __declspec
-#define __declspec(x)
-#endif
-
-#endif /* __WINE__ */
-
-#define CALLBACK    __stdcall
-#define WINAPI      __stdcall
-#define NTAPI       __stdcall
-#define APIPRIVATE  __stdcall
-#define PASCAL      __stdcall
-#define CDECL       __cdecl
-#define _CDECL      __cdecl
-#define WINAPIV     __cdecl
-#define APIENTRY    WINAPI
-#define CONST       const
+#define NTAPI __stdcall
 
 /* Macro for structure packing and more. */
 
@@ -346,39 +251,6 @@
 # define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1]
 #endif
 
-/**** Parts of windef.h that are needed here *****/
-
-/* Misc. constants. */
-
-#undef NULL
-#ifdef __cplusplus
-#define NULL  0
-#else
-#define NULL  ((void*)0)
-#endif
-
-#ifdef FALSE
-#undef FALSE
-#endif
-#define FALSE 0
-
-#ifdef TRUE
-#undef TRUE
-#endif
-#define TRUE  1
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef OPTIONAL
-#define OPTIONAL
-#endif
-
 /* Error Masks */
 #define APPLICATION_ERROR_MASK       0x20000000
 #define ERROR_SEVERITY_SUCCESS       0x00000000
@@ -386,24 +258,6 @@
 #define ERROR_SEVERITY_WARNING       0x80000000
 #define ERROR_SEVERITY_ERROR         0xC0000000
 
-/* Standard data types */
-typedef const void                             *LPCVOID;
-typedef int             BOOL,       *PBOOL,    *LPBOOL;
-typedef unsigned char   BYTE,       *PBYTE,    *LPBYTE;
-typedef unsigned char   UCHAR,      *PUCHAR;
-typedef unsigned short  USHORT,     *PUSHORT;
-typedef unsigned short  WORD,       *PWORD,    *LPWORD;
-typedef int             INT,        *PINT,     *LPINT;
-typedef unsigned int    UINT,       *PUINT;
-typedef unsigned long   DWORD,      *PDWORD,   *LPDWORD;
-typedef unsigned long   ULONG,      *PULONG;
-typedef float           FLOAT,      *PFLOAT;
-typedef double          DOUBLE;
-typedef double          DATE;
-
-
-/**** winnt.h proper *****/
-
 /* Microsoft's macros for declaring functions */
 
 #ifdef __cplusplus
@@ -432,11 +286,11 @@
 #ifndef VOID
 #define VOID void
 #endif
-typedef VOID           *PVOID,      *LPVOID;
+typedef VOID           *PVOID;
 typedef BYTE            BOOLEAN,    *PBOOLEAN;
 typedef char            CHAR,       *PCHAR;
 typedef short           SHORT,      *PSHORT;
-typedef long            LONG,       *PLONG,    *LPLONG;
+typedef long            LONG,       *PLONG;
 
 /* Some systems might have wchar_t, but we really need 16 bit characters */
 #ifndef WINE_WCHAR_DEFINED
@@ -542,14 +396,10 @@
 typedef void *HANDLE;
 typedef HANDLE *PHANDLE, *LPHANDLE;
 
-#if (defined(STRICT) || defined(__WINE__))
-#define DECLARE_HANDLE(a) \
-    typedef struct a##__ { int unused; } *a; \
-    typedef a *P##a
+#ifdef STRICT
+#define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a;
 #else /*STRICT*/
-#define DECLARE_HANDLE(a) \
-    typedef HANDLE a; \
-    typedef a *P##a
+#define DECLARE_HANDLE(a) typedef HANDLE a;
 #endif /*STRICT*/
 
 /* Defines */
diff --git a/library/loader.c b/library/loader.c
index 54e01fb..1f80827 100644
--- a/library/loader.c
+++ b/library/loader.c
@@ -30,7 +30,7 @@
 #include <sys/mman.h>
 #endif
 
-#include "winnt.h"
+#include "windef.h"
 #include "wine/library.h"
 
 /* argc/argv for the Windows application */
diff --git a/memory/instr.c b/memory/instr.c
index d2c93e9..f56c488 100644
--- a/memory/instr.c
+++ b/memory/instr.c
@@ -32,6 +32,11 @@
 
 #ifdef __i386__
 
+/* macros to set parts of a DWORD */
+#define SET_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
+#define SET_LOBYTE(dw,val)  ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
+#define ADD_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
+
 inline static void add_stack( CONTEXT86 *context, int offset )
 {
     if (ISV86(context) || !IS_SELECTOR_32BIT(context->SegSs))
diff --git a/misc/registry.c b/misc/registry.c
index a986832..60607fc 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -50,8 +50,8 @@
 # include <sys/mman.h>
 #endif
 
+#include "windef.h"
 #include "winerror.h"
-#include "winnt.h"
 #include "winreg.h"
 
 #include "wine/winbase16.h"
diff --git a/relay32/relay386.c b/relay32/relay386.c
index 1024bed..18523c6 100644
--- a/relay32/relay386.c
+++ b/relay32/relay386.c
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winternl.h"
 #include "stackframe.h"
 #include "module.h"
diff --git a/server/change.c b/server/change.c
index daa0cad..a631642 100644
--- a/server/change.c
+++ b/server/change.c
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "winnt.h"
+#include "windef.h"
 
 #include "handle.h"
 #include "thread.h"
diff --git a/server/event.c b/server/event.c
index da833d9..b223487 100644
--- a/server/event.c
+++ b/server/event.c
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "winnt.h"
+#include "windef.h"
 
 #include "handle.h"
 #include "thread.h"
diff --git a/server/mapping.c b/server/mapping.c
index 190e4ae..b7b055c 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "winnt.h"
 #include "winbase.h"
 
 #include "handle.h"
diff --git a/server/mutex.c b/server/mutex.c
index f38fd8d..fe76553 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "winnt.h"
+#include "windef.h"
 
 #include "handle.h"
 #include "thread.h"
diff --git a/server/registry.c b/server/registry.c
index 77ddf9f..5c23906 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -44,7 +44,6 @@
 
 #include "winbase.h"
 #include "winreg.h"
-#include "winnt.h" /* registry definitions */
 #include "winternl.h"
 #include "wine/library.h"
 
diff --git a/server/request.c b/server/request.c
index 66c1b11..ff1450b 100644
--- a/server/request.c
+++ b/server/request.c
@@ -43,7 +43,7 @@
 #include <sys/un.h>
 #include <unistd.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winbase.h"
 #include "wincon.h"
 #include "wine/library.h"
diff --git a/server/semaphore.c b/server/semaphore.c
index 4e7e6b6..ee90988 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "winnt.h"
+#include "windef.h"
 
 #include "handle.h"
 #include "thread.h"
diff --git a/server/timer.c b/server/timer.c
index 8b7eb8f..ddc137d 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -27,7 +27,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "handle.h"
 #include "request.h"
 
diff --git a/server/trace.c b/server/trace.c
index 6412212..322aeb4 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -26,7 +26,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winbase.h"
 #include "wincon.h"
 #include "request.h"
diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c
index 988a8b3..2ead49b 100644
--- a/tools/winedump/debug.c
+++ b/tools/winedump/debug.c
@@ -40,7 +40,7 @@
 #endif
 #include <fcntl.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winedump.h"
 #include "pe.h"
 #include "cvinclude.h"
diff --git a/tools/winedump/ne.c b/tools/winedump/ne.c
index e2352ce..147fa29 100644
--- a/tools/winedump/ne.c
+++ b/tools/winedump/ne.c
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winbase.h"
 #include "wine/winbase16.h"
 #include "winedump.h"
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index f4e9264..e890620 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -38,7 +38,7 @@
 #endif
 #include <fcntl.h>
 
-#include "winnt.h"
+#include "windef.h"
 #include "winedump.h"
 #include "pe.h"