Alexandre Julliard : user32: The PackDDElParam return value is sign-extended on 64-bit.

Alexandre Julliard julliard at winehq.org
Mon Jan 12 10:40:30 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Jan 10 21:06:49 2009 +0100

user32: The PackDDElParam return value is sign-extended on 64-bit.

---

 dlls/user32/dde_misc.c  |    2 +-
 dlls/user32/tests/dde.c |   11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/dde_misc.c b/dlls/user32/dde_misc.c
index 02c6789..2f69e84 100644
--- a/dlls/user32/dde_misc.c
+++ b/dlls/user32/dde_misc.c
@@ -103,7 +103,7 @@ LPARAM WINAPI PackDDElParam(UINT msg, UINT_PTR uiLo, UINT_PTR uiHi)
         return uiHi;
 
     default:
-        return MAKELPARAM(uiLo, uiHi);
+        return MAKELONG(uiLo, uiHi);
     }
 }
 
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c
index f11e0fe..0ece009 100644
--- a/dlls/user32/tests/dde.c
+++ b/dlls/user32/tests/dde.c
@@ -1793,7 +1793,8 @@ static void test_PackDDElParam(void)
     BOOL ret;
 
     lparam = PackDDElParam(WM_DDE_INITIATE, 0xcafe, 0xbeef);
-    ok(lparam == 0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    /* value gets sign-extended despite being an LPARAM */
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
     ok(GlobalLock((HGLOBAL)lparam) == NULL,
        "Expected NULL, got %p\n", GlobalLock((HGLOBAL)lparam));
     ok(GetLastError() == ERROR_INVALID_HANDLE,
@@ -1809,7 +1810,7 @@ static void test_PackDDElParam(void)
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
 
     lparam = PackDDElParam(WM_DDE_TERMINATE, 0xcafe, 0xbeef);
-    ok(lparam == 0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
     ok(GlobalLock((HGLOBAL)lparam) == NULL,
        "Expected NULL, got %p\n", GlobalLock((HGLOBAL)lparam));
     ok(GetLastError() == ERROR_INVALID_HANDLE,
@@ -1853,7 +1854,7 @@ static void test_PackDDElParam(void)
        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
 
     lparam = PackDDElParam(WM_DDE_UNADVISE, 0xcafe, 0xbeef);
-    ok(lparam == 0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
     ok(GlobalLock((HGLOBAL)lparam) == NULL,
        "Expected NULL, got %p\n", GlobalLock((HGLOBAL)lparam));
     ok(GetLastError() == ERROR_INVALID_HANDLE,
@@ -1870,7 +1871,7 @@ static void test_PackDDElParam(void)
 
     lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef);
     /* win9x returns the input (0xbeef<<16 | 0xcafe) here */
-    if (lparam != 0xbeefcafe) {
+    if (lparam != (int)0xbeefcafe) {
         ptr = GlobalLock((HGLOBAL)lparam);
         ok(ptr != NULL, "Expected non-NULL ptr\n");
         ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
@@ -1925,7 +1926,7 @@ static void test_PackDDElParam(void)
        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
 
     lparam = PackDDElParam(WM_DDE_REQUEST, 0xcafe, 0xbeef);
-    ok(lparam == 0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
     ok(GlobalLock((HGLOBAL)lparam) == NULL,
        "Expected NULL, got %p\n", GlobalLock((HGLOBAL)lparam));
     ok(GetLastError() == ERROR_INVALID_HANDLE,




More information about the wine-cvs mailing list