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.
 
 
 
 
 
 

873 lines
25 KiB

/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
itlsct.c
Abstract:
This module contains the test functions for lineSetCallTreatment
Author:
Xiao Ying Ding (XiaoD) 31-Jan-1996
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 "sline.h"
#define ALL_CALLTREATMENT (LINECALLTREATMENT_SILENCE | \
LINECALLTREATMENT_RINGBACK | \
LINECALLTREATMENT_BUSY | \
LINECALLTREATMENT_MUSIC)
// lineSetCallTreatment
//
// The following tests are made:
//
// Tested Notes
// -------------------------------------------------------------------------
// Go/No-Go test
//
// * = Stand-alone test case
//
//
BOOL TestLineSetCallTreatment(BOOL fQuietMode, BOOL fStandAlone)
{
LPTAPILINETESTINFO lpTapiLineTestInfo;
INT n;
LPCALLBACKPARAMS lpCallbackParams;
ESPDEVSPECIFICINFO info;
BOOL fTestPassed = TRUE;
DWORD dwErrorCode;
#ifdef WUNICODE
WCHAR wszValidAddress[] = L"55555";
#else
CHAR szValidAddress[] = "55555";
#endif
BOOL fUnimdm;
DWORD dwCallTreatment;
InitTestNumber();
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
OutputTAPIDebugInfo(
DBUG_SHOW_DETAIL,
"\n*****************************************************************************************");
TapiLogDetail(
DBUG_SHOW_PASS,
">>>>>>>> Begin testing lineSetCallTreatment <<<<<<<<"
);
/*
// Initialize a line app
if(! DoLineInitializeEx (lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwDeviceID = 0;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
fUnimdm = TRUE;
}
else
fUnimdm = FALSE;
if(fUnimdm)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"### Unimdm does not supported these apis");
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
return fTestPassed;
}
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
} */
lpTapiLineTestInfo->lpToneList = NULL;
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid hCall values", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hCall_Orig = *(lpTapiLineTestInfo->lphCall);
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"n= %ld", n);
*(lpTapiLineTestInfo->lphCall) = (HCALL) gdwInvalidHandles[n];
if (! DoLineSetCallTreatment(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();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: no OWNER privilege for hCall", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if (! DoLineDrop(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwCallPrivilege = LINECALLPRIVILEGE_MONITOR;
if (! DoLineSetCallPrivilege(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->lpCallData = (LPVOID)NULL;
lpTapiLineTestInfo->dwSize = 0;
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_NOTOWNER, TRUE))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
/*
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: BitVectorParamErrorTest for dwCallTreatment", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if(IsESPLineDevice(lpTapiLineTestInfo))
dwErrorCode = LINEERR_INVALPARAM;
else
dwErrorCode = LINEERR_OPERATIONUNAVAIL;
if(! TestInvalidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetCallTreatment,
(LPDWORD) &lpTapiLineTestInfo->dwTreatment,
// LINEERR_INVALPARAM,
dwErrorCode,
FIELDTYPE_NA,
FIELDTYPE_MUTEX,
FIELDSIZE_32,
ALL_CALLTREATMENT,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0xffffffff,
FALSE
))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: BitVectorValidParamTest for dwCallTreatment", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if(! TestValidBitFlagsAsy(
lpTapiLineTestInfo,
DoLineSetCallTreatment,
(LPDWORD) &lpTapiLineTestInfo->dwTreatment,
FIELDTYPE_MUTEX,
FIELDTYPE_MUTEX,
FIELDSIZE_32,
ALL_CALLTREATMENT,
~dwBitVectorMasks[(int) FIELDSIZE_32],
0x00000000,
0x00000000,
FALSE
))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
*/
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwCallTreatment = 0", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTreatment = 0;
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_INVALPARAM, TRUE))
{
TLINE_FAIL();
}
}
else if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Close the line
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: dwCallTreatment = 0XFFFFFFFF", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTreatment = 0xffffffff;
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
}
else if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Close the line
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwCallTreatment > MUSIC", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTreatment = LINECALLTREATMENT_MUSIC + 1;
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_INVALPARAM, TRUE))
{
TLINE_FAIL();
}
}
else if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Close the line
if (! DoLineClose(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Shutdown and end the tests
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success", dwTestCase + 1
);
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#endif
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->lpCallInfo = (LPLINECALLINFO) AllocFromTestHeap(
sizeof(BIGBUFSIZE));
lpTapiLineTestInfo->lpCallInfo->dwTotalSize = BIGBUFSIZE;
if (! DoLineGetCallInfo(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_DETAIL,
"Before: lpCallInfo->dwTreatment = %lx",
lpTapiLineTestInfo->lpCallInfo->dwCallTreatment);
dwCallTreatment = lpTapiLineTestInfo->lpCallInfo->dwCallTreatment;
lpTapiLineTestInfo->dwTreatment = LINECALLTREATMENT_SILENCE;
dwCallTreatment = lpTapiLineTestInfo->dwTreatment;
if(IsESPLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
if (! DoLineGetCallInfo(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_DETAIL,
"After: lpCallInfo->dwTreatment = %lx",
lpTapiLineTestInfo->lpCallInfo->dwCallTreatment);
if(dwCallTreatment == lpTapiLineTestInfo->lpCallInfo->dwCallTreatment)
fTestPassed = TRUE;
else
fTestPassed = FALSE;
}
else if(IsUNIMDMLineDevice(lpTapiLineTestInfo))
{
if (! DoLineSetCallTreatment(lpTapiLineTestInfo, LINEERR_OPERATIONUNAVAIL, TRUE))
{
TLINE_FAIL();
}
}
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;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#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->dwTreatment = LINECALLTREATMENT_SILENCE;
dwCallTreatment = lpTapiLineTestInfo->dwTreatment;
if ( ! DoLineSetCallTreatment(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;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
#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_INVALCALLHANDLE;
info.u.EspResult.dwCompletionType = n;
lpTapiLineTestInfo->lpParams = (LPVOID)&info;
lpTapiLineTestInfo->dwSize = sizeof(info);
if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwTreatment = LINECALLTREATMENT_SILENCE;
dwCallTreatment = lpTapiLineTestInfo->dwTreatment;
lpTapiLineTestInfo->fCompletionModeSet = TRUE;
if ( ! DoLineSetCallTreatment(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,
"@@ lineSetCallTreatment: 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 lineSetCallTreatment <<<<<<<<"
);
return fTestPassed;
}