winbase.h shouldn't be included when compiling ntdll, as it is the header for kernel32.dll.
The attached patch removes winbase.h from the server call headers, exposing a number of dependency problems in ntdll.
wine_server_call_err seems to be misplaced in wine/server.h as it uses kernel32.SetLastError(), and it is the only function which requires winebase.h to be included. Perhaps it should be converted to a macro or only defined when winbase.h is already included, as I have done in this patch?
Mike
diff --git a/dlls/ntdll/atom.c b/dlls/ntdll/atom.c index 9ea72c5..b74ea34 100644 --- a/dlls/ntdll/atom.c +++ b/dlls/ntdll/atom.c @@ -31,6 +31,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" /* FIXME: MAXINTATOM */ #include "wine/server.h" #include "wine/unicode.h" diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index beb2962..16a231e 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -93,10 +93,10 @@ #include "ntddstor.h" #include "ntddcdrm.h" #include "ntddscsi.h" -#include "ntdll_misc.h" #include "wine/server.h" #include "wine/library.h" #include "wine/debug.h" +#include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(cdrom); diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index c1677b6..938b5a5 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -35,6 +35,7 @@ #include "wine/list.h" #include "wine/debug.h" #include "excpt.h" +#include "winbase.h" #include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(seh); diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index b0739e2..715d3aa 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -67,9 +67,9 @@ #define NONAMELESSSTRUCT #include "ntstatus.h" #define WIN32_NO_STATUS +#include "thread.h" #include "wine/unicode.h" #include "wine/debug.h" -#include "thread.h" #include "wine/server.h" #include "ntdll_misc.h" diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 7adf547..d658d42 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -41,6 +41,7 @@ #include "wine/list.h" #include "wine/debug.h" #include "wine/server.h" +#include "winbase.h" WINE_DEFAULT_DEBUG_CHANNEL(heap); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 47cc1da..660f228 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -41,6 +41,7 @@ #include "wine/unicode.h" #include "wine/debug.h" #include "wine/server.h" +#include "winbase.h" /* FIXME: for DONT_RESOLVE_DLL_REFERENCES */ #include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(module); diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c index 8f4f158..9038be3 100644 --- a/dlls/ntdll/loadorder.c +++ b/dlls/ntdll/loadorder.c @@ -29,11 +29,11 @@ #include "windef.h" #include "winternl.h" -#include "ntdll_misc.h" #include "module.h" #include "wine/debug.h" #include "wine/unicode.h" +#include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(module); diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c index c46845a..c1b9ad7 100644 --- a/dlls/ntdll/om.c +++ b/dlls/ntdll/om.c @@ -36,6 +36,7 @@ #include "wine/debug.h" #include "windef.h" #include "winternl.h" +#include "winbase.h" /* FIXME: for HANDLE_FLAG_* */ #include "ntdll_misc.h" #include "wine/server.h" diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index d05d9c7..5c70f86 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -36,6 +36,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "wine/library.h" +#include "winbase.h" /* FIXME: for OPEN_EXISTING */ #include "ntdll_misc.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c index 8fd21f7..07b8ecd 100644 --- a/dlls/ntdll/sec.c +++ b/dlls/ntdll/sec.c @@ -36,6 +36,7 @@ #define WIN32_NO_STATUS #include "windef.h" #include "wine/exception.h" +#include "winbase.h" /* FIXME: for GetCurrentThread/Process */ #include "ntdll_misc.h" #include "excpt.h" #include "wine/library.h" diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index 0b15f6e..845beba 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -71,10 +71,10 @@ #include "winternl.h" #include "winioctl.h" #include "ddk/ntddser.h" -#include "ntdll_misc.h" #include "wine/server.h" #include "wine/library.h" #include "wine/debug.h" +#include "ntdll_misc.h" #ifdef HAVE_LINUX_SERIAL_H #include <linux/serial.h> diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 88c0015..099567d 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -59,6 +59,7 @@ #include "wine/pthread.h" #include "wine/server.h" #include "wine/debug.h" +#include "winbase.h" /* FIXME: for GetCurrentProcess */ #include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(server); diff --git a/dlls/x11drv/clipboard.c b/dlls/x11drv/clipboard.c diff --git a/include/wine/server.h b/include/wine/server.h index 4f7ed68..bad4e85 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -23,8 +23,6 @@ #include <stdarg.h> #include <windef.h> -#include <winbase.h> -#include <winternl.h> #include <wine/server_protocol.h> /* client communication functions */ @@ -55,6 +53,8 @@ extern int wine_server_fd_to_handle( int extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags ); extern void wine_server_release_fd( obj_handle_t handle, int unix_fd ); +#if defined(__WINE_WINBASE_H) +#include <winternl.h> /* do a server call and set the last error code */ inline static unsigned int wine_server_call_err( void *req_ptr ) { @@ -62,6 +62,7 @@ inline static unsigned int wine_server_c if (res) SetLastError( RtlNtStatusToDosError(res) ); return res; } +#endif /* get the size of the variable part of the returned reply */ inline static size_t wine_server_reply_size( const void *reply ) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 4ab1467..124a369 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -13,7 +13,6 @@ #include <time.h> #include <windef.h> -#include <winbase.h> struct request_header { diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index 83fedf5..f063197 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -22,6 +22,9 @@ #include "wine/port.h" #include <stdio.h> +#include <stdarg.h> +#include "windef.h" +#include "winbase.h" #include "wine/server.h" #include "winecon_private.h" #include "winnls.h" diff --git a/server/atom.c b/server/atom.c index 18a59db..c6903be 100644 --- a/server/atom.c +++ b/server/atom.c @@ -36,9 +36,11 @@ #include "process.h" #include "handle.h" #include "user.h" +#include "winbase.h" /* FIXME: for LPSECURITY_ATTRIBUTES */ #include "winuser.h" #include "winternl.h" + #define HASH_SIZE 37 #define MIN_HASH_SIZE 4 #define MAX_HASH_SIZE 0x200 diff --git a/server/class.c b/server/class.c index d483aef..a0c6659 100644 --- a/server/class.c +++ b/server/class.c @@ -36,6 +36,7 @@ #include "object.h" #include "process.h" #include "user.h" +#include "winbase.h" /* FIXME: for LPSECURITY_ATTRIBUTES and ERROR_* */ #include "winuser.h" #include "winternl.h" diff --git a/server/clipboard.c b/server/clipboard.c index 3963885..5ffe813 100644 --- a/server/clipboard.c +++ b/server/clipboard.c @@ -31,6 +31,7 @@ #include "request.h" #include "object.h" #include "user.h" +#include "winbase.h" /* FIXME: for LPSECURITY_ATTRIBUTES and ERROR_* */ #include "winuser.h" #include "winternl.h" diff --git a/server/console.c b/server/console.c index f6b97bd..ee1a4e5 100644 --- a/server/console.c +++ b/server/console.c @@ -35,6 +35,7 @@ #include "process.h" #include "request.h" #include "unicode.h" +#include "winbase.h" /* FIXME: for LPSECURITY_ATTRIBUTES */ #include "console.h" #include "winternl.h" diff --git a/server/debugger.c b/server/debugger.c index e326516..78071a3 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -30,6 +30,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" #include "winternl.h" #include "handle.h" diff --git a/server/file.c b/server/file.c index 84215c5..f94e890 100644 --- a/server/file.c +++ b/server/file.c @@ -46,6 +46,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" /* FIXME: for ERROR_SEEK */ #include "winternl.h" #include "file.h" diff --git a/server/handle.c b/server/handle.c index 375539f..f63a8db 100644 --- a/server/handle.c +++ b/server/handle.c @@ -31,6 +31,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" #include "winternl.h" #include "handle.h" diff --git a/server/named_pipe.c b/server/named_pipe.c index ef298bb..10d47f6 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -45,6 +45,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" /* FIXME: NMPWAIT_* */ #include "winternl.h" #include "file.h" diff --git a/server/process.c b/server/process.c index cdc0461..6bc2f1f 100644 --- a/server/process.c +++ b/server/process.c @@ -39,6 +39,8 @@ #include "ntstatus.h" #define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" #include "winternl.h" #include "file.h" diff --git a/server/thread.c b/server/thread.c index 1c00ce7..a29b635 100644 --- a/server/thread.c +++ b/server/thread.c @@ -39,6 +39,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" +#include "winbase.h" #include "winternl.h" #include "file.h"