Francois Gouget : user32/tests: Preserve the initial GetLastError() value for test_ClipboardOwner().

Alexandre Julliard julliard at winehq.org
Fri Jun 11 15:31:30 CDT 2021


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jun 10 12:10:46 2021 +0200

user32/tests: Preserve the initial GetLastError() value for test_ClipboardOwner().

One of the tests expects GetLastError() to still return 0xdeadbeef after
has_no_open_wnd(), which would not be the case if another process did
open the clipboard.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/clipboard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c
index 5071008a0ab..5951fc3247f 100644
--- a/dlls/user32/tests/clipboard.c
+++ b/dlls/user32/tests/clipboard.c
@@ -65,6 +65,7 @@ static BOOL open_clipboard(HWND hwnd)
 static BOOL has_no_open_wnd(void)
 {
     DWORD start = GetTickCount();
+    DWORD le = GetLastError();
     while (1)
     {
         HWND clipwnd = GetOpenClipboardWindow();
@@ -72,7 +73,7 @@ static BOOL has_no_open_wnd(void)
         if (GetTickCount() - start > 100)
         {
             char classname[256];
-            DWORD le = GetLastError();
+            le = GetLastError();
             /* See open_clipboard() */
             GetClassNameA(clipwnd, classname, ARRAY_SIZE(classname));
             trace("%p (%s) opened the clipboard\n", clipwnd, classname);
@@ -80,6 +81,7 @@ static BOOL has_no_open_wnd(void)
             return FALSE;
         }
         Sleep(15);
+        SetLastError(le);
     }
 }
 




More information about the wine-cvs mailing list