Jacek Caban : winex11: Directly use ntdll in more places.

Alexandre Julliard julliard at winehq.org
Tue May 3 15:39:24 CDT 2022


Module: wine
Branch: master
Commit: c736411fb897444609fd539d0a110772a292daca
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c736411fb897444609fd539d0a110772a292daca

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May  2 00:21:21 2022 +0200

winex11: Directly use ntdll in more places.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/event.c       |  6 +++---
 dlls/winex11.drv/keyboard.c    |  6 +++---
 dlls/winex11.drv/mouse.c       | 10 +++++-----
 dlls/winex11.drv/vulkan.c      |  2 +-
 dlls/winex11.drv/window.c      |  4 ++--
 dlls/winex11.drv/x11drv_main.c | 10 +++++-----
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 3bd771fa4fd..a6499400283 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -512,7 +512,7 @@ NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
 DWORD EVENT_x11_time_to_win32_time(Time time)
 {
   static DWORD adjust = 0;
-  DWORD now = GetTickCount();
+  DWORD now = NtGetTickCount();
   DWORD ret;
 
   if (! adjust && time != 0)
@@ -1365,7 +1365,7 @@ void wait_for_withdrawn_state( HWND hwnd, BOOL set )
 {
     Display *display = thread_display();
     struct x11drv_win_data *data;
-    DWORD end = GetTickCount() + 2000;
+    DWORD end = NtGetTickCount() + 2000;
 
     TRACE( "waiting for window %p to become %swithdrawn\n", hwnd, set ? "" : "not " );
 
@@ -1401,7 +1401,7 @@ void wait_for_withdrawn_state( HWND hwnd, BOOL set )
         if (!count)
         {
             struct pollfd pfd;
-            int timeout = end - GetTickCount();
+            int timeout = end - NtGetTickCount();
 
             pfd.fd = ConnectionNumber(display);
             pfd.events = POLLIN;
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 7a30b3b4a3e..6b876c3bee9 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1525,7 +1525,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
 
 static HKL get_locale_kbd_layout(void)
 {
-    ULONG_PTR layout;
+    LCID layout;
     LANGID langid;
 
     /* FIXME:
@@ -1539,7 +1539,7 @@ static HKL get_locale_kbd_layout(void)
      * locale id we return the US one.
      */
 
-    layout = GetUserDefaultLCID();
+    NtQueryDefaultLocale( TRUE, &layout );
 
     /*
      * Microsoft Office expects this value to be something specific
@@ -1553,7 +1553,7 @@ static HKL get_locale_kbd_layout(void)
     else
         layout |= layout << 16;
 
-    return (HKL)layout;
+    return (HKL)(UINT_PTR)layout;
 }
 
 
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 1a5230300a3..3d68dc80b3e 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -513,7 +513,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND prev_clip_hwnd, HWND new_clip_hwnd )
     {
         TRACE( "clip hwnd reset from %p\n", hwnd );
         data->clip_hwnd = 0;
-        data->clip_reset = GetTickCount();
+        data->clip_reset = NtGetTickCount();
         disable_xinput2();
         NtUserDestroyWindow( hwnd );
     }
@@ -553,7 +553,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
     release_win_data( data );
     if (!fullscreen) return FALSE;
     if (!(thread_data = x11drv_thread_data())) return FALSE;
-    if (GetTickCount() - thread_data->clip_reset < 1000) return FALSE;
+    if (NtGetTickCount() - thread_data->clip_reset < 1000) return FALSE;
     if (!reset && clipping_cursor && thread_data->clip_hwnd) return FALSE;  /* already clipping */
 
     monitor = NtUserMonitorFromWindow( hwnd, MONITOR_DEFAULTTONEAREST );
@@ -1472,9 +1472,9 @@ void X11DRV_DestroyCursorIcon( HCURSOR handle )
 void X11DRV_SetCursor( HCURSOR handle )
 {
     if (InterlockedExchangePointer( (void **)&last_cursor, handle ) != handle ||
-        GetTickCount() - last_cursor_change > 100)
+        NtGetTickCount() - last_cursor_change > 100)
     {
-        last_cursor_change = GetTickCount();
+        last_cursor_change = NtGetTickCount();
         if (cursor_window) send_notify_message( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
     }
 }
@@ -1667,7 +1667,7 @@ void move_resize_window( HWND hwnd, int dir )
             input.u.mi.dy          = pos.y;
             input.u.mi.mouseData   = button_up_data[button - 1];
             input.u.mi.dwFlags     = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
-            input.u.mi.time        = GetTickCount();
+            input.u.mi.time        = NtGetTickCount();
             input.u.mi.dwExtraInfo = 0;
             __wine_send_input( hwnd, &input, NULL );
         }
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 29e0b10763a..0f96b6860fd 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -650,7 +650,7 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
         static long prev_time, start_time;
         DWORD time;
 
-        time = GetTickCount();
+        time = NtGetTickCount();
         frames++;
         frames_total++;
         if (time - prev_time > 1500)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 79970f55444..de52023c467 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1861,8 +1861,8 @@ static LRESULT CALLBACK desktop_wndproc_wrapper( HWND hwnd, UINT msg, WPARAM wp,
     {
     case WM_WINE_NOTIFY_ACTIVITY:
     {
-        static ULONGLONG last = 0;
-        ULONGLONG now = GetTickCount64();
+        static ULONG last = 0;
+        ULONG now = NtGetTickCount();
         /* calling XResetScreenSaver too often can cause performance
          * problems, so throttle it */
         if (now > last + 5000)
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 6042f2522b5..aa8ddc49385 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -722,7 +722,7 @@ static void set_queue_display_fd( Display *display )
     if (wine_server_fd_to_handle( ConnectionNumber(display), GENERIC_READ | SYNCHRONIZE, 0, &handle ))
     {
         MESSAGE( "x11drv: Can't allocate handle for display fd\n" );
-        ExitProcess(1);
+        NtTerminateProcess( 0, 1 );
     }
     SERVER_START_REQ( set_queue_fd )
     {
@@ -733,9 +733,9 @@ static void set_queue_display_fd( Display *display )
     if (ret)
     {
         MESSAGE( "x11drv: Can't store handle for display fd\n" );
-        ExitProcess(1);
+        NtTerminateProcess( 0, 1 );
     }
-    CloseHandle( handle );
+    NtClose( handle );
 }
 
 
@@ -751,12 +751,12 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
     if (!(data = calloc( 1, sizeof(*data) )))
     {
         ERR( "could not create data\n" );
-        ExitProcess(1);
+        NtTerminateProcess( 0, 1 );
     }
     if (!(data->display = XOpenDisplay(NULL)))
     {
         ERR_(winediag)( "x11drv: Can't open display: %s. Please ensure that your X server is running and that $DISPLAY is set correctly.\n", XDisplayName(NULL));
-        ExitProcess(1);
+        NtTerminateProcess( 0, 1 );
     }
 
     fcntl( ConnectionNumber(data->display), F_SETFD, 1 ); /* set close on exec flag */




More information about the wine-cvs mailing list