user32: Make GetWindowLong() fail for some values on 64-bit.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-03-01 00:53:43 +03:00 committed by Alexandre Julliard
parent d00ed8e7b9
commit c2f4e2b338
2 changed files with 26 additions and 6 deletions

View File

@ -6346,7 +6346,6 @@ static void test_set_window_long_size(void)
/* GWLP_WNDPROC */
SetLastError(0xdeadbeef);
wnd_proc = (WNDPROC)(LONG_PTR)GetWindowLongA(hwnd, GWLP_WNDPROC);
todo_wine
ok(!wnd_proc && GetLastError() == ERROR_INVALID_INDEX, "Unexpected window proc.\n");
wnd_proc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
@ -6427,12 +6426,10 @@ todo_wine
SetLastError(0xdeadbeef);
ret = GetWindowLongA(hwnd, GWLP_HINSTANCE);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected instance %#x.\n", ret);
SetLastError(0xdeadbeef);
ret = GetWindowLongW(hwnd, GWLP_HINSTANCE);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected instance %#x.\n", ret);
SetLastError(0xdeadbeef);
@ -6451,7 +6448,6 @@ todo_wine
/* GWLP_HWNDPARENT */
SetLastError(0xdeadbeef);
ret = GetWindowLongA(hwnd, GWLP_HWNDPARENT);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected parent window %#x.\n", ret);
SetLastError(0xdeadbeef);

View File

@ -2690,7 +2690,19 @@ WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
*/
LONG WINAPI GetWindowLongA( HWND hwnd, INT offset )
{
return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), FALSE );
switch (offset)
{
#ifdef _WIN64
case GWLP_WNDPROC:
case GWLP_HINSTANCE:
case GWLP_HWNDPARENT:
WARN( "Invalid offset %d\n", offset );
SetLastError( ERROR_INVALID_INDEX );
return 0;
#endif
default:
return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), FALSE );
}
}
@ -2699,7 +2711,19 @@ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset )
*/
LONG WINAPI GetWindowLongW( HWND hwnd, INT offset )
{
return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), TRUE );
switch (offset)
{
#ifdef _WIN64
case GWLP_WNDPROC:
case GWLP_HINSTANCE:
case GWLP_HWNDPARENT:
WARN( "Invalid offset %d\n", offset );
SetLastError( ERROR_INVALID_INDEX );
return 0;
#endif
default:
return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), TRUE );
}
}