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.
 
 
 
 
 
 

965 lines
30 KiB

/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
itlgid.c
Abstract:
This module contains the test functions for lineGetID
Author:
Oliver Wallace (OliverW) 1-Aug-1995
Revision History:
--*/
#include "windows.h"
#include "malloc.h"
#include "string.h"
#include "tapi.h"
#include "ttest.h"
#include "doline.h"
#include "tcore.h"
#include "tline.h"
#define NUMTOTALSIZES 5
#define ALL_DWSELECTS (LINECALLSELECT_LINE | \
LINECALLSELECT_ADDRESS | \
LINECALLSELECT_CALL)
//
// lineGetID
//
// The following tests are made:
//
// -------------------------------------------------------------------------
//
// * 1) Uninitialized
// 2) Invalid hLines
// 3) Invalid hCalls
// 4) Invalid bit flag combinations for dwSelect
// 5) Invalid lpDeviceID pointers
// 6) Invalid lpszDeviceClass pointers
// 7) Combinations of invalid and valid allocations with various
// dwTotalSize values
// 8) Valid bit flag combinations for dwSelect
//
// * = Stand-alone test case
//
BOOL TestLineGetID(BOOL fQuietMode, BOOL fStandAlone)
{
LPTAPILINETESTINFO lpTapiLineTestInfo;
LPVARSTRING lpDeviceID;
#ifdef WUNICODE
WCHAR wszValidAddress[] = L"55555";
WCHAR wszValidDeviceClass[] = L"tapi/line";
WCHAR wszDeviceClass[] = L"wave";
#else
CHAR szValidAddress[] = "55555";
CHAR szValidDeviceClass[] = "tapi/line";
CHAR szDeviceClass[] = "wave";
#endif
INT n;
ESPDEVSPECIFICINFO info;
BOOL fTestPassed = TRUE;
size_t VarStringSize = sizeof(VARSTRING);
DWORD dwFixedSize = sizeof(VARSTRING);
DWORD lExpected;
DWORD dwTotalSizes[NUMTOTALSIZES] = {
0,
(DWORD) dwFixedSize - 1,
0x70000000,
0x7FFFFFFF,
0xFFFFFFFF
};
InitTestNumber();
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
strcpy(lpTapiLineTestInfo->szTestFunc, "lineGetID");
TapiLogDetail(
DBUG_SHOW_PASS,
">>>>>>>> Begin testing lineGetID <<<<<<<<"
);
// Test uninitialized case if this is the only TAPI app running
if (fStandAlone)
{
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: uninitialized state", dwTestCase + 1);
if (! DoLineGetID(lpTapiLineTestInfo, LINEERR_UNINITIALIZED))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
}
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);
lpDeviceID = (LPVARSTRING) AllocFromTestHeap(
sizeof(VARSTRING));
lpDeviceID->dwTotalSize = sizeof(VARSTRING);
lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
// Test invalid line handles
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid hLine values", dwTestCase + 1
);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hLine_Orig = *(lpTapiLineTestInfo->lphLine);
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
*(lpTapiLineTestInfo->lphLine) = (HLINE) gdwInvalidHandles[n];
if (! DoLineGetID(lpTapiLineTestInfo, LINEERR_INVALLINEHANDLE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lphLine) = lpTapiLineTestInfo->hLine_Orig;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid dwAddressID (-1)", dwTestCase + 1);
lpTapiLineTestInfo->hCall1 = 0;
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->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN
// LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAddressID = DWMINUSONE;
if (! DoLineGetID(
lpTapiLineTestInfo,
LINEERR_INVALADDRESSID))
{
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: invalid dwAddressID (dwNumAddresses)", dwTestCase + 1);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->dwAddressID = lpTapiLineTestInfo->lpLineDevCaps->dwNumAddresses;
if (! DoLineGetID(
lpTapiLineTestInfo,
LINEERR_INVALADDRESSID))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->dwAddressID = 0;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test invalid call handles
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid hCall values", dwTestCase + 1
);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = lpDeviceID;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_CALL;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
lpTapiLineTestInfo->hCall_Orig = *(lpTapiLineTestInfo->lphCall);
for (n = 0; n < NUMINVALIDHANDLES; n++)
{
*(lpTapiLineTestInfo->lphCall) = (HCALL) gdwInvalidHandles[n];
if (! DoLineGetID(lpTapiLineTestInfo, LINEERR_INVALCALLHANDLE))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
*(lpTapiLineTestInfo->lphCall) = lpTapiLineTestInfo->hCall_Orig;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test invalid lpDeviceID pointers
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid lpDeviceID pointers", dwTestCase + 1
);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = NULL;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
for (n = 0; n < NUMINVALIDPOINTERS; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"n= %ld", n);
lpTapiLineTestInfo->lpDeviceID = (LPVARSTRING) gdwInvalidPointers[n];
if (! DoLineGetID(lpTapiLineTestInfo, LINEERR_INVALPOINTER))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->lpDeviceID = &(lpTapiLineTestInfo->DeviceID);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
// Test invalid lpszDeviceClass pointers
#ifdef WUNICODE
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid lpwszDeviceClass pointers", dwTestCase + 1
);
#else
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: invalid lpszDeviceClass pointers", dwTestCase + 1
);
#endif
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = NULL;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
for (n = 0; n < NUMINVALIDPOINTERS; n++)
{
TapiLogDetail(
DBUG_SHOW_DETAIL,
"n= %ld", n);
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDeviceClass =
(LPWSTR) gdwInvalidPointers[n];
#else
lpTapiLineTestInfo->lpszDeviceClass =
(LPSTR) gdwInvalidPointers[n];
#endif
if (! DoLineGetID(lpTapiLineTestInfo, LINEERR_INVALPOINTER))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDeviceClass =
lpTapiLineTestInfo->lpwszDeviceClass_Orig;
#else
lpTapiLineTestInfo->lpszDeviceClass =
lpTapiLineTestInfo->lpszDeviceClass_Orig;
#endif
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Bad dwTotalSize", dwTestCase + 1
);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = &(lpTapiLineTestInfo->DeviceID);
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
for (n = 0; n < NUMTOTALSIZES; n++)
{
lpTapiLineTestInfo->lpDeviceID->dwTotalSize =
dwTotalSizes[n];
if(dwTotalSizes[n] < dwFixedSize)
lExpected = LINEERR_STRUCTURETOOSMALL;
else
lExpected = LINEERR_INVALPOINTER;
TapiLogDetail(
DBUG_SHOW_DETAIL,
"dwTotalSize = %lx", dwTotalSizes[n]);
if (! DoLineGetID(lpTapiLineTestInfo, lExpected))
{
TLINE_FAIL();
}
}
fTestPassed = ShowTestCase(fTestPassed);
lpTapiLineTestInfo->lpDeviceID->dwTotalSize = dwFixedSize;
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | 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->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
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 = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if(! TestInvalidBitFlags(
lpTapiLineTestInfo,
DoLineGetID,
(LPDWORD) &lpTapiLineTestInfo->dwSelect,
LINEERR_INVALCALLSELECT,
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->lpdwAPIVersion = &lpTapiLineTestInfo->dwAPIVersion;
lpTapiLineTestInfo->dwAPIVersion = TAPI_VERSION2_0;
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 = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
// BUGBUG
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if(! TestValidBitFlags(
lpTapiLineTestInfo,
DoLineGetID,
(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();
}
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success", dwTestCase + 1
);
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->lpsUserUserInfo = NULL;
lpTapiLineTestInfo->lpDeviceID = &(lpTapiLineTestInfo->DeviceID);
lpTapiLineTestInfo->lpDeviceID->dwTotalSize = dwFixedSize;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#endif
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LINITIALIZEEX | LNEGOTIATEAPIVERSION | LGETDEVCAPS | LOPEN |
LMAKECALL
))
{
TLINE_FAIL();
}
if (! DoLineGetID(lpTapiLineTestInfo, TAPISUCCESS))
{
TLINE_FAIL();
}
fTestPassed = ShowTestCase(fTestPassed);
// Shutdown to isolate the test case
if (! DoTapiLineFuncs(
lpTapiLineTestInfo,
LDROP | LDEALLOCATECALL | LCLOSE | LSHUTDOWN
))
{
TLINE_FAIL();
}
FreeTestHeap();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
n = ESP_RESULT_RETURNRESULT;
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Success, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
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->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
lpTapiLineTestInfo->lpDeviceID = &(lpTapiLineTestInfo->DeviceID);
lpTapiLineTestInfo->lpDeviceID->dwTotalSize = dwFixedSize;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#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();
}
if ( ! DoLineGetID(lpTapiLineTestInfo, info.u.EspResult.lResult))
{
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();
lpTapiLineTestInfo->lpLineInitializeExParams =
(LPLINEINITIALIZEEXPARAMS) AllocFromTestHeap (
sizeof(LINEINITIALIZEEXPARAMS));
lpTapiLineTestInfo->lpLineInitializeExParams->dwTotalSize =
sizeof(LINEINITIALIZEEXPARAMS);
lpTapiLineTestInfo->lpLineInitializeExParams->dwOptions =
LINEINITIALIZEEXOPTION_USEHIDDENWINDOW;
TapiLogDetail(
DBUG_SHOW_PASS,
">> Test Case %ld: Error, completionID = %d", dwTestCase + 1, n
);
TapiLineTestInit();
lpTapiLineTestInfo = GetLineTestInfo();
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->lpLineDevCaps = (LPLINEDEVCAPS) AllocFromTestHeap(
sizeof(LINEDEVCAPS)
);
lpTapiLineTestInfo->lpLineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS);
lpTapiLineTestInfo->dwMediaModes = LINEMEDIAMODE_DATAMODEM;
lpTapiLineTestInfo->dwPrivileges = LINECALLPRIVILEGE_OWNER;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
lpTapiLineTestInfo->lpDeviceID = &(lpTapiLineTestInfo->DeviceID);
lpTapiLineTestInfo->lpDeviceID->dwTotalSize = dwFixedSize;
lpTapiLineTestInfo->dwSelect = LINECALLSELECT_ADDRESS;
#ifdef WUNICODE
lpTapiLineTestInfo->lpwszDestAddress = wszValidAddress;
lpTapiLineTestInfo->lpwszDeviceClass = wszDeviceClass;
#else
lpTapiLineTestInfo->lpszDestAddress = szValidAddress;
lpTapiLineTestInfo->lpszDeviceClass = szDeviceClass;
#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_NODEVICE;
info.u.EspResult.dwCompletionType = n;
lpTapiLineTestInfo->lpParams = (LPVOID)&info;
lpTapiLineTestInfo->dwSize = sizeof(info);
if(! DoLineDevSpecific(lpTapiLineTestInfo, TAPISUCCESS, TRUE))
{
TLINE_FAIL();
}
if ( ! DoLineGetID(lpTapiLineTestInfo, info.u.EspResult.lResult))
{
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();
TapiLogDetail(
DBUG_SHOW_PASS,
"@@ lineGetID: 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 lineGetID <<<<<<<<"
);
return fTestPassed;
}