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

Signed-off-by: Rafał Harabień <rafalh1992@o2.pl>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rafał Harabień 2017-11-16 22:30:17 +01:00 committed by Alexandre Julliard
parent 1d03ba7611
commit 5c2526a086
5 changed files with 24 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 );

View File

@ -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 */