localspl/tests: Add tests for XcvDataPort_AddPort.
This commit is contained in:
parent
06c91e925f
commit
e3c778eb58
|
@ -66,6 +66,7 @@ static BOOL (WINAPI *pConfigurePortUI)(PCWSTR, HWND, PCWSTR);
|
|||
static BOOL (WINAPI *pDeletePortUI)(PCWSTR, HWND, PCWSTR);
|
||||
|
||||
|
||||
static const WCHAR cmd_AddPortW[] = {'A','d','d','P','o','r','t',0};
|
||||
static const WCHAR cmd_ConfigureLPTPortCommandOKW[] = {'C','o','n','f','i','g','u','r','e',
|
||||
'L','P','T','P','o','r','t',
|
||||
'C','o','m','m','a','n','d','O','K',0};
|
||||
|
@ -376,6 +377,59 @@ static void test_XcvClosePort(void)
|
|||
|
||||
/* ########################### */
|
||||
|
||||
static void test_XcvDataPort_AddPort(void)
|
||||
{
|
||||
DWORD res;
|
||||
HANDLE hXcv;
|
||||
|
||||
|
||||
hXcv = (HANDLE) 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pXcvOpenPort(emptyW, SERVER_ALL_ACCESS, &hXcv);
|
||||
ok(res, "hXcv: %d with %u and %p (expected '!= 0')\n", res, GetLastError(), hXcv);
|
||||
if (!res) return;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* also tested (same crash): replacing emptyW with portname_lpt1W
|
||||
* and replacing "NULL, 0, NULL" with "buffer, MAX_PATH, &needed"
|
||||
*
|
||||
* We need to use a different API (AddPortEx) instead
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
/* create a Port for a normal, writeable file */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
|
||||
|
||||
/* add our testport again */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
|
||||
|
||||
/* create a well-known Port */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = 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,
|
||||
when "RPT1:" was already installed for redmonnt.dll:
|
||||
res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_rpt1W, ...
|
||||
*/
|
||||
|
||||
/* cleanup */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
|
||||
}
|
||||
|
||||
pXcvClosePort(hXcv);
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
||||
static void test_XcvDataPort_ConfigureLPTPortCommandOK(void)
|
||||
{
|
||||
CHAR org_value[16];
|
||||
|
@ -1080,13 +1134,20 @@ START_TEST(localmon)
|
|||
test_ConfigurePort();
|
||||
test_DeletePort();
|
||||
test_EnumPorts();
|
||||
test_XcvClosePort();
|
||||
test_XcvDataPort_ConfigureLPTPortCommandOK();
|
||||
test_XcvDataPort_DeletePort();
|
||||
test_XcvDataPort_GetTransmissionRetryTimeout();
|
||||
test_XcvDataPort_MonitorUI();
|
||||
test_XcvDataPort_PortIsValid();
|
||||
test_XcvOpenPort();
|
||||
if ((pXcvOpenPort == NULL) || (pXcvDataPort == NULL) || (pXcvClosePort == NULL)) {
|
||||
skip("Xcv not supported\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
test_XcvClosePort();
|
||||
test_XcvDataPort_AddPort();
|
||||
test_XcvDataPort_ConfigureLPTPortCommandOK();
|
||||
test_XcvDataPort_DeletePort();
|
||||
test_XcvDataPort_GetTransmissionRetryTimeout();
|
||||
test_XcvDataPort_MonitorUI();
|
||||
test_XcvDataPort_PortIsValid();
|
||||
test_XcvOpenPort();
|
||||
}
|
||||
|
||||
/* Cleanup our temporary file */
|
||||
DeleteFileW(tempfileW);
|
||||
|
|
Loading…
Reference in New Issue