Commit 5c2526a0 authored by Rafał Harabień's avatar Rafał Harabień Committed by Alexandre Julliard

winex11.drv: Preserve last error in x11drv_thread_data().

parent 1d03ba76
......@@ -283,6 +283,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
WARN("control %s %s creation failed\n", debugstr_w(info.className),
debugstr_w(info.windowName));
if (dlgTemplate->style & DS_NOFAILCREATE) continue;
SetLastError(0);
return FALSE;
}
......
......@@ -3518,6 +3518,7 @@ BOOL WINAPI TrackPopupMenuEx( HMENU hMenu, UINT wFlags, INT x, INT y,
SendMessageW( hWnd, WM_UNINITMENUPOPUP, (WPARAM)hMenu,
MAKELPARAM(0, IS_SYSTEM_MENU(menu)) );
}
SetLastError(0);
}
return ret;
......
......@@ -1928,8 +1928,17 @@ static void test_Input_mouse(void)
DWORD thread_id;
POINT pt, pt_org;
MSG msg;
BOOL ret;
GetCursorPos(&pt_org);
SetLastError(0xdeadbeef);
ret = GetCursorPos(NULL);
ok(!ret, "GetCursorPos succeed\n");
ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_NOACCESS, "error %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetCursorPos(&pt_org);
ok(ret, "GetCursorPos failed\n");
ok(GetLastError() == 0xdeadbeef, "error %u\n", GetLastError());
button_win = CreateWindowA("button", "button", WS_VISIBLE | WS_POPUP,
100, 100, 100, 100, 0, NULL, NULL, NULL);
......
......@@ -6261,6 +6261,14 @@ static void test_CreateWindow(void)
ok( rc.bottom <= expected_cy, "invalid rect bottom %u\n", rc.bottom );
DestroyWindow(hwnd);
/* invalid class */
SetLastError(0xdeadbeef);
hwnd = CreateWindowExA(0, "INVALID_CLASS", NULL, WS_CHILD, 10, 10, 100, 100, parent, 0, 0, NULL);
ok(hwnd == 0, "CreateWindowEx succeeded\n");
ok(GetLastError() == ERROR_CLASS_DOES_NOT_EXIST || GetLastError() == ERROR_CANNOT_FIND_WND_CLASS,
"invalid error %u\n", GetLastError());
DestroyWindow(hwnd);
if (pGetLayout && pSetLayout)
{
HDC hdc = GetDC( parent );
......
......@@ -345,7 +345,10 @@ extern DWORD thread_data_tls_index DECLSPEC_HIDDEN;
static inline struct x11drv_thread_data *x11drv_thread_data(void)
{
return TlsGetValue( thread_data_tls_index );
DWORD err = GetLastError(); /* TlsGetValue always resets last error */
struct x11drv_thread_data *data = TlsGetValue( thread_data_tls_index );
SetLastError( err );
return data;
}
/* retrieve the thread display, or NULL if not created yet */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment