user32/tests: Added some tests for behavior of 64-bit user handles.

This commit is contained in:
Alexandre Julliard 2008-12-08 14:02:48 +01:00
parent d3f7f5ebb6
commit ad4605fc61
1 changed files with 38 additions and 0 deletions

View File

@ -5311,6 +5311,43 @@ static void test_thick_child_size(HWND parentWindow)
ok(UnregisterClass(className, GetModuleHandleA(0)),"UnregisterClass call failed\n");
}
static void test_handles( HWND full_hwnd )
{
HWND hwnd = full_hwnd;
BOOL ret;
RECT rect;
SetLastError( 0xdeadbeef );
ret = GetWindowRect( hwnd, &rect );
ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
#ifdef _WIN64
if ((ULONG_PTR)full_hwnd >> 32)
hwnd = (HWND)((ULONG_PTR)full_hwnd & ~0u);
else
hwnd = (HWND)((ULONG_PTR)full_hwnd | ((ULONG_PTR)~0u << 32));
SetLastError( 0xdeadbeef );
ret = GetWindowRect( hwnd, &rect );
ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
hwnd = (HWND)(((ULONG_PTR)full_hwnd & ~0u) | ((ULONG_PTR)0x1234 << 32));
SetLastError( 0xdeadbeef );
ret = GetWindowRect( hwnd, &rect );
ok( ret, "GetWindowRect failed for %p err %u\n", hwnd, GetLastError() );
hwnd = (HWND)(((ULONG_PTR)full_hwnd & 0xffff) | ((ULONG_PTR)0x9876 << 16));
SetLastError( 0xdeadbeef );
ret = GetWindowRect( hwnd, &rect );
ok( !ret, "GetWindowRect succeeded for %p\n", hwnd );
ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
hwnd = (HWND)(((ULONG_PTR)full_hwnd & 0xffff) | ((ULONG_PTR)0x12345678 << 16));
SetLastError( 0xdeadbeef );
ret = GetWindowRect( hwnd, &rect );
ok( !ret, "GetWindowRect succeeded for %p\n", hwnd );
ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
#endif
}
START_TEST(win)
{
@ -5390,6 +5427,7 @@ START_TEST(win)
test_SetForegroundWindow(hwndMain);
test_shell_window();
test_handles( hwndMain );
/* add the tests above this line */
UnhookWindowsHookEx(hhook);