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@codeweavers.com --- 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); } }
In particular this stops the traces in open_clipboard() and has_no_open_wnd() from clobbering the line number when used in expressions such as ok(has_no_open_wnd(), ...).
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- dlls/user32/tests/clipboard.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 5951fc3247f..c8de860f8cc 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -33,7 +33,8 @@ static BOOL (WINAPI *pGetUpdatedClipboardFormats)( UINT *formats, UINT count, UI static int thread_from_line; static char *argv0;
-static BOOL open_clipboard(HWND hwnd) +#define open_clipboard(hwnd) open_clipboard_(__LINE__, hwnd) +static BOOL open_clipboard_(int line, HWND hwnd) { DWORD start = GetTickCount(); while (1) @@ -54,7 +55,7 @@ static BOOL open_clipboard(HWND hwnd) * response to a native application. */ GetClassNameA(clipwnd, classname, ARRAY_SIZE(classname)); - trace("%p (%s) opened the clipboard\n", clipwnd, classname); + trace_(__FILE__, line)("%p (%s) opened the clipboard\n", clipwnd, classname); SetLastError(le); return ret; } @@ -62,7 +63,8 @@ static BOOL open_clipboard(HWND hwnd) } }
-static BOOL has_no_open_wnd(void) +#define has_no_open_wnd() has_no_open_wnd_(__LINE__) +static BOOL has_no_open_wnd_(int line) { DWORD start = GetTickCount(); DWORD le = GetLastError(); @@ -76,7 +78,7 @@ static BOOL has_no_open_wnd(void) le = GetLastError(); /* See open_clipboard() */ GetClassNameA(clipwnd, classname, ARRAY_SIZE(classname)); - trace("%p (%s) opened the clipboard\n", clipwnd, classname); + trace_(__FILE__, line)("%p (%s) opened the clipboard\n", clipwnd, classname); SetLastError(le); return FALSE; }