Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

870 lines
26 KiB

/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
itlst.c
Abstract:
This module contains the test functions for lineSetTerminal
Author:
Xiao Ying Ding (XiaoD) 20-Dec-1995
Revision History:
--*/
#include "windows.h"
#include "malloc.h"
#include "string.h"
#include "tapi.h"
#include "trapper.h"
#include "tcore.h"
#include "ttest.h"
#include "doline.h"
#include "vars.h"
#include "xline.h"
#define ALL_DWSELECTS (LINECALLSELECT_LINE | \
LINECALLSELECT_ADDRESS | \
LINECALLSELECT_CALL)
#define ALL_DWTERMMODES (LINETERMMODE_BUTTONS | \
LINETERMMODE_LAMPS | \
LINETERMMODE_DISPLAY | \
LINETERMMODE_RINGER | \
LINETERMMODE_HOOKSWITCH | \
LINETERMMODE_MEDIATOLINE | \
LINETERMMODE_MEDIAFROMLINE | \
LINETERMMODE_MEDIABIDIRECT)
// lineSetTerminal
//
// The following tests are made:
//
// Tested Notes
// -------------------------------------------------------------------------
// Go/No-Go test
//
// * = Stand-alone test case
//
//
BOOL TestLineSetTerminal(BOOL fQuietMode, BOOL fStandAlone)
{
LPTAPILINETESTINFO lpTapiLineTestInfo;
INT n;
ESPDEVSPECIFICINFO info;
BOOL fTestPassed = TRUE;
DWORD dwSize;
#ifdef WUNICODE
WCHAR wszValidAddress[] = L"55555";
WCHAR wszValidDeviceClass[] = L"tapi/line";
#else
CHAR szValidAddress[] = "55555";
CHAR szValidDeviceClass[] = "tapi/line";
#endif
DWORD dwTerminalMode;
LPCALLBACKPARAMS lpCallbackParams;
InitTestNumber();
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
OutputTAPIDebugInfo(
DBUG_SHOW_DETAIL,
"\n*****************************************************************************************");
TapiLogDetail(
DBUG_SHOW_PASS,
">>>>>>>> Begin testing lineSetTerminal <<<<<<<<"
);
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid hLine values", dwTestCase + 1
);
lpTapiLineTestInfo->dwTerminalModes = LINETERMMODE_BUTTONS;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_LINE;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hLine_Orig = *(lpTapiLineTestInfo->lphLine);
// set bad hLine
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
" n = %ld", n);
*(lpTapiLineTestInfo->lphLine) = (HLINE) gdwInvalidHandles[n];
if (! DoLineSetTerminal(lpTapiLineTestInfo, LINEERR_INVALLINEHANDLE, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lphLine) = lpTapiLineTestInfo->hLine_Orig;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid hCall values", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hCall_Orig = *(lpTapiLineTestInfo->lphCall);
// set bad hCall
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"n= %ld", n);
*(lpTapiLineTestInfo->lphCall) = (HCALL) gdwInvalidHandles[n];
if (! DoLineSetTerminal(lpTapiLineTestInfo, LINEERR_INVALCALLHANDLE, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lphCall) = lpTapiLineTestInfo->hCall_Orig;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test invalid bit flag combinations for dwSelect
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid bit flag combinations for dwSelect", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
// lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
// test dwSelect all invalid bit set
// Esp and unimdm return differet error
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if(! TestInvalidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetTerminal,
(LPDWORD) &lpTapiLineTestInfo->dwSelect,
LINEERR_INVALCALLSELECT,
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
FIELDSIZE_32,
ALL_DWSELECTS,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
TRUE
))
{
TLINE_FAIL();
}
}
else
{
if(! TestInvalidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetTerminal,
(LPDWORD) &lpTapiLineTestInfo->dwSelect,
LINEERR_OPERATIONUNAVAIL,
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
FIELDSIZE_32,
ALL_DWSELECTS,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
TRUE
))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test valid bit flag combinations for dwSelect
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: valid bit flag combinations for dwSelect", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
// lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
// test dwSelect all valid bit set
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if(! TestValidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetTerminal,
(LPDWORD) &lpTapiLineTestInfo->dwSelect,
/* XYD, NA and MUTEX should exchange the position
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
*/
FIELDTYPE_MUTEX,
FIELDTYPE_NA,
FIELDSIZE_32,
ALL_DWSELECTS,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
FALSE
))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test invalid bit flag combinations for dwTerminalMode
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid bit flag combinations for dwTerminalMode", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
// lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
// test dwTerminalModes all invalid bit set
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if(! TestInvalidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetTerminal,
(LPDWORD) &lpTapiLineTestInfo->dwTerminalModes,
LINEERR_INVALTERMINALMODE,
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
FIELDSIZE_32,
ALL_DWTERMMODES,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
TRUE
))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test valid bit flag combinations for dwSelect
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: valid bit flag combinations for dwTerminalModes", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
// lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
// test dwTerminalModes all valid bit set
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if(! TestValidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetTerminal,
(LPDWORD) &lpTapiLineTestInfo->dwTerminalModes,
/* XYD, NA and MUTEX should exchange the position
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
*/
FIELDTYPE_MUTEX,
FIELDTYPE_NA,
FIELDSIZE_32,
ALL_DWSELECTS,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
FALSE
))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test Success
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
// lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
// lineInitializeEx, lineNogotiateApiVersion, lineGetDevCaps,
// lineOpen, lineMakeCall
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAddressID = 0;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_LINE;
lpTapiLineTestInfo->dwTerminalModes = LINETERMMODE_DISPLAY;
lpTapiLineTestInfo->dwTerminalID = 0;
lpTapiLineTestInfo->bEnable = TRUE;
// test Succes with some valid parameters
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetTerminal(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
}
else if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetTerminal(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE))
{
TLINE_FAIL();
}
}
lpTapiLineTestInfo->lpCallInfo = (LPLINECALLINFO) AllocFromTestHeap(
sizeof(LINECALLINFO));
lpTapiLineTestInfo->lpCallInfo->dwTotalSize = sizeof(LINECALLINFO);
// call lineGetCallInfo to get value
if (! DoLineGetCallInfo(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_DETAIL,
"\tlpCallInfo->dwTotalSize = %lx, dwNeededSize = %lx",
lpTapiLineTestInfo->lpCallInfo->dwTotalSize,
lpTapiLineTestInfo->lpCallInfo->dwNeededSize);
if(lpTapiLineTestInfo->lpCallInfo->dwTotalSize <
lpTapiLineTestInfo->lpCallInfo->dwNeededSize)
{
dwSize = lpTapiLineTestInfo->lpCallInfo->dwNeededSize;
lpTapiLineTestInfo->lpCallInfo = (LPLINECALLINFO) AllocFromTestHeap(
dwSize);
lpTapiLineTestInfo->lpCallInfo->dwTotalSize = dwSize;
if (! DoLineGetCallInfo(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
}
// Display info
TapiLogDetail(
DBUG_SHOW_DETAIL,
"\tlpCallInfo->dwTerminalModesSize = %lx, Offset = %lx",
lpTapiLineTestInfo->lpCallInfo->dwTerminalModesSize,
lpTapiLineTestInfo->lpCallInfo->dwTerminalModesOffset);
dwTerminalMode = *((LPBYTE)lpTapiLineTestInfo->lpCallInfo+
lpTapiLineTestInfo->lpCallInfo->dwTerminalModesOffset);
TapiLogDetail(
DBUG_SHOW_DETAIL,
"\tdwTerminalModes = %lx",
dwTerminalMode);
fTestPassed = ShowTestCase(fTestPassed);
// Close the line
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
FreeTestHeap();
for(n = ESP_RESULT_CALLCOMPLPROCSYNC; n <= ESP_RESULT_CALLCOMPLPROCASYNC; n++)
{
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpCallbackParams = GetCallbackParams();
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
// Init a line
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN
| LMAKECALL
))
{
TLINE_FAIL();
}
if(IsESPLineDevice(lpTapiLineTestInfo))
{
info.dwKey = ESPDEVSPECIFIC_KEY;
info.dwType = ESP_DEVSPEC_RESULT;
info.u.EspResult.lResult = TAPISUCCESS;
info.u.EspResult.dwCompletionType = n;
lpTapiLineTestInfo->lpParams = (LPVOID)&info;
lpTapiLineTestInfo->dwSize = sizeof(info);
if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTerminalModes = LINETERMMODE_DISPLAY;
lpTapiLineTestInfo->dwTerminalID = 0;
lpTapiLineTestInfo->bEnable = TRUE;
if ( ! DoLineSetTerminal(lpTapiLineTestInfo, info.u.EspResult.lResult, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Free the memory allocated during the tests
FreeTestHeap();
}
for(n = ESP_RESULT_RETURNRESULT; n <= ESP_RESULT_CALLCOMPLPROCASYNC; n++)
{
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Error, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpCallbackParams = GetCallbackParams();
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszValidDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szValidDeviceClass;
#endif
// Init a line
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX| LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN
| LMAKECALL
))
{
TLINE_FAIL();
}
if(IsESPLineDevice(lpTapiLineTestInfo))
{
info.dwKey = ESPDEVSPECIFIC_KEY;
info.dwType = ESP_DEVSPEC_RESULT;
info.u.EspResult.lResult = LINEERR_INVALTERMINALID;
info.u.EspResult.dwCompletionType = n;
lpTapiLineTestInfo->lpParams = (LPVOID)&info;
lpTapiLineTestInfo->dwSize = sizeof(info);
if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTerminalModes = LINETERMMODE_DISPLAY;
lpTapiLineTestInfo->dwTerminalID = 0;
lpTapiLineTestInfo->bEnable = TRUE;
lpTapiLineTestInfo->fCompletionModeSet = TRUE;
if ( ! DoLineSetTerminal(lpTapiLineTestInfo, info.u.EspResult.lResult, FALSE))
{
TLINE_FAIL();
}
AddMessage(
LINE_REPLY,
(DWORD) lpTapiLineTestInfo->hCall1,
(DWORD) lpCallbackParams,
0x00000000,
info.u.EspResult.lResult,
0x00000000,
TAPIMSG_DWMSG | TAPIMSG_DWPARAM2
);
if( !WaitForAllMessages())
{
TLINE_FAIL();
}
lpTapiLineTestInfo->fCompletionModeSet = FALSE;
}
fTestPassed = ShowTestCase(fTestPassed);
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Free the memory allocated during the tests
FreeTestHeap();
}
TapiLogDetail(
DBUG_SHOW_PASS,
"@@ lineSetTerminal: Total Test Case = %ld, Passed = %ld, Failed = %ld",
dwTestCase, dwTestCasePassed, dwTestCaseFailed);
TapiLogDetail(
DBUG_SHOW_PASS,
"@@ Total Test Case = %ld, Passed = %ld, Failed = %ld",
dwglTestCase, dwglTestCasePassed, dwglTestCaseFailed);
if(dwTestCaseFailed > 0)
fTestPassed = FALSE;
TapiLogDetail(
DBUG_SHOW_PASS,
">>>>>>>> End testing lineSetTerminal <<<<<<<<"
);
return fTestPassed;
}