user[2/2]: Preserve LastError.

Vitaliy Margolen wine-patch at kievinfo.com
Sat Jul 29 20:28:10 CDT 2006


ChangeLog:
user: Preserve LastError.

 dlls/user/tests/input.c   |    4 ++++
 dlls/winex11.drv/x11drv.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
-------------- next part --------------
c6a9a7ad578f3ec63e154b968c40972df1cf956a
diff --git a/dlls/user/tests/input.c b/dlls/user/tests/input.c
index 159b398..c7b6b31 100644
--- a/dlls/user/tests/input.c
+++ b/dlls/user/tests/input.c
@@ -525,12 +525,16 @@ static void test_keynames(void)
 {
     int i, len;
     char buff[256];
+    DWORD res;
 
     for (i = 0; i < 512; i++)
     {
         strcpy(buff, "----");
+        SetLastError(0xdeadbeef);
         len = GetKeyNameTextA(i << 16, buff, sizeof(buff));
         ok(len | !buff[0], "%d: Buffer is not zeroed\n", i);
+        res = GetLastError();
+        ok(res == 0xdeadbeef, "%d Wrong LastError = %ld\n", i, res);
     }
 }
 
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 4fb6e9e..72678d1 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -517,8 +517,11 @@ extern DWORD thread_data_tls_index;
 
 inline static struct x11drv_thread_data *x11drv_thread_data(void)
 {
+    /* Preserve last error */
+    DWORD err = GetLastError();
     struct x11drv_thread_data *data = TlsGetValue( thread_data_tls_index );
     if (!data) data = x11drv_init_thread_data();
+    SetLastError(err);
     return data;
 }
 


More information about the wine-patches mailing list