diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
index 2a0e3467905ea22eedcf91a34e4e22c9d9e8bd1d..9de440c35ffa3eab0e643a8738af221c3cb7aa41 100644
--- a/dlls/winex11.drv/Makefile.in
+++ b/dlls/winex11.drv/Makefile.in
@@ -1,9 +1,10 @@
 EXTRADEFS = -DWINE_NO_LONG_TYPES
 MODULE    = winex11.drv
+UNIXLIB   = winex11.so
 IMPORTS   = uuid user32 gdi32 win32u
 DELAYIMPORTS = comctl32 ole32 shell32 imm32
 EXTRAINCL = $(X_CFLAGS)
-EXTRALIBS = $(X_LIBS) $(X_EXTRA_LIBS) $(PTHREAD_LIBS)
+EXTRALIBS = -lwin32u $(X_LIBS) $(X_EXTRA_LIBS) $(PTHREAD_LIBS) -lm
 
 EXTRADLLFLAGS = -mcygwin
 
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index e21f975ef4a90d0b3e71de6604e992387c661cc4..d1e6407d87cf0210c44aeafa7b7061e610703bda 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <assert.h>
diff --git a/dlls/winex11.drv/brush.c b/dlls/winex11.drv/brush.c
index 1ade09bd4bea187983b1889575d8ab471f573a42..2a2e8ef4e989cf21133c70f9f12ac465554337e1 100644
--- a/dlls/winex11.drv/brush.c
+++ b/dlls/winex11.drv/brush.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdlib.h>
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index 276eee9b4dd1bebc8f6d9b81e7cf9bc9a369aaa5..feb9eb487e579ede3b60b0083a1d00ece51fdd7a 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -63,6 +63,10 @@
  * FIXME: global format list needs a critical section
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <string.h>
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index 20f4063c343eefa855b4e17264c102426f996d12..bc2ba60397bda0145094c5d61dd7398e2ff33b2f 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 #include <X11/cursorfont.h>
 #include <X11/Xlib.h>
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index aef4ed0b5b09b40be5af03531aa3dec4b89e67f7..510cb9dcee690c8cf8b86f40ed2b6ef3146089ba 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 #include "x11drv.h"
 #include "wine/debug.h"
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c
index 2a361c477f4f935a935bc78fb0237e39a7497f9e..1f1d98903bcc07cfa46f4e16317977246bc207a5 100644
--- a/dlls/winex11.drv/dllmain.c
+++ b/dlls/winex11.drv/dllmain.c
@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
 
 
 HMODULE x11drv_module = 0;
+static unixlib_handle_t x11drv_handle;
+NTSTATUS (CDECL *x11drv_unix_call)( enum x11drv_funcs code, void *params );
 
 /**************************************************************************
  *		wait_clipboard_mutex
@@ -198,15 +200,27 @@ C_ASSERT( NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func
 BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
 {
     void **callback_table;
+    struct init_params params =
+    {
+        NtWaitForMultipleObjects,
+        foreign_window_proc,
+    };
 
     if (reason != DLL_PROCESS_ATTACH) return TRUE;
 
     DisableThreadLibraryCalls( instance );
     x11drv_module = instance;
-    if (X11DRV_CALL( init, NULL )) return FALSE;
+    if (NtQueryVirtualMemory( GetCurrentProcess(), instance, MemoryWineUnixFuncs,
+                              &x11drv_handle, sizeof(x11drv_handle), NULL ))
+        return FALSE;
+
+    if (__wine_unix_call( x11drv_handle, unix_init, &params )) return FALSE;
 
     callback_table = NtCurrentTeb()->Peb->KernelCallbackTable;
     memcpy( callback_table + NtUserDriverCallbackFirst, kernel_callbacks, sizeof(kernel_callbacks) );
+
+    show_systray = params.show_systray;
+    x11drv_unix_call = params.unix_call;
     return TRUE;
 }
 
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index d5e7127ceed9b5dfa8a8b60976d30367f6b60562..cbab1dcfe1355d57e6bb215e248cb6c6a371fd34 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <poll.h>
@@ -485,8 +489,8 @@ NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
     if (!data)
     {
         if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
-        return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
-                                         !!(flags & MWMO_ALERTABLE), timeout );
+        return pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
+                                          !!(flags & MWMO_ALERTABLE), timeout );
     }
 
     if (data->current_event) mask = 0;  /* don't process nested events */
@@ -494,8 +498,8 @@ NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
     if (process_events( data->display, filter_event, mask )) ret = count - 1;
     else if (count || !timeout || timeout->QuadPart)
     {
-        ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
-                                        !!(flags & MWMO_ALERTABLE), timeout );
+        ret = pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
+                                         !!(flags & MWMO_ALERTABLE), timeout );
         if (ret == count - 1) process_events( data->display, filter_event, mask );
     }
     else ret = WAIT_TIMEOUT;
diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c
index 7ab358c43c1fc85fe0ab1e191624f9e8a1fe17c6..18d7c6e9adc738d74c3780bdcf1df9f49ec6b1c3 100644
--- a/dlls/winex11.drv/graphics.c
+++ b/dlls/winex11.drv/graphics.c
@@ -24,6 +24,10 @@
  * graphics mode
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 27e070ef9b4cc274bf9ae702cd33e89cd373466a..a1dbfa1ed50775c04aff80599687562cec9702b9 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index ff43939a85839a48d7a86fe865d29b0bc6e4d953..efd8f03eae165f3cafb1d91190d7e7f1e5dea10e 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -23,6 +23,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <X11/Xatom.h>
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index adf23d044505e83cbe433b37e2285a87ef9defa2..458bd469caa1567977b33c4f39cb19af1bfac926 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <math.h>
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 92555841f714c19caf7d6402243701f9b6476e97..91aef7f67beaff359382f22df81bb0f7420dac85 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -23,6 +23,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <assert.h>
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
index 475466999b1f46f92b1fd3e975f296afa3892dc1..7845985dbb06224bb82c6457bd238a8c5d3ce8b9 100644
--- a/dlls/winex11.drv/palette.c
+++ b/dlls/winex11.drv/palette.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
diff --git a/dlls/winex11.drv/pen.c b/dlls/winex11.drv/pen.c
index ffa628ce6f7f67ca4b5d90d5dffca69d0a93c121..a32bf4752e155698e73508a903ee979fa19ecfb9 100644
--- a/dlls/winex11.drv/pen.c
+++ b/dlls/winex11.drv/pen.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include "x11drv.h"
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
index 3e83e467c63a572f7207d3bbec542e4e7abb71e1..9fffc9c0b0a53f08bd3be956da57d32cf29bf041 100644
--- a/dlls/winex11.drv/settings.c
+++ b/dlls/winex11.drv/settings.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 #include <stdlib.h>
 
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index 1c6616e0d9c407e707e6035e6d5cd782862c3a98..961ec05a7dc8bc6a4f645ffbe79a45a4d5525684 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -44,6 +44,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(systray);
 
+BOOL show_systray = TRUE;
+
 /* an individual systray icon */
 struct tray_icon
 {
diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h
index f3f6b9b8f06945466b2657b2eb8d4b5452fb00f0..9be7c18cd12e7cb680c8a3de7d18ef6416987057 100644
--- a/dlls/winex11.drv/unixlib.h
+++ b/dlls/winex11.drv/unixlib.h
@@ -38,7 +38,7 @@ enum x11drv_funcs
 };
 
 /* FIXME: Use __wine_unix_call when the rest of the stack is ready */
-extern NTSTATUS x11drv_unix_call( enum x11drv_funcs code, void *params ) DECLSPEC_HIDDEN;
+extern NTSTATUS (CDECL *x11drv_unix_call)( enum x11drv_funcs code, void *params ) DECLSPEC_HIDDEN;
 #define X11DRV_CALL(func, params) x11drv_unix_call( unix_ ## func, params )
 
 /* x11drv_clipboard_message params */
@@ -57,6 +57,15 @@ struct create_desktop_params
     UINT height;
 };
 
+/* x11drv_init params */
+struct init_params
+{
+    NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
+    WNDPROC foreign_window_proc;
+    BOOL show_systray;
+    NTSTATUS (CDECL *unix_call)( enum x11drv_funcs code, void *params );
+};
+
 struct systray_dock_params
 {
     UINT64 event_handle;
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 0f96b6860fd8e7b8b554bed74ae580e67f9dc695..101504a78870b87ebd686940fb9c294aef74e4ef 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -20,6 +20,10 @@
 /* NOTE: If making changes here, consider whether they should be reflected in
  * the other drivers. */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index a62a3e84e81e696b5e493532d00c1f4398bf4055..4506ba9c036078437ca74eb8d0dd8c5536dc8146 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -20,6 +20,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
@@ -2016,7 +2020,7 @@ HWND create_foreign_window( Display *display, Window xwin )
 
         memset( &class, 0, sizeof(class) );
         class.cbSize        = sizeof(class);
-        class.lpfnWndProc   = foreign_window_proc;
+        class.lpfnWndProc   = client_foreign_window_proc;
         class.lpszClassName = classW;
         RtlInitUnicodeString( &class_name, classW );
         if (!NtUserRegisterClassExWOW( &class, &class_name, &version, NULL, 0, 0, NULL ) &&
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index a6b80daedbefa3a4e634e8d04b73c47dec454dec..ceb5e7276d6092b87f94951dab81f010cec3ebdb 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdlib.h>
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 5540a6ebbb58d49eb9270ad993c962e43636a8a8..56c141a018d19a8011fe2b2f202c8396f38425d4 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -62,8 +62,8 @@ typedef int Status;
 #include "ntgdi.h"
 #include "wine/gdi_driver.h"
 #include "unixlib.h"
-#include "winnls.h"
 #include "wine/list.h"
+#include "wine/unicode.h"
 
 #define MAX_DASHLEN 16
 
@@ -438,6 +438,10 @@ extern int xrender_error_base DECLSPEC_HIDDEN;
 extern HMODULE x11drv_module DECLSPEC_HIDDEN;
 extern char *process_name DECLSPEC_HIDDEN;
 extern Display *clipboard_display DECLSPEC_HIDDEN;
+extern WNDPROC client_foreign_window_proc;
+
+extern NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,
+                                                    BOOLEAN,const LARGE_INTEGER*) DECLSPEC_HIDDEN;
 
 /* atoms */
 
@@ -937,18 +941,54 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src )
     return (p - dst) * sizeof(WCHAR);
 }
 
-/* FIXME: remove once we may use ntdll.so version */
-
-static inline DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen )
-{
-    return MultiByteToWideChar( CP_UNIXCP, 0, src, srclen, dst, dstlen );
-}
-
-static inline int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict )
-{
-    return WideCharToMultiByte( CP_UNIXCP, 0, src, srclen, dst, dstlen, NULL, NULL );
+static inline LONG x11drv_wcstol( LPCWSTR s, LPWSTR *end, INT base )
+{
+    BOOL negative = FALSE, empty = TRUE;
+    LONG ret = 0;
+
+    if (base < 0 || base == 1 || base > 36) return 0;
+    if (end) *end = (WCHAR *)s;
+    while (*s == ' ' || *s == '\t') s++;
+
+    if (*s == '-')
+    {
+        negative = TRUE;
+        s++;
+    }
+    else if (*s == '+') s++;
+
+    if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
+    {
+        base = 16;
+        s += 2;
+    }
+    if (base == 0) base = s[0] != '0' ? 10 : 8;
+
+    while (*s)
+    {
+        int v;
+
+        if ('0' <= *s && *s <= '9') v = *s - '0';
+        else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
+        else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
+        else break;
+        if (v >= base) break;
+        if (negative) v = -v;
+        s++;
+        empty = FALSE;
+
+        if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v))
+            ret = MAXLONG;
+        else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v)))
+            ret = MINLONG;
+        else
+            ret = ret * base + v;
+    }
+
+    if (end && !empty) *end = (WCHAR *)s;
+    return ret;
 }
 
-#define wcsicmp lstrcmpiW
+#define strtolW x11drv_wcstol
 
 #endif  /* __WINE_X11DRV_H */
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index cbcfc659a67e9ddb758ea50dbc0bbc5280c7fcb8..e358e92e5fecd2e6800fddadc4611f48596c59cb 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <fcntl.h>
@@ -84,6 +88,7 @@ int copy_default_colors = 128;
 int alloc_system_colors = 256;
 int xrender_error_base = 0;
 char *process_name = NULL;
+WNDPROC client_foreign_window_proc = NULL;
 
 static x11drv_error_callback err_callback;   /* current callback for error */
 static Display *err_callback_display;        /* display callback is set for */
@@ -204,6 +209,16 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
     "text/uri-list"
 };
 
+/* We use use pointer to call NtWaitForMultipleObjects to make it go through
+ * syscall dispatcher. We need that because win32u bypasses syscall thunks and
+ * if we called NtWaitForMultipleObjects directly, it wouldn't be able to handle
+ * user APCs. This will be removed as soon as we may use syscall interface
+ * for NtUserMsgWaitForMultipleObjectsEx. */
+NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG, const HANDLE *, BOOLEAN,
+                                              BOOLEAN, const LARGE_INTEGER* );
+
+static NTSTATUS CDECL unix_call( enum x11drv_funcs code, void *params );
+
 /***********************************************************************
  *		ignore_error
  *
@@ -636,6 +651,7 @@ static void init_visuals( Display *display, int screen )
  */
 static NTSTATUS x11drv_init( void *arg )
 {
+    struct init_params *params = arg;
     Display *display;
     void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL );
 
@@ -657,6 +673,9 @@ static NTSTATUS x11drv_init( void *arg )
     if (!XInitThreads()) ERR( "XInitThreads failed, trouble ahead\n" );
     if (!(display = XOpenDisplay( NULL ))) return STATUS_UNSUCCESSFUL;
 
+    pNtWaitForMultipleObjects = params->pNtWaitForMultipleObjects;
+    client_foreign_window_proc = params->foreign_window_proc;
+
     fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */
     root_window = DefaultRootWindow( display );
     gdi_display = display;
@@ -693,6 +712,8 @@ static NTSTATUS x11drv_init( void *arg )
 
     init_user_driver();
     X11DRV_DisplayDevices_Init(FALSE);
+    params->show_systray = show_systray;
+    params->unix_call = unix_call;
     return STATUS_SUCCESS;
 }
 
@@ -960,9 +981,9 @@ NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDP
 
 NTSTATUS x11drv_client_func( enum x11drv_client_funcs id, const void *params, ULONG size )
 {
-    /* FIXME: use KeUserModeCallback instead */
-    NTSTATUS (WINAPI *func)( const void *, ULONG ) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
-    return func( params, size );
+    void *ret_ptr;
+    ULONG ret_len;
+    return KeUserModeCallback( id, params, size, &ret_ptr, &ret_len );
 }
 
 
@@ -995,7 +1016,7 @@ C_ASSERT( ARRAYSIZE(__wine_unix_call_funcs) == unix_funcs_count );
 
 
 /* FIXME: Use __wine_unix_call instead */
-NTSTATUS x11drv_unix_call( enum x11drv_funcs code, void *params )
+static NTSTATUS CDECL unix_call( enum x11drv_funcs code, void *params )
 {
     return __wine_unix_call_funcs[code]( params );
 }
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c
index 595fb31fe0bee1a3f08208c059abdf4a4d283342..d2166697386b57f6cd3a4f3c40dd5fac72b88581 100644
--- a/dlls/winex11.drv/xim.c
+++ b/dlls/winex11.drv/xim.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index a97590e705f239b984287b2793c1c8f993dfac7e..847b8fb6efbb576c4f7883a2bfe3d5a813b23ab3 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <stdarg.h>
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index eec7a81a4cb5d7b410aa5ee62d32431634ba511e..152a9f357340ea3bd601f34cca8418c3a009ac0b 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -20,6 +20,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #define NONAMELESSSTRUCT
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 33725338f6079cd0910efdf4787f72f87d7eb7eb..407e58d6eda4d5c0e0487efaf872c4b520e68757 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -23,6 +23,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <assert.h>
diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c
index a51ded9fe4af89cd065a417fab09f0542ef7740d..4ca7bc1ac5992e0fde9e9bba773d3db15de81589 100644
--- a/dlls/winex11.drv/xvidmode.c
+++ b/dlls/winex11.drv/xvidmode.c
@@ -19,6 +19,10 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#if 0
+#pragma makedep unix
+#endif
+
 #include "config.h"
 
 #include <assert.h>
diff --git a/tools/winewrapper b/tools/winewrapper
index 93d44bcd06ceb2cab9f6bfa924fe9bea3a574d71..031a0c05f69a04d9941adf04f4c0ff9885a7f374 100755
--- a/tools/winewrapper
+++ b/tools/winewrapper
@@ -69,9 +69,9 @@ if [ "`uname -s`" = "Darwin" ]
 then
   if [ -n "$DYLD_LIBRARY_PATH" ]
   then
-    DYLD_LIBRARY_PATH="$topdir/libs/wine:$topdir/dlls/ntdll:$DYLD_LIBRARY_PATH"
+    DYLD_LIBRARY_PATH="$topdir/libs/wine:$topdir/dlls/ntdll:$topdir/dlls/win32u:$DYLD_LIBRARY_PATH"
   else
-    DYLD_LIBRARY_PATH="$topdir/libs/wine:$topdir/dlls/ntdll"
+    DYLD_LIBRARY_PATH="$topdir/libs/wine:$topdir/dlls/ntdll:$topdir/dlls/win32u"
   fi
   export DYLD_LIBRARY_PATH
 else