Commit c2f4e2b3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent d00ed8e7
......@@ -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);
......
......@@ -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 );
}
}
......
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