Commit 609a3998 authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

user32/tests: Fix crash on win9x in the dde test.

parent aa1effe3
...@@ -1055,9 +1055,14 @@ static void test_msg_client() ...@@ -1055,9 +1055,14 @@ static void test_msg_client()
/* WM_DDE_POKE, no ddepoke */ /* WM_DDE_POKE, no ddepoke */
lparam = PackDDElParam(WM_DDE_POKE, 0, item); lparam = PackDDElParam(WM_DDE_POKE, 0, item);
/* win9x returns 0 here and crashes in PostMessageA */
if (lparam) {
PostMessageA(server_hwnd, WM_DDE_POKE, (WPARAM)client_hwnd, lparam); PostMessageA(server_hwnd, WM_DDE_POKE, (WPARAM)client_hwnd, lparam);
flush_events(); flush_events();
}
else
win_skip("no lparam for WM_DDE_POKE\n");
/* WM_DDE_POKE, no item */ /* WM_DDE_POKE, no item */
lparam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)hglobal, 0); lparam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)hglobal, 0);
...@@ -1522,15 +1527,9 @@ static void test_DdeCreateDataHandle(void) ...@@ -1522,15 +1527,9 @@ static void test_DdeCreateDataHandle(void)
item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI); item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI);
ok(item != NULL, "Expected non-NULL hsz\n"); ok(item != NULL, "Expected non-NULL hsz\n");
/* invalid instance id */ if (0) {
DdeGetLastError(dde_inst); /* do not test with an invalid instance id: that crashes on win9x */
hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0); hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
err = DdeGetLastError(dde_inst);
todo_wine
{
ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
ok(err == DMLERR_INVALIDPARAMETER,
"Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
} }
/* 0 instance id */ /* 0 instance id */
...@@ -1826,6 +1825,8 @@ static void test_PackDDElParam(void) ...@@ -1826,6 +1825,8 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef); lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef);
/* win9x returns 0 here */
if (lparam) {
ptr = GlobalLock((HGLOBAL)lparam); ptr = GlobalLock((HGLOBAL)lparam);
ok(ptr != NULL, "Expected non-NULL ptr\n"); ok(ptr != NULL, "Expected non-NULL ptr\n");
ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
...@@ -1839,6 +1840,9 @@ static void test_PackDDElParam(void) ...@@ -1839,6 +1840,9 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
}
else
win_skip("no lparam for WM_DDE_ADVISE\n");
ret = FreeDDElParam(WM_DDE_ADVISE, lparam); ret = FreeDDElParam(WM_DDE_ADVISE, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
...@@ -1865,6 +1869,8 @@ static void test_PackDDElParam(void) ...@@ -1865,6 +1869,8 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef); lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef);
/* win9x returns the input (0xbeef<<16 | 0xcafe) here */
if (lparam != 0xbeefcafe) {
ptr = GlobalLock((HGLOBAL)lparam); ptr = GlobalLock((HGLOBAL)lparam);
ok(ptr != NULL, "Expected non-NULL ptr\n"); ok(ptr != NULL, "Expected non-NULL ptr\n");
ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
...@@ -1886,8 +1892,13 @@ static void test_PackDDElParam(void) ...@@ -1886,8 +1892,13 @@ static void test_PackDDElParam(void)
ok(hglobal == (HGLOBAL)lparam, "Expected lparam, got %d\n", ret); ok(hglobal == (HGLOBAL)lparam, "Expected lparam, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_HANDLE, ok(GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
}
else
win_skip("got lparam 0x%lx for WM_DDE_ACK\n", lparam);
lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef); lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef);
/* win9x returns 0 here */
if (lparam) {
ptr = GlobalLock((HGLOBAL)lparam); ptr = GlobalLock((HGLOBAL)lparam);
ok(ptr != NULL, "Expected non-NULL ptr\n"); ok(ptr != NULL, "Expected non-NULL ptr\n");
ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
...@@ -1901,6 +1912,9 @@ static void test_PackDDElParam(void) ...@@ -1901,6 +1912,9 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
}
else
win_skip("no lparam for WM_DDE_DATA\n");
ret = FreeDDElParam(WM_DDE_DATA, lparam); ret = FreeDDElParam(WM_DDE_DATA, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
...@@ -1927,6 +1941,8 @@ static void test_PackDDElParam(void) ...@@ -1927,6 +1941,8 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef); lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef);
/* win9x returns 0 here */
if (lparam) {
ptr = GlobalLock((HGLOBAL)lparam); ptr = GlobalLock((HGLOBAL)lparam);
ok(ptr != NULL, "Expected non-NULL ptr\n"); ok(ptr != NULL, "Expected non-NULL ptr\n");
ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
...@@ -1940,6 +1956,9 @@ static void test_PackDDElParam(void) ...@@ -1940,6 +1956,9 @@ static void test_PackDDElParam(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
}
else
win_skip("no lparam for WM_DDE_POKE\n");
ret = FreeDDElParam(WM_DDE_POKE, lparam); ret = FreeDDElParam(WM_DDE_POKE, lparam);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
......
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