Commit 667944a3 authored by Gerald Pfeifer's avatar Gerald Pfeifer Committed by Alexandre Julliard

localspl/tests: Improve the tests in test_XcvDataPort_AddPort by properly…

localspl/tests: Improve the tests in test_XcvDataPort_AddPort by properly checking return values and avoiding a duplicate test.
parent 47fff748
...@@ -775,6 +775,8 @@ static void test_XcvClosePort(void) ...@@ -775,6 +775,8 @@ static void test_XcvClosePort(void)
static void test_XcvDataPort_AddPort(void) static void test_XcvDataPort_AddPort(void)
{ {
DWORD res;
/* /*
* The following tests crash with native localspl.dll on w2k and xp, * The following tests crash with native localspl.dll on w2k and xp,
* but it works, when the native dll (w2k and xp) is used in wine. * but it works, when the native dll (w2k and xp) is used in wine.
...@@ -787,28 +789,28 @@ static void test_XcvDataPort_AddPort(void) ...@@ -787,28 +789,28 @@ static void test_XcvDataPort_AddPort(void)
{ {
/* create a Port for a normal, writable file */ /* create a Port for a normal, writable file */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError());
/* add our testport again */ /* add our testport again */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
/* create a well-known Port */ /* create a well-known Port */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL); res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL);
ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
SetLastError(0xdeadbeef);
pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL);
/* native localspl.dll on wine: ERROR_ALREADY_EXISTS */
/* ERROR_ALREADY_EXISTS is also returned from native localspl.dll on wine, /* ERROR_ALREADY_EXISTS is also returned from native localspl.dll on wine,
when "RPT1:" was already installed for redmonnt.dll: when "RPT1:" was already installed for redmonnt.dll:
pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_rpt1W, ... res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_rpt1W, ...
*/ */
/* cleanup */ /* cleanup */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError());
} }
} }
......
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