Commit 435e2e63 authored by Alexandre Julliard's avatar Alexandre Julliard

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.
parent 3144b3c8
......@@ -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"
......
......@@ -21,7 +21,6 @@
#include "config.h"
#include "wine/port.h"
#include "winnt.h"
#include "winbase.h"
#include "winuser.h"
......
......@@ -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"
......
......@@ -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"
/*
......
......@@ -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"
......
......@@ -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"
......
......@@ -45,7 +45,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#include <stdlib.h>
#include <winnt.h> /* DateToTm use */
#include "windef.h" /* DateToTm use */
/* ----------------------------------------------------------------
* Section 1: bool, true, false, TRUE, FALSE
......
......@@ -1127,7 +1127,7 @@ BOOL WINAPI SHLWAPI_171(LPVOID x, LPVOID y)
* 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,
......
......@@ -52,7 +52,7 @@
#ifndef TWAIN
#define TWAIN
#include "winnt.h"
#include "windef.h"
#define FAR
#define huge
......
......@@ -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);
......
......@@ -20,7 +20,7 @@
#include "config.h"
#include "winnt.h"
#include "windef.h"
#include "miscemu.h"
#include "dosexe.h"
......
......@@ -697,12 +697,12 @@ void WINAPI DOSVM_AllocRMCB( CONTEXT86 *context )
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 @@ void WINAPI DOSVM_FreeRMCB( CONTEXT86 *context )
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);
}
}
......
......@@ -122,7 +122,7 @@ void WINAPI DOSVM_EmulateInterruptPM( CONTEXT86 *context, BYTE intnum )
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));
}
/**********************************************************************
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -233,6 +233,10 @@ DECLARE_HANDLE(HACMDRIVERID);
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
......
......@@ -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 */
......
......@@ -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
extern "C" {
#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 WORD *LPCATCHBUF;
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(HHOOK);
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 @@ typedef INT (CALLBACK *PROC)();
#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
......
......@@ -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
*
......
......@@ -22,7 +22,7 @@
#define __WINE_RPCSS_SHARED_H
#include "basetsd.h"
#include "winnt.h"
#include "windef.h"
#include "rpcdcep.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 @@ typedef double DATE;
#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 DWORD EXECUTION_STATE;
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 */
......
......@@ -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 */
......
......@@ -32,6 +32,11 @@ WINE_DECLARE_DEBUG_CHANNEL(io);
#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))
......
......@@ -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"
......
......@@ -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"
......
......@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "winnt.h"
#include "windef.h"
#include "handle.h"
#include "thread.h"
......
......@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "winnt.h"
#include "windef.h"
#include "handle.h"
#include "thread.h"
......
......@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "winnt.h"
#include "winbase.h"
#include "handle.h"
......
......@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "winnt.h"
#include "windef.h"
#include "handle.h"
#include "thread.h"
......
......@@ -44,7 +44,6 @@
#include "winbase.h"
#include "winreg.h"
#include "winnt.h" /* registry definitions */
#include "winternl.h"
#include "wine/library.h"
......
......@@ -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"
......
......@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "winnt.h"
#include "windef.h"
#include "handle.h"
#include "thread.h"
......
......@@ -27,7 +27,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include "winnt.h"
#include "windef.h"
#include "handle.h"
#include "request.h"
......
......@@ -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"
......
......@@ -40,7 +40,7 @@
#endif
#include <fcntl.h>
#include "winnt.h"
#include "windef.h"
#include "winedump.h"
#include "pe.h"
#include "cvinclude.h"
......
......@@ -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"
......
......@@ -38,7 +38,7 @@
#endif
#include <fcntl.h>
#include "winnt.h"
#include "windef.h"
#include "winedump.h"
#include "pe.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment