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.
 
 
 
 
 
 

919 lines
29 KiB

/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
itlgac.c
Abstract:
This module contains the test functions for lineGetAddressCaps
Author:
Oliver Wallace (OliverW) 1-Aug-1995
Revision History:
--*/
#include "windows.h"
#include "ttest.h"
#include "malloc.h"
#include "string.h"
#include "tapi.h"
#include "doline.h"
#include "tcore.h"
#include "tline.h"
#define NUMTOTALSIZES 5
// lineGetAddressCaps
//
// The following tests are made:
//
// Tested Notes
// -------------------------------------------------------------------------
//
// * 1) Uninitialized
// 2) Invalid Device ID (-1, dwNumDevs)
// 3) Invalid Address ID (-1, dwNumAddresses)
// 4) Invalid hLineApps
// 5) Incompatible API version (too low, too high)
// 6) Incompatible extension version
// 7) Invalid lpLineAddressCaps pointers
// 8) Test combinations of allocations and dwTotalSizes
// (some valid and some invalid)
//
// * = Stand-alone test case
//
BOOL TestLineGetAddressCaps(BOOL fQuietMode, BOOL fStandAlone)
{
LPTAPILINETESTINFO lpTapiLineTestInfo;
INT n;
ESPDEVSPECIFICINFO info;
BOOL fTestPassed = TRUE;
CHAR szTestFunc[] = "lineGetAddressCaps";
size_t VersionSize;
LPLINEADDRESSCAPS lpLineAddressCaps;
DWORD dwFixedSize1 = 44*sizeof(DWORD);
DWORD dwFixedSize2 = 45*sizeof(DWORD);
DWORD dwTotalSizes1[NUMTOTALSIZES] = {
0,
(DWORD) dwFixedSize1 - 1,
0x70000000,
0x7FFFFFFF,
0xFFFFFFFF
};
DWORD dwTotalSizes2[NUMTOTALSIZES] = {
0,
(DWORD) dwFixedSize2 - 1,
0x70000000,
0x7FFFFFFF,
0xFFFFFFFF
};
DWORD dwFixedSize = sizeof(LINEADDRESSCAPS);
DWORD lExpected;
DWORD dwTotalSizes[NUMTOTALSIZES] = {
0,
(DWORD) dwFixedSize - 1,
0x70000000,
0x7FFFFFFF,
0xFFFFFFFF
};
InitTestNumber();
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
strcpy(lpTapiLineTestInfo->szTestFunc, szTestFunc);
lpTapiLineTestInfo->lpExtID = (LPLINEEXTENSIONID)
AllocFromTestHeap(sizeof(LINEEXTENSIONID));
// Allocate fixed size for lpLineAddressCaps pointer during
// these initial test sets
lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap(
sizeof(LINEADDRESSCAPS));
lpTapiLineTestInfo->lpLineAddressCaps =
(LPLINEADDRESSCAPS) lpLineAddressCaps;
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = sizeof(LINEDEVCAPS);
// Allocate fixed size for lpLineDevCaps pointer
lpTapiLineTestInfo->lpLineDevCaps =
(LPLINEDEVCAPS) AllocFromTestHeap(sizeof(LINEDEVCAPS));
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
TapiLogDetail(
DBUG_SHOW_PASS,
">>>>>>>> Begin testing lineGetAddressCaps <<<<<<<<"
);
// Test for UNINITIALIZED if this is the only TAPI app running
if (fStandAlone)
{
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Uninitialized state", dwTestCase + 1);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, LINEERR_UNINITIALIZED))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
}
// Try bad device id (dwNumDevs)
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: bad device ID (dwNumDevs)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
// Try working with any device
#if 0
// Find an ESP line device
if (! FindESPLineDevice(lpTapiLineTestInfo))
{
TLINE_FAIL();
}
#endif
lpTapiLineTestInfo->dwDeviceID_Orig = lpTapiLineTestInfo->dwDeviceID;
lpTapiLineTestInfo->dwDeviceID = *(lpTapiLineTestInfo->lpdwNumDevs);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, LINEERR_BADDEVICEID))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->dwDeviceID = lpTapiLineTestInfo->dwDeviceID_Orig;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Try bad device id (-1)
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: bad device ID (-1)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwDeviceID_Orig = lpTapiLineTestInfo->dwDeviceID;
lpTapiLineTestInfo->dwDeviceID = DWMINUSONE;
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, LINEERR_BADDEVICEID))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->dwDeviceID = lpTapiLineTestInfo->dwDeviceID_Orig;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check invalid line app handles
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid line app handles", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hLineApp_Orig = *lpTapiLineTestInfo->lphLineApp;
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
*(lpTapiLineTestInfo->lphLineApp) = (HLINEAPP) gdwInvalidHandles[n];
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, LINEERR_INVALAPPHANDLE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lphLineApp) = lpTapiLineTestInfo->hLineApp_Orig;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check invalid lplineAddressCaps pointers
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid invalid lpLineAddressCaps pointers", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
for (n = 0; n < NUMINVALIDPOINTERS; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"n= %ld", n);
lpTapiLineTestInfo->lpLineAddressCaps =
(LPLINEADDRESSCAPS) gdwInvalidPointers[n];
if (! DoLineGetAddressCaps(
lpTapiLineTestInfo,
LINEERR_INVALPOINTER))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Restore the lplineAddressCaps pointer
lpTapiLineTestInfo->lpLineAddressCaps = lpLineAddressCaps;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check incompatible API Version too high
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: incompatible API version (too high)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAPIVersion_Orig =
*lpTapiLineTestInfo->lpdwAPIVersion;
*lpTapiLineTestInfo->lpdwAPIVersion = TOOHIGH_APIVERSION;
if (! DoLineGetAddressCaps(
lpTapiLineTestInfo,
LINEERR_INCOMPATIBLEAPIVERSION))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lpdwAPIVersion) =
lpTapiLineTestInfo->dwAPIVersion_Orig;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check incompatible API Version that's too low
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: incompatible API version (too low)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAPIVersion_Orig =
*lpTapiLineTestInfo->lpdwAPIVersion;
*(lpTapiLineTestInfo->lpdwAPIVersion) = TOOLOW_APIVERSION;
if (! DoLineGetAddressCaps(
lpTapiLineTestInfo,
LINEERR_INCOMPATIBLEAPIVERSION))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lpdwAPIVersion) =
lpTapiLineTestInfo->dwAPIVersion_Orig;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check incompatible extension version
// TODO: Error will never occur if ESP line device is used.
// ESP just sets the extension version equal to the
// high value passed to lineNegotiateExtVersion API function...
// A test provider (such as a modified version of ESP)
// could be used to enforce certain version values to be valid.
#if 0
lpTapiLineTestInfo->dwExtVersion_Orig =
*lpTapiLineTestInfo->lpdwExtVersion;
*(lpTapiLineTestInfo->lpdwExtVersion) = BAD_EXTVERSION;
if (! DoLineGetDevCaps(
lpTapiLineTestInfo,
LINEERR_INCOMPATIBLEEXTVERSION))
{
TLINE_FAIL();
}
*(lpTapiLineTestInfo->lpdwExtVersion) =
lpTapiLineTestInfo->dwExtVersion_Orig;
#endif
// Check invalid address ID (-1)
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid dwAddressID (-1)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAddressID = DWMINUSONE;
if (! DoLineGetAddressCaps(
lpTapiLineTestInfo,
LINEERR_INVALADDRESSID))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Check invalid address ID (dwNumAddresses)
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid dwAddressID (dwNumAddresses)", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAddressID =
lpTapiLineTestInfo->lpLineDevCaps->dwNumAddresses;
if (! DoLineGetAddressCaps(
lpTapiLineTestInfo,
LINEERR_INVALADDRESSID))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Set dwAddressID to 0
lpTapiLineTestInfo->dwAddressID = 0;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwSize for 1.3 API version", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAPIVersion = 0x00010003;
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap (
dwFixedSize1);
for (n = 0; n < NUMTOTALSIZES; n++)
{
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize =
dwTotalSizes1[n];
if(dwTotalSizes1[n] < dwFixedSize1)
lExpected = LINEERR_STRUCTURETOOSMALL;
else
lExpected = LINEERR_INVALPOINTER;
TapiLogDetail(
DBUG_SHOW_DETAIL,
"dwTotalSize = %lx", dwTotalSizes1[n]);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, lExpected))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwSize for 1.4 API version", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAPIVersion = 0x00010004;
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap (
dwFixedSize2);
for (n = 0; n < NUMTOTALSIZES; n++)
{
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize =
dwTotalSizes2[n];
if(dwTotalSizes2[n] < dwFixedSize2)
lExpected = LINEERR_STRUCTURETOOSMALL;
else
lExpected = LINEERR_INVALPOINTER;
TapiLogDetail(
DBUG_SHOW_DETAIL,
"dwTotalSize = %lx", dwTotalSizes2[n]);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, lExpected))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwSize for 2.0 API version", dwTestCase + 1);
lpTapiLineTestInfo->dwAPIVersion = 0x00020000;
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap (
dwFixedSize);
for (n = 0; n < NUMTOTALSIZES; n++)
{
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize =
dwTotalSizes[n];
if(dwTotalSizes[n] < dwFixedSize)
lExpected = LINEERR_STRUCTURETOOSMALL;
else
lExpected = LINEERR_INVALPOINTER;
TapiLogDetail(
DBUG_SHOW_DETAIL,
"dwTotalSize = %lx", dwTotalSizes[n]);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, lExpected))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = dwFixedSize;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwExtVersion", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwExtVersion = BAD_EXTVERSION;
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, LINEERR_INCOMPATIBLEEXTVERSION))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->dwExtVersion = 0x00000000;
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success", dwTestCase + 1);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Free the local heap allocations
FreeTestHeap();
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Verify retutrn data for different APIversion", dwTestCase + 1);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lpLineDevCaps =
(LPLINEDEVCAPS) AllocFromTestHeap(sizeof(LINEDEVCAPS));
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAPIVersion = 0x00010004;
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap (
dwFixedSize2);
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = dwFixedSize2;
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
"dwAddressFeatures = %lx",
lpTapiLineTestInfo->lpLineAddressCaps->dwAddressFeatures);
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->dwAPIVersion = 0x00020000;
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap (
dwFixedSize);
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = dwFixedSize;
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
"dwAddressFeatures = %lx, dwCallFeatures2 = %lx, dwAvaiMediaModes = %lx",
lpTapiLineTestInfo->lpLineAddressCaps->dwAddressFeatures,
lpTapiLineTestInfo->lpLineAddressCaps->dwCallFeatures2,
lpTapiLineTestInfo->lpLineAddressCaps->dwAvailableMediaModes);
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
// Free the local heap allocations
FreeTestHeap();
n = ESP_RESULT_RETURNRESULT;
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN
))
{
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->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap(
sizeof(LINEADDRESSCAPS));
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = sizeof(LINEADDRESSCAPS);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, info.u.EspResult.lResult))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
FreeTestHeap();
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Error, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
lpTapiLineTestInfo->lphCall = &lpTapiLineTestInfo->hCall1;
lpTapiLineTestInfo->lphLine = &lpTapiLineTestInfo->hLine1;
lpTapiLineTestInfo->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
lpTapiLineTestInfo->dwAPILowVersion = LOW_APIVERSION;
lpTapiLineTestInfo->dwAPIHighVersion = HIGH_APIVERSION;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_MONITOR;
lpTapiLineTestInfo->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN
))
{
TLINE_FAIL();
}
if(IsESPLineDevice(lpTapiLineTestInfo))
{
info.dwKey = ESPDEVSPECIFIC_KEY;
info.dwType = ESP_DEVSPEC_RESULT;
info.u.EspResult.lResult = LINEERR_INVALADDRESSID;
info.u.EspResult.dwCompletionType = n;
lpTapiLineTestInfo->lpParams = (LPVOID)&info;
lpTapiLineTestInfo->dwSize = sizeof(info);
if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->lpLineAddressCaps = (LPLINEADDRESSCAPS) AllocFromTestHeap(
sizeof(LINEADDRESSCAPS));
lpTapiLineTestInfo->lpLineAddressCaps->dwTotalSize = sizeof(LINEADDRESSCAPS);
if (! DoLineGetAddressCaps(lpTapiLineTestInfo, info.u.EspResult.lResult))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoLineShutdown(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
FreeTestHeap();
TapiLogDetail(
DBUG_SHOW_PASS,
"@@ lineGetAddressCaps: 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 lineGetAddressCaps <<<<<<<<"
);
return fTestPassed;
}