[PATCH 3/5] win32u: Move NtUserLockWindowUpdate implementation from user32.

Jacek Caban wine at gitlab.winehq.org
Tue Jun 7 19:41:40 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 dlls/user32/painting.c  | 43 -----------------------------------------
 dlls/user32/user32.spec |  2 +-
 dlls/win32u/dce.c       | 17 ++++++++++++++++
 dlls/win32u/syscall.c   |  1 +
 dlls/win32u/win32u.spec |  2 +-
 dlls/wow64win/syscall.h |  1 +
 dlls/wow64win/user.c    |  7 +++++++
 include/ntuser.h        |  1 +
 8 files changed, 29 insertions(+), 45 deletions(-)

diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 29450e6e984..e7be362773a 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -112,49 +112,6 @@ HDC WINAPI GetWindowDC( HWND hwnd )
 }
 
 
-/***********************************************************************
- *		LockWindowUpdate (USER32.@)
- *
- * Enables or disables painting in the chosen window.
- *
- * PARAMS
- *  hwnd [I] handle to a window.
- *
- * RETURNS
- *  If successful, returns nonzero value. Otherwise,
- *  returns 0.
- *
- * NOTES
- *  You can lock only one window at a time.
- */
-BOOL WINAPI LockWindowUpdate( HWND hwnd )
-{
-    static HWND lockedWnd;
-
-    FIXME("(%p), partial stub!\n",hwnd);
-
-    USER_Lock();
-    if (lockedWnd)
-    {
-        if (!hwnd)
-        {
-            /* Unlock lockedWnd */
-            /* FIXME: Do something */
-        }
-        else
-        {
-            /* Attempted to lock a second window */
-            /* Return FALSE and do nothing */
-            USER_Unlock();
-            return FALSE;
-        }
-    }
-    lockedWnd = hwnd;
-    USER_Unlock();
-    return TRUE;
-}
-
-
 /***********************************************************************
  *		UpdateWindow (USER32.@)
  */
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index c153b6dbfe3..ee533305a6e 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -510,7 +510,7 @@
 @ stdcall LoadStringW(long long ptr long)
 @ stdcall LockSetForegroundWindow (long)
 @ stub LockWindowStation
-@ stdcall LockWindowUpdate(long)
+@ stdcall LockWindowUpdate(long) NtUserLockWindowUpdate
 @ stdcall LockWorkStation()
 @ stdcall LogicalToPhysicalPoint(long ptr)
 @ stdcall LogicalToPhysicalPointForPerMonitorDPI(long ptr)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c
index 62d84d7e77b..acbb213d7b7 100644
--- a/dlls/win32u/dce.c
+++ b/dlls/win32u/dce.c
@@ -1574,3 +1574,20 @@ INT WINAPI NtUserExcludeUpdateRgn( HDC hdc, HWND hwnd )
     NtGdiDeleteObjectApp( update_rgn );
     return ret;
 }
+
+/***********************************************************************
+ *           NtUserLockWindowUpdate (win32u.@)
+ */
+BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd )
+{
+    static HWND locked_hwnd;
+
+    FIXME( "(%p), partial stub!\n", hwnd );
+
+    if (!hwnd)
+    {
+        locked_hwnd = NULL;
+        return TRUE;
+    }
+    return !InterlockedCompareExchangePointer( (void **)&locked_hwnd, hwnd, 0 );
+}
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index a5ad95cd4b6..ac13580308d 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -150,6 +150,7 @@ static void * const syscalls[] =
     NtUserInitializeClientPfnArrays,
     NtUserInternalGetWindowText,
     NtUserKillTimer,
+    NtUserLockWindowUpdate,
     NtUserNotifyWinEvent,
     NtUserOpenDesktop,
     NtUserOpenInputDesktop,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 48c10fd45d3..17be6894508 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1065,7 +1065,7 @@
 @ stub NtUserLoadKeyboardLayoutEx
 @ stub NtUserLockCursor
 @ stub NtUserLockWindowStation
-@ stub NtUserLockWindowUpdate
+@ stdcall -syscall NtUserLockWindowUpdate(long)
 @ stub NtUserLockWorkStation
 @ stub NtUserLogicalToPerMonitorDPIPhysicalPoint
 @ stub NtUserLogicalToPhysicalDpiPointForWindow
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index fde87498131..e30d367cda7 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -137,6 +137,7 @@
     SYSCALL_ENTRY( NtUserInitializeClientPfnArrays ) \
     SYSCALL_ENTRY( NtUserInternalGetWindowText ) \
     SYSCALL_ENTRY( NtUserKillTimer ) \
+    SYSCALL_ENTRY( NtUserLockWindowUpdate ) \
     SYSCALL_ENTRY( NtUserNotifyWinEvent ) \
     SYSCALL_ENTRY( NtUserOpenDesktop ) \
     SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index e828dae5247..c2d134626f1 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -828,3 +828,10 @@ NTSTATUS WINAPI wow64_NtUserRemoveMenu( UINT *args )
 
     return NtUserRemoveMenu( handle, id, flags );
 }
+
+NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args )
+{
+    HWND hwnd = get_handle( &args );
+
+    return NtUserLockWindowUpdate( hwnd );
+}
diff --git a/include/ntuser.h b/include/ntuser.h
index 091d34c3a5f..e0c65a9f532 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -588,6 +588,7 @@ NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs
 INT     WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count );
 BOOL    WINAPI NtUserIsClipboardFormatAvailable( UINT format );
 BOOL    WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id );
+BOOL    WINAPI NtUserLockWindowUpdate( HWND hwnd );
 UINT    WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout );
 LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
                                   void *result_info, DWORD type, BOOL ansi );
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/204



More information about the wine-devel mailing list