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

Alexandre Julliard julliard at winehq.org
Tue Dec 9 06:23:54 CST 2008


Module: wine
Branch: master
Commit: ad4605fc61953497de9a4dde9c023269f02139af
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad4605fc61953497de9a4dde9c023269f02139af

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec  8 14:02:48 2008 +0100

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

---

 dlls/user32/tests/win.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 00e30bc..ffbb8d2 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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);




More information about the wine-cvs mailing list