Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/dde.c | 102 ++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 56 deletions(-)
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c index d370df181a..786d4eca07 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -43,6 +43,22 @@ static WNDPROC old_dde_client_wndproc;
static const DWORD default_timeout = 200;
+static HANDLE create_process(const char *arg) +{ + STARTUPINFOA si = {.cb = sizeof(si)}; + PROCESS_INFORMATION pi; + char cmdline[200]; + char **argv; + BOOL ret; + + winetest_get_mainargs(&argv); + sprintf(cmdline, ""%s" %s %s", argv[0], argv[1], arg); + ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + ok(ret, "CreateProcess failed: %u\n", GetLastError()); + CloseHandle(pi.hThread); + return pi.hProcess; +} + static BOOL is_cjk(void) { int lang_id = PRIMARYLANGID(GetUserDefaultLangID()); @@ -253,23 +269,25 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA return DefWindowProcA(hwnd, msg, wparam, lparam); }
-static void test_msg_server(HANDLE hproc, HANDLE hthread) +static void test_msg_server(void) { + HANDLE client; MSG msg; HWND hwnd; DWORD res;
create_dde_window(&hwnd, "dde_server", dde_server_wndproc); - ResumeThread( hthread ); + client = create_process("ddeml");
- while (MsgWaitForMultipleObjects( 1, &hproc, FALSE, INFINITE, QS_ALLINPUT ) != 0) + while (MsgWaitForMultipleObjects(1, &client, FALSE, INFINITE, QS_ALLINPUT) != 0) { while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); }
destroy_dde_window(&hwnd, "dde_server"); - GetExitCodeProcess( hproc, &res ); + GetExitCodeProcess(client, &res); ok( !res, "client failed with %u error(s)\n", res ); + CloseHandle(client); }
static HDDEDATA CALLBACK client_ddeml_callback(UINT uType, UINT uFmt, HCONV hconv, @@ -823,14 +841,17 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon return 0; }
-static void test_ddeml_server(HANDLE hproc) +static void test_ddeml_server(void) { + HANDLE client; MSG msg; UINT res; BOOL ret; HSZ server; HDDEDATA hdata;
+ client = create_process("msg"); + /* set up DDE server */ server_pid = 0; res = DdeInitializeA(&server_pid, server_ddeml_callback, APPCLASS_STANDARD, 0); @@ -842,14 +863,15 @@ static void test_ddeml_server(HANDLE hproc) hdata = DdeNameService(server_pid, server, 0, DNS_REGISTER); ok(hdata == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", hdata);
- while (MsgWaitForMultipleObjects( 1, &hproc, FALSE, INFINITE, QS_ALLINPUT ) != 0) + while (MsgWaitForMultipleObjects(1, &client, FALSE, INFINITE, QS_ALLINPUT) != 0) { while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); } ret = DdeUninitialize(server_pid); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - GetExitCodeProcess( hproc, &res ); + GetExitCodeProcess(client, &res); ok( !res, "client failed with %u error(s)\n", res ); + CloseHandle(client); }
static HWND client_hwnd, server_hwnd; @@ -2683,8 +2705,9 @@ static void test_end_to_end_client(BOOL type_a)
}
-static void test_end_to_end_server(HANDLE hproc, HANDLE hthread, BOOL type_a) +static void test_end_to_end_server(BOOL client_unicode, BOOL server_unicode) { + HANDLE client; MSG msg; HSZ server; BOOL ret; @@ -2692,13 +2715,14 @@ static void test_end_to_end_server(HANDLE hproc, HANDLE hthread, BOOL type_a) HDDEDATA hdata; static const char test_service[] = "TestDDEService";
- trace("start end to end server %s\n", type_a ? "ASCII" : "UNICODE"); + trace("client %s, server %s\n", client_unicode ? "unicode" : "ascii", + server_unicode ? "unicode" : "ascii"); server_pid = 0;
- if (type_a) - res = DdeInitializeA(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0); - else + if (server_unicode) res = DdeInitializeW(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0); + else + res = DdeInitializeA(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0); ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
server = DdeCreateStringHandleA(server_pid, test_service, CP_WINANSI); @@ -2706,27 +2730,25 @@ static void test_end_to_end_server(HANDLE hproc, HANDLE hthread, BOOL type_a)
hdata = DdeNameService(server_pid, server, 0, DNS_REGISTER); ok(hdata == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", hdata); - ResumeThread( hthread );
+ client = create_process(client_unicode ? "endw" : "enda");
- while (MsgWaitForMultipleObjects( 1, &hproc, FALSE, INFINITE, QS_ALLINPUT ) != 0) + while (MsgWaitForMultipleObjects(1, &client, FALSE, INFINITE, QS_ALLINPUT) != 0) { while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); }
ret = DdeUninitialize(server_pid); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - GetExitCodeProcess( hproc, &res ); + GetExitCodeProcess(client, &res); ok( !res, "client failed with %u error(s)\n", res ); + CloseHandle(client); }
START_TEST(dde) { int argc; char **argv; - char buffer[MAX_PATH]; - STARTUPINFOA startup; - PROCESS_INFORMATION proc; DWORD dde_inst = 0xdeadbeef;
argc = winetest_get_mainargs(&argv); @@ -2754,30 +2776,12 @@ START_TEST(dde) return; }
- ZeroMemory(&startup, sizeof(STARTUPINFOA)); - sprintf(buffer, "%s dde ddeml", argv[0]); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_msg_server(proc.hProcess, proc.hThread); - - sprintf(buffer, "%s dde msg", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - 0, NULL, NULL, &startup, &proc); - - test_ddeml_server(proc.hProcess); + test_msg_server(); + test_ddeml_server();
/* Test the combinations of A and W interfaces with A and W data end to end to ensure that data conversions are accurate */ - sprintf(buffer, "%s dde enda", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, TRUE); + test_end_to_end_server(FALSE, FALSE);
/* Don't bother testing W interfaces on Win9x/WinMe */ SetLastError(0xdeadbeef); @@ -2788,23 +2792,9 @@ START_TEST(dde) } else { - sprintf(buffer, "%s dde endw", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); - - sprintf(buffer, "%s dde enda", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); - - sprintf(buffer, "%s dde endw", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, TRUE); + test_end_to_end_server(TRUE, TRUE); + test_end_to_end_server(FALSE, TRUE); + test_end_to_end_server(TRUE, FALSE);
test_dde_aw_transaction( FALSE, TRUE ); test_dde_aw_transaction( TRUE, FALSE );
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/dde.c | 249 ++++++++++++++-------------------------- 1 file changed, 83 insertions(+), 166 deletions(-)
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c index 786d4eca07..5eb5ec9d29 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -215,7 +215,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA if (msg_index == 5) { size = GlobalSize((HGLOBAL)lo); - ok(size == 4 || broken(size == 32), /* sizes are rounded up on win9x */ "got %d\n", size); + ok(size == 4, "got %d\n", size); } else ok(!lstrcmpA((LPSTR)poke->Value, "poke data\r\n"), @@ -257,11 +257,6 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA break; }
- case WM_DDE_ACK: /* happens on win9x when fAckReq is TRUE, ignore it */ - ok(msg_index == 4, "Expected 4, got %d\n", msg_index); - msg_index--; - break; - default: ok(FALSE, "Unhandled msg: %08x\n", msg); } @@ -334,8 +329,7 @@ static void test_ddeml_client(void) hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res); ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret); - ok(res == DDE_FNOTPROCESSED || broken(res == 0xdeadbeef), /* win9x */ - "Expected DDE_FNOTPROCESSED, got %08x\n", res); + ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %08x\n", res); ok( hdata != NULL, "hdata is NULL\n" ); if (hdata) { @@ -352,11 +346,9 @@ static void test_ddeml_client(void) DdeGetLastError(client_pid); hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res); ret = DdeGetLastError(client_pid); - ok(res == DDE_FNOTPROCESSED || broken(res == 0xdeadbeef), /* win9x */ - "Expected DDE_FNOTPROCESSED, got %x\n", res); + ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %x\n", res); todo_wine - ok(ret == DMLERR_MEMORY_ERROR || broken(ret == 0), /* win9x */ - "Expected DMLERR_MEMORY_ERROR, got %d\n", ret); + ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret); ok( hdata != NULL, "hdata is NULL\n" ); if (hdata) { @@ -374,8 +366,7 @@ todo_wine hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res); ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret); - ok(res == DDE_FNOTPROCESSED || broken(res == 0xdeadbeef), /* win9x */ - "Expected DDE_FNOTPROCESSED, got %x\n", res); + ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %x\n", res); if (hdata == NULL) ok(FALSE, "hdata is NULL\n"); else @@ -430,8 +421,7 @@ todo_wine op = DdeClientTransaction((LPBYTE)hdata, 0, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res); ret = DdeGetLastError(client_pid); ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op); - ok(res == DDE_FACK || broken(res == (0xdead0000 | DDE_FACK)), /* win9x */ - "Expected DDE_FACK, got %x\n", res); + ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
/* XTYP_POKE, correct params */ @@ -440,8 +430,7 @@ todo_wine op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res); ret = DdeGetLastError(client_pid); ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op); - ok(res == DDE_FACK || broken(res == (0xdead0000 | DDE_FACK)), /* win9x */ - "Expected DDE_FACK, got %x\n", res); + ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
DdeFreeDataHandle(hdata); @@ -458,25 +447,16 @@ todo_wine ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret); ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op); - ok(res == DDE_FACK || broken(res == (0xdead0000 | DDE_FACK)), /* win9x */ - "Expected DDE_FACK, got %x\n", res); + ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res);
/* XTYP_EXECUTE, no data */ res = 0xdeadbeef; DdeGetLastError(client_pid); op = DdeClientTransaction(NULL, 0, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res); ret = DdeGetLastError(client_pid); - ok(op == NULL || broken(op == (HDDEDATA)TRUE), /* win9x */ "Expected NULL, got %p\n", op); - if (!op) - { - ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res); - ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret); - } - else /* win9x */ - { - ok(res == (0xdead0000 | DDE_FACK), "Expected DDE_FACK, got %x\n", res); - ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret); - } + ok(op == NULL, "Expected NULL, got %p\n", op); + ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res); + ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
/* XTYP_EXECUTE, no data, -1 size */ res = 0xdeadbeef; @@ -485,8 +465,7 @@ todo_wine ret = DdeGetLastError(client_pid); ok(op == NULL, "Expected NULL, got %p\n", op); ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res); - ok(ret == DMLERR_INVALIDPARAMETER || broken(ret == DMLERR_NO_ERROR), /* win9x */ - "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret); + ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
DdeFreeStringHandle(client_pid, topic); DdeFreeDataHandle(hdata); @@ -499,19 +478,13 @@ todo_wine hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res); ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret); - ok(res == DDE_FNOTPROCESSED || broken(res == (0xdead0000 | DDE_FNOTPROCESSED)), /* win9x */ - "Expected DDE_FNOTPROCESSED, got %d\n", res); - if (hdata == NULL) - ok(FALSE, "hdata is NULL\n"); - else - { - str = (LPSTR)DdeAccessData(hdata, &size); - ok(!lstrcmpA(str, "command executed\r\n"), "Expected 'command executed\r\n', got %s\n", str); - ok(size == 19, "Expected 19, got %d\n", size); + ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res); + str = (LPSTR)DdeAccessData(hdata, &size); + ok(!strcmp(str, "command executed\r\n"), "Expected 'command executed\r\n', got %s\n", str); + ok(size == 19, "Expected 19, got %d\n", size);
- ret = DdeUnaccessData(hdata); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - } + ret = DdeUnaccessData(hdata); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
/* invalid transactions */ res = 0xdeadbeef; @@ -634,16 +607,9 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon ok(size == 13, "Expected 13, got %d\n", size);
size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI); - if (!strncmp( str, "TestDDEServer:(", 15 )) /* win9x style */ - { - ok(size == 16 + 2*sizeof(WORD), "Got size %d for %s\n", size, str); - } - else - { - ok(!strncmp(str, "TestDDEServer(", 14), "Expected TestDDEServer(, got %s\n", str); - ok(size == 17 + 2*sizeof(ULONG_PTR), "Got size %d for %s\n", size, str); - } - ok(str[size - 1] == ')', "Expected ')', got %c\n", str[size - 1]); + ok(!strncmp(str, "TestDDEServer(", 14), "Expected TestDDEServer(, got %s\n", str); + ok(size == 17 + 2*sizeof(ULONG_PTR), "Got size %d for %s\n", size, str); + ok(str[size - 1] == ')', "Expected ')', got %c\n", str[size - 1]);
return (HDDEDATA)TRUE; } @@ -747,8 +713,7 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
ptr = (LPSTR)DdeAccessData(hdata, &size); ok(!lstrcmpA(ptr, "poke data\r\n"), "Expected 'poke data\r\n', got %s\n", ptr); - ok(size == 12 || broken(size == 28), /* sizes are rounded up on win9x */ - "Expected 12, got %d\n", size); + ok(size == 12, "Expected 12, got %d\n", size); DdeUnaccessData(hdata);
size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI); @@ -1139,14 +1104,8 @@ static void test_msg_client(void)
/* WM_DDE_POKE, no ddepoke */ 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); - flush_events(); - } - else - win_skip("no lparam for WM_DDE_POKE\n"); - + PostMessageA(server_hwnd, WM_DDE_POKE, (WPARAM)client_hwnd, lparam); + flush_events();
/* WM_DDE_POKE, no item */ lparam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)hglobal, 0); @@ -1638,8 +1597,7 @@ todo_wine { ret = 0xdeadbeef; hdata = DdeClientTransaction((LPBYTE)test_cmd, strlen(test_cmd) + 1, hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret); ok(!hdata, "DdeClientTransaction succeeded\n"); - ok(ret == DDE_FNOTPROCESSED || broken(ret == (0xdead0000 | DDE_FNOTPROCESSED)), /* win9x */ - "wrong status code %04x\n", ret); + ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret); err = DdeGetLastError(dde_inst); ok(err == DMLERR_NOTPROCESSED, "wrong dde error %x\n", err);
@@ -1686,8 +1644,7 @@ todo_wine { else /* no mapping */ { ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err); - ok(ret == DDE_FNOTPROCESSED || broken(ret == (0xdead0000 | DDE_FNOTPROCESSED)), /* win9x */ - "wrong status code %04x\n", ret); + ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret); ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err); }
@@ -1929,10 +1886,7 @@ static void test_DdeCreateDataHandle(void) item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI); ok(item != NULL, "Expected non-NULL hsz\n");
- if (0) { - /* 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);
/* 0 instance id * This block tests an invalid instance Id. The correct behaviour is that if the instance Id @@ -2169,24 +2123,19 @@ static void test_PackDDElParam(void) ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef); - /* win9x returns 0 here */ - if (lparam) { - ptr = GlobalLock((HGLOBAL)lparam); - ok(ptr != NULL, "Expected non-NULL ptr\n"); - ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); - ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]); + ptr = GlobalLock((HGLOBAL)lparam); + ok(ptr != NULL, "Expected non-NULL ptr\n"); + ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); + ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam); - ok(ret == 1, "Expected 1, got %d\n", ret); + ret = GlobalUnlock((HGLOBAL)lparam); + ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0; - ret = UnpackDDElParam(WM_DDE_ADVISE, lparam, &lo, &hi); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); - ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); - } - else - win_skip("no lparam for WM_DDE_ADVISE\n"); + lo = hi = 0; + ret = UnpackDDElParam(WM_DDE_ADVISE, lparam, &lo, &hi); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret); + ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); + ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
ret = FreeDDElParam(WM_DDE_ADVISE, lparam); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); @@ -2204,47 +2153,37 @@ static void test_PackDDElParam(void) ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef); - /* win9x returns the input (0xbeef<<16 | 0xcafe) here */ - 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]); - ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]); + ptr = GlobalLock((HGLOBAL)lparam); + ok(ptr != NULL, "Expected non-NULL ptr\n"); + ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); + ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam); - ok(ret == 1, "Expected 1, got %d\n", ret); + ret = GlobalUnlock((HGLOBAL)lparam); + ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0; - ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); - ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); + lo = hi = 0; + ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret); + ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); + ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
- ret = FreeDDElParam(WM_DDE_ACK, lparam); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - } - else - win_skip("got lparam 0x%lx for WM_DDE_ACK\n", lparam); + ret = FreeDDElParam(WM_DDE_ACK, lparam); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef); - /* win9x returns 0 here */ - if (lparam) { - ptr = GlobalLock((HGLOBAL)lparam); - ok(ptr != NULL, "Expected non-NULL ptr\n"); - ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); - ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]); + ptr = GlobalLock((HGLOBAL)lparam); + ok(ptr != NULL, "Expected non-NULL ptr\n"); + ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); + ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam); - ok(ret == 1, "Expected 1, got %d\n", ret); + ret = GlobalUnlock((HGLOBAL)lparam); + ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0; - ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); - ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); - } - else - win_skip("no lparam for WM_DDE_DATA\n"); + lo = hi = 0; + ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret); + ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); + ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
ret = FreeDDElParam(WM_DDE_DATA, lparam); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); @@ -2262,24 +2201,19 @@ static void test_PackDDElParam(void) ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef); - /* win9x returns 0 here */ - if (lparam) { - ptr = GlobalLock((HGLOBAL)lparam); - ok(ptr != NULL, "Expected non-NULL ptr\n"); - ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); - ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]); + ptr = GlobalLock((HGLOBAL)lparam); + ok(ptr != NULL, "Expected non-NULL ptr\n"); + ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]); + ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
- ret = GlobalUnlock((HGLOBAL)lparam); - ok(ret == 1, "Expected 1, got %d\n", ret); + ret = GlobalUnlock((HGLOBAL)lparam); + ok(ret == 1, "Expected 1, got %d\n", ret);
- lo = hi = 0; - ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); - ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi); - } - else - win_skip("no lparam for WM_DDE_POKE\n"); + lo = hi = 0; + ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi); + ok(ret == TRUE, "Expected TRUE, got %d\n", ret); + ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo); + ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
ret = FreeDDElParam(WM_DDE_POKE, lparam); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); @@ -2768,13 +2702,7 @@ START_TEST(dde)
test_initialisation();
- SetLastError(0xdeadbeef); DdeInitializeW(&dde_inst, client_ddeml_callback, APPCMD_CLIENTONLY, 0); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("Skipping tests on win9x because of brokenness\n"); - return; - }
test_msg_server(); test_ddeml_server(); @@ -2782,29 +2710,18 @@ START_TEST(dde) /* Test the combinations of A and W interfaces with A and W data end to end to ensure that data conversions are accurate */ test_end_to_end_server(FALSE, FALSE); + test_end_to_end_server(TRUE, TRUE); + test_end_to_end_server(FALSE, TRUE); + test_end_to_end_server(TRUE, FALSE);
- /* Don't bother testing W interfaces on Win9x/WinMe */ - SetLastError(0xdeadbeef); - lstrcmpW(NULL, NULL); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("Skipping W-interface tests\n"); - } - else - { - test_end_to_end_server(TRUE, TRUE); - test_end_to_end_server(FALSE, TRUE); - test_end_to_end_server(TRUE, FALSE); - - test_dde_aw_transaction( FALSE, TRUE ); - test_dde_aw_transaction( TRUE, FALSE ); - test_dde_aw_transaction( TRUE, TRUE ); - test_dde_aw_transaction( FALSE, FALSE ); + test_dde_aw_transaction( FALSE, TRUE ); + test_dde_aw_transaction( TRUE, FALSE ); + test_dde_aw_transaction( TRUE, TRUE ); + test_dde_aw_transaction( FALSE, FALSE );
- test_dde_aw_transaction( FALSE, TRUE ); - test_dde_aw_transaction( TRUE, FALSE ); - test_dde_aw_transaction( TRUE, TRUE ); - } + test_dde_aw_transaction( FALSE, TRUE ); + test_dde_aw_transaction( TRUE, FALSE ); + test_dde_aw_transaction( TRUE, TRUE ); test_dde_aw_transaction( FALSE, FALSE );
test_DdeCreateDataHandle();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62627
Your paranoid android.
=== w2003std (task log) ===
Task errors: The task timed out
=== w1064v1809_zh_CN (32 bit report) ===
user32: dde.c:331: Test failed: Expected DMLERR_NO_ERROR, got 16386 dde.c:332: Test failed: Expected DDE_FNOTPROCESSED, got deadbeef dde.c:333: Test failed: hdata is NULL dde.c:284: Test failed: client failed with 3 error(s)
=== w1064v1507 (64 bit report) ===
user32: dde: Timeout
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/user32/tests/dde.c | 65 ++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 21 deletions(-)
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c index 5eb5ec9d29..54fec3914d 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -315,7 +315,12 @@ static void test_ddeml_client(void)
DdeGetLastError(client_pid); conversation = DdeConnect(client_pid, server, topic, NULL); - ok(conversation != NULL, "Expected non-NULL conversation\n"); + if (broken(!conversation)) /* Windows 10 version 1607 */ + { + win_skip("Failed to connect; error %#x.\n", DdeGetLastError(client_pid)); + DdeUninitialize(client_pid); + return; + } ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
@@ -1573,7 +1578,12 @@ static void test_dde_aw_transaction( BOOL client_unicode, BOOL server_unicode ) hsz_server = DdeCreateStringHandleW(dde_inst, TEST_DDE_SERVICE, CP_WINUNICODE);
hconv = DdeConnect(dde_inst, hsz_server, 0, NULL); - ok(hconv != 0, "DdeConnect error %x\n", DdeGetLastError(dde_inst)); + if (broken(!hconv)) /* Windows 10 version 1607 */ + { + win_skip("Failed to connect; error %#x.\n", DdeGetLastError(dde_inst)); + DdeUninitialize(dde_inst); + return; + } err = DdeGetLastError(dde_inst); ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
@@ -2352,7 +2362,8 @@ static WCHAR test_cmd_w_to_w[][32] = { { 0x4efa, 0x4efc, 0x0061, 0x4efe, 0 }, /* some Chinese chars */ { 0x0061, 0x0062, 0x0063, 0x9152, 0 }, /* Chinese with latin characters begin */ }; -static const int nb_callbacks = 5 + ARRAY_SIZE(test_cmd_w_to_w); +static int msg_index; +static BOOL unicode_server, unicode_client;
static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, @@ -2360,24 +2371,26 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV { DWORD size, rsize; char str[MAX_PATH]; - static int msg_index = 0; static HCONV conversation = 0; static const char test_service [] = "TestDDEService"; static const char test_topic [] = "TestDDETopic";
+ trace("type %#x, fmt %#x\n", uType, uFmt); + + ok(msg_index < 5 + ARRAY_SIZE(test_cmd_w_to_w), "Got unexpected message type %#x.\n", uType); msg_index++;
switch (uType) { case XTYP_REGISTER: { - ok(msg_index % nb_callbacks == 1, "Expected 1 modulo %u, got %d\n", nb_callbacks, msg_index); + ok(msg_index == 1, "Expected 1, got %d\n", msg_index); return (HDDEDATA)TRUE; }
case XTYP_CONNECT: { - ok(msg_index % nb_callbacks == 2, "Expected 2 modulo %u, got %d\n", nb_callbacks, msg_index); + ok(msg_index == 2, "Expected 2, got %d\n", msg_index); ok(uFmt == 0, "Expected 0, got %d, msg_index=%d\n", uFmt, msg_index); ok(hconv == 0, "Expected 0, got %p, msg_index=%d\n", hconv, msg_index); ok(hdata == 0, "Expected 0, got %p, msg_index=%d\n", hdata, msg_index); @@ -2398,7 +2411,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV } case XTYP_CONNECT_CONFIRM: { - ok(msg_index % nb_callbacks == 3, "Expected 3 modulo %u, got %d\n", nb_callbacks, msg_index); + ok(msg_index == 3, "Expected 3, got %d\n", msg_index); conversation = hconv; return (HDDEDATA) TRUE; } @@ -2409,7 +2422,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV char test_cmd_w_to_a[64]; WCHAR test_cmd_a_to_w[64]; DWORD size_a, size_w, size_w_to_a, size_a_to_w; - BOOL unicode_server, unicode_client, str_index; + BOOL str_index;
ok(uFmt == 0, "Expected 0, got %d\n", uFmt); ok(hconv == conversation, "Expected conversation handle, got %p, msg_index=%d\n", @@ -2429,9 +2442,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV size, rsize, msg_index); trace("msg %u strA "%s" strW %s\n", msg_index, buffer, wine_dbgstr_w((WCHAR*)buffer));
- unicode_server = (msg_index / nb_callbacks == 1 || msg_index / nb_callbacks == 2); - unicode_client = (msg_index / nb_callbacks == 1 || msg_index / nb_callbacks == 3); - str_index = msg_index % nb_callbacks - 4; + str_index = msg_index - 4; cmd_w = test_cmd_w_to_w[str_index - 1]; size_a = strlen(test_cmd_a_to_a) + 1; size_w = (lstrlenW(cmd_w) + 1) * sizeof(WCHAR); @@ -2606,7 +2617,12 @@ static void test_end_to_end_client(BOOL type_a)
DdeGetLastError(client_pid); hconv = DdeConnect(client_pid, server, topic, NULL); - ok(hconv != NULL, "Expected non-NULL conversation\n"); + if (broken(!hconv)) /* Windows 10 version 1607 */ + { + win_skip("Failed to connect; error %#x.\n", DdeGetLastError(client_pid)); + DdeUninitialize(client_pid); + return; + } ret = DdeGetLastError(client_pid); ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %x\n", ret); DdeFreeStringHandle(client_pid, server); @@ -2639,7 +2655,7 @@ static void test_end_to_end_client(BOOL type_a)
}
-static void test_end_to_end_server(BOOL client_unicode, BOOL server_unicode) +static void test_end_to_end_server(void) { HANDLE client; MSG msg; @@ -2649,11 +2665,12 @@ static void test_end_to_end_server(BOOL client_unicode, BOOL server_unicode) HDDEDATA hdata; static const char test_service[] = "TestDDEService";
- trace("client %s, server %s\n", client_unicode ? "unicode" : "ascii", - server_unicode ? "unicode" : "ascii"); + trace("client %s, server %s\n", unicode_client ? "unicode" : "ascii", + unicode_server ? "unicode" : "ascii"); server_pid = 0; + msg_index = 0;
- if (server_unicode) + if (unicode_server) res = DdeInitializeW(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0); else res = DdeInitializeA(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0); @@ -2665,7 +2682,7 @@ static void test_end_to_end_server(BOOL client_unicode, BOOL server_unicode) hdata = DdeNameService(server_pid, server, 0, DNS_REGISTER); ok(hdata == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", hdata);
- client = create_process(client_unicode ? "endw" : "enda"); + client = create_process(unicode_client ? "endw" : "enda");
while (MsgWaitForMultipleObjects(1, &client, FALSE, INFINITE, QS_ALLINPUT) != 0) { @@ -2709,10 +2726,16 @@ START_TEST(dde)
/* Test the combinations of A and W interfaces with A and W data end to end to ensure that data conversions are accurate */ - test_end_to_end_server(FALSE, FALSE); - test_end_to_end_server(TRUE, TRUE); - test_end_to_end_server(FALSE, TRUE); - test_end_to_end_server(TRUE, FALSE); + unicode_client = unicode_server = FALSE; + test_end_to_end_server(); + unicode_client = unicode_server = TRUE; + test_end_to_end_server(); + unicode_client = FALSE; + unicode_server = TRUE; + test_end_to_end_server(); + unicode_client = TRUE; + unicode_server = FALSE; + test_end_to_end_server();
test_dde_aw_transaction( FALSE, TRUE ); test_dde_aw_transaction( TRUE, FALSE );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62628
Your paranoid android.
=== w2003std (task log) ===
Task errors: The task timed out
On 12/27/19 11:20 AM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62628
Your paranoid android.
=== w2003std (task log) ===
Task errors: The task timed out
I'm not sure why it doesn't show up on test.winehq.org, but this seems to be preƫxisting: https://testbot.winehq.org/JobDetails.pl?Key=62629
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62626
Your paranoid android.
=== w2003std (task log) ===
Task errors: The task timed out