Francois Gouget : user32: Debugstr_format() should not modify the last error.

Alexandre Julliard julliard at winehq.org
Thu Jun 3 16:23:08 CDT 2021


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jun  3 18:44:48 2021 +0200

user32: Debugstr_format() should not modify the last error.

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

---

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

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 3d17b658e45..e8de7d9bdf6 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -81,8 +81,11 @@ struct metafile_pict
 static const char *debugstr_format( UINT id )
 {
     WCHAR buffer[256];
+    DWORD le = GetLastError();
+    BOOL r = GetClipboardFormatNameW( id, buffer, 256 );
+    SetLastError(le);
 
-    if (GetClipboardFormatNameW( id, buffer, 256 ))
+    if (r)
         return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) );
 
     switch (id)




More information about the wine-cvs mailing list