Leaked source code of windows server 2003
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.

3923 lines
132 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1994-97 Microsoft Corporation
  3. Module Name:
  4. tb.c
  5. Abstract:
  6. API wrapper code for the TAPI Browser util. Contains the big switch
  7. statement for all the supported Telephony API's, & various support funcs.
  8. Author:
  9. Dan Knudson (DanKn) 23-Aug-1994
  10. Revision History:
  11. --*/
  12. #include <stdio.h>
  13. #include <stdarg.h>
  14. #include <string.h>
  15. #include <ctype.h>
  16. #include <malloc.h>
  17. #include "tb.h"
  18. #include "vars.h"
  19. #include "resource.h"
  20. char szdwDeviceID[] = "dwDeviceID";
  21. char szdwSize[] = "dwSize";
  22. char szhCall[] = "hCall";
  23. char szhLine[] = "hLine";
  24. char szhLineApp[] = "hLineApp";
  25. char szhPhone[] = "hPhone";
  26. char szlpCallParams[] = "lpCallParams";
  27. char szlphCall[] = "lphCall";
  28. char szlpParams[] = "lpParams";
  29. char szhwndOwner[] = "hwndOwner";
  30. char szdwAddressID[] = "dwAddressID";
  31. char szlpszAppName[] = "lpszAppName";
  32. char szdwAPIVersion[] = "APIVersion";
  33. char szlphConsultCall[] = "lphConsultCall";
  34. char szlpszDeviceClass[] = "lpszDeviceClass";
  35. char szlpszDestAddress[] = "lpszDestAddress";
  36. char szlpsUserUserInfo[] = "lpsUserUserInfo";
  37. char szlpszFriendlyAppName[] = "lpszFriendlyAppName";
  38. DWORD NullWidget[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  39. void
  40. FuncDriver2(
  41. FUNC_INDEX funcIndex
  42. );
  43. void
  44. ErrorAlert(
  45. void
  46. )
  47. {
  48. //
  49. // We used to do MessageBeep(-1) when user hit an error, but
  50. // in NT bug #160090 MessageBeep will hang on HP Vectra boxes.
  51. // So the MessageBeep's were replaced with this func, which
  52. // simply flashes the window text.
  53. //
  54. SetWindowText (ghwndMain, " Error!");
  55. Sleep (250);
  56. SetWindowText (ghwndMain, "Tapi Browser");
  57. }
  58. LPWSTR
  59. PASCAL
  60. My_lstrcpyW(
  61. WCHAR *pString1,
  62. WCHAR *pString2
  63. )
  64. {
  65. //
  66. // lstrcpyW isn't supported on win95 (at least up to osr2)
  67. // so we'll use our own func
  68. //
  69. WCHAR *p = pString1;
  70. for (; (*p = *pString2); p++, pString2++);
  71. return pString1;
  72. }
  73. char *
  74. PASCAL
  75. GetTimeStamp(
  76. void
  77. )
  78. {
  79. static char szEmptyString[] = "", szTimeStamp[32];
  80. SYSTEMTIME systemTime;
  81. if (!bTimeStamp)
  82. {
  83. return szEmptyString;
  84. }
  85. GetLocalTime (&systemTime);
  86. wsprintf(
  87. szTimeStamp,
  88. "%d:%d.%d.%d : ",
  89. (DWORD) systemTime.wHour,
  90. (DWORD) systemTime.wMinute,
  91. (DWORD) systemTime.wSecond,
  92. (DWORD) systemTime.wMilliseconds
  93. );
  94. return szTimeStamp;
  95. }
  96. void
  97. ShowLineFuncResult(
  98. LPSTR lpFuncName,
  99. LONG lResult
  100. )
  101. {
  102. char *pszTimeStamp = GetTimeStamp();
  103. if (lResult > 0)
  104. {
  105. ShowStr ("%s%s returned x%lx", pszTimeStamp, lpFuncName, lResult);
  106. }
  107. else if (lResult != 0 &&
  108. ((DWORD) lResult < LINEERR_ALLOCATED ||
  109. (DWORD) lResult > LAST_LINEERR))
  110. {
  111. ErrorAlert();
  112. ShowStr(
  113. "%s%s returned inval err code (x%lx)",
  114. pszTimeStamp,
  115. lpFuncName,
  116. lResult
  117. );
  118. }
  119. else
  120. {
  121. if (lResult < 0)
  122. {
  123. ErrorAlert();
  124. }
  125. ShowStr(
  126. "%s%s returned %s%s",
  127. pszTimeStamp,
  128. lpFuncName,
  129. (lResult ? "LINEERR_" : ""), // ...to shrink aszLineErrs array
  130. aszLineErrs[LOWORD(lResult)]
  131. );
  132. }
  133. }
  134. void
  135. ShowPhoneFuncResult(
  136. LPSTR lpFuncName,
  137. LONG lResult
  138. )
  139. {
  140. char *pszTimeStamp = GetTimeStamp();
  141. if (lResult > 0)
  142. {
  143. ShowStr ("%s%s returned x%lx", pszTimeStamp, lpFuncName, lResult);
  144. }
  145. else if (lResult != 0 &&
  146. ((DWORD) lResult < PHONEERR_ALLOCATED ||
  147. (DWORD) lResult > PHONEERR_REINIT))
  148. {
  149. ErrorAlert();
  150. ShowStr(
  151. "%s%s returned inval err code (x%lx)",
  152. pszTimeStamp,
  153. lpFuncName,
  154. lResult
  155. );
  156. }
  157. else
  158. {
  159. if (lResult < 0)
  160. {
  161. ErrorAlert();
  162. }
  163. ShowStr(
  164. "%s%s returned %s%s",
  165. pszTimeStamp,
  166. lpFuncName,
  167. (lResult ? "PHONEERR_" : ""), // ...to shrink aszPhoneErrs array
  168. aszPhoneErrs[LOWORD(lResult)]
  169. );
  170. }
  171. }
  172. void
  173. ShowTapiFuncResult(
  174. LPSTR lpFuncName,
  175. LONG lResult
  176. )
  177. {
  178. char *pszTimeStamp = GetTimeStamp();
  179. if ((lResult > 0) || (lResult < TAPIERR_INVALPOINTER))
  180. {
  181. ShowStr(
  182. "%s%s returned inval err code (x%lx)",
  183. pszTimeStamp,
  184. lpFuncName,
  185. lResult
  186. );
  187. }
  188. else
  189. {
  190. lResult = (~lResult) + 1;
  191. if (lResult > 0)
  192. {
  193. ErrorAlert();
  194. }
  195. ShowStr(
  196. "%s%s returned %s%s",
  197. pszTimeStamp,
  198. lpFuncName,
  199. (lResult ? "TAPIERR_" : ""), // ...to shrink aszTapiErrs array
  200. aszTapiErrs[lResult]
  201. );
  202. }
  203. }
  204. void
  205. UpdateResults(
  206. BOOL bBegin
  207. )
  208. {
  209. //
  210. // In order to maximize speed, minimize flash, & have the
  211. // latest info in the edit control scrolled into view we
  212. // shrink the window down and hide it. Later, when all the
  213. // text has been inserted in the edit control, we show
  214. // the window (since window must be visible in order to
  215. // scroll caret into view), then tell it to scroll the caret
  216. // (at this point the window is still 1x1 so the painting
  217. // overhead is 0), and finally restore the control to it's
  218. // full size. In doing so we have zero flash and only 1 real
  219. // complete paint. Also put up the hourglass for warm fuzzies.
  220. //
  221. static RECT rect;
  222. static HCURSOR hCurSave;
  223. static int iNumBegins = 0;
  224. if (bBegin)
  225. {
  226. iNumBegins++;
  227. if (iNumBegins > 1)
  228. {
  229. return;
  230. }
  231. hCurSave = SetCursor (LoadCursor ((HINSTANCE)NULL, IDC_WAIT));
  232. GetWindowRect (ghwndEdit, &rect);
  233. SetWindowPos(
  234. ghwndEdit,
  235. (HWND) NULL,
  236. 0,
  237. 0,
  238. 1,
  239. 1,
  240. SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW |
  241. SWP_NOZORDER | SWP_HIDEWINDOW
  242. );
  243. }
  244. else
  245. {
  246. iNumBegins--;
  247. if (iNumBegins > 0)
  248. {
  249. return;
  250. }
  251. //
  252. // Do control restoration as described above
  253. //
  254. ShowWindow (ghwndEdit, SW_SHOW);
  255. #ifdef WIN32
  256. SendMessage (ghwndEdit, EM_SCROLLCARET, 0, 0);
  257. #else
  258. SendMessage(
  259. ghwndEdit,
  260. EM_SETSEL,
  261. (WPARAM)0,
  262. (LPARAM) MAKELONG(0xfffd,0xfffe)
  263. );
  264. #endif
  265. SetWindowPos(
  266. ghwndEdit,
  267. (HWND) NULL,
  268. 0,
  269. 0,
  270. rect.right - rect.left,
  271. rect.bottom - rect.top,
  272. SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER
  273. );
  274. SetCursor (hCurSave);
  275. }
  276. }
  277. void
  278. ShowModBytes(
  279. DWORD dwSize,
  280. unsigned char far *lpc,
  281. char *pszTab,
  282. char *buf
  283. )
  284. {
  285. DWORD dwSize2 = dwSize, i, j, k;
  286. strcpy (buf, pszTab);
  287. k = strlen (buf);
  288. for (i = 8; i < 36; i += 9)
  289. {
  290. buf[k + i] = ' ';
  291. for (j = 2; j < 9; j += 2)
  292. {
  293. char buf2[8] = "xx";
  294. if (dwSize2)
  295. {
  296. sprintf (buf2, "%02x", (int) (*lpc));
  297. dwSize2--;
  298. }
  299. buf[k + i - j] = buf2[0];
  300. buf[k + i - j + 1] = buf2[1];
  301. lpc++;
  302. }
  303. }
  304. k += 37;
  305. buf[k - 1] = ' ';
  306. lpc -= 16;
  307. for (i = 0; i < dwSize; i++)
  308. {
  309. buf[k + i] = aAscii[*(lpc+i)];
  310. }
  311. buf[k + i] = 0;
  312. ShowStr (buf);
  313. }
  314. void
  315. ShowBytes(
  316. DWORD dwSize,
  317. LPVOID lp,
  318. DWORD dwNumTabs
  319. )
  320. {
  321. char tabBuf[17] = "";
  322. char buf[80];
  323. DWORD i, j, k, dwNumDWORDs, dwMod4 = (DWORD) (((ULONG_PTR) lp) & 3);
  324. LPDWORD lpdw;
  325. unsigned char far *lpc = (unsigned char far *) lp;
  326. UpdateResults (TRUE);
  327. for (i = 0; i < dwNumTabs; i++)
  328. {
  329. strcat (tabBuf, szTab);
  330. }
  331. //
  332. // Special case for unaligned pointers (will fault on ppc/mips)
  333. //
  334. if (dwMod4)
  335. {
  336. DWORD dwNumUnalignedBytes = 4 - dwMod4,
  337. dwNumBytesToShow = (dwNumUnalignedBytes > dwSize ?
  338. dwSize : dwNumUnalignedBytes);
  339. ShowModBytes (dwNumBytesToShow, lpc, tabBuf, buf);
  340. lpc += dwNumUnalignedBytes;
  341. lpdw = (LPDWORD) lpc;
  342. dwSize -= dwNumBytesToShow;
  343. }
  344. else
  345. {
  346. lpdw = (LPDWORD) lp;
  347. }
  348. //
  349. // Dump full lines of four DWORDs in hex & corresponding ASCII
  350. //
  351. if (dwSize >= (4*sizeof(DWORD)))
  352. {
  353. dwNumDWORDs = dwSize / 4; // adjust from numBytes to num DWORDs
  354. for (i = 0; i < (dwNumDWORDs - (dwNumDWORDs%4)); i += 4)
  355. {
  356. sprintf (
  357. buf,
  358. "%s%08lx %08lx %08lx %08lx ",
  359. tabBuf,
  360. *lpdw,
  361. *(lpdw+1),
  362. *(lpdw+2),
  363. *(lpdw+3)
  364. );
  365. k = strlen (buf);
  366. for (j = 0; j < 16; j++)
  367. {
  368. buf[k + j] = aAscii[*(lpc + j)];
  369. }
  370. buf[k + j] = 0;
  371. ShowStr (buf);
  372. lpdw += 4;
  373. lpc += 16;
  374. }
  375. }
  376. //
  377. // Special case for remaining bytes to dump (0 < n < 16)
  378. //
  379. if ((dwSize %= 16))
  380. {
  381. ShowModBytes (dwSize, lpc, tabBuf, buf);
  382. }
  383. UpdateResults (FALSE);
  384. }
  385. void
  386. ShowStructByDWORDs(
  387. LPVOID lp
  388. )
  389. {
  390. if (dwDumpStructsFlags & DS_BYTEDUMP)
  391. {
  392. //
  393. // Cast lp as DWORD, then add 2 to point to where a
  394. // dwUsedSize field is in a TAPI struct
  395. //
  396. ShowBytes (*(((LPDWORD) lp) + 2), lp, 0);
  397. }
  398. }
  399. void
  400. ShowStructByField(
  401. PSTRUCT_FIELD_HEADER pHeader,
  402. BOOL bSubStructure
  403. )
  404. {
  405. static char far *aszCommonFields[] =
  406. {
  407. "dwTotalSize",
  408. "dwNeededSize",
  409. "dwUsedSize"
  410. };
  411. DWORD i, j;
  412. char far *buf = malloc (256);
  413. UpdateResults (TRUE);
  414. ShowStr (pHeader->szName);
  415. if (!bSubStructure)
  416. {
  417. LPDWORD lpdw = (LPDWORD) pHeader->pStruct;
  418. for (i = 0; i < 3; i++)
  419. {
  420. ShowStr ("%s%s=x%lx", szTab, aszCommonFields[i], *lpdw);
  421. lpdw++;
  422. }
  423. }
  424. for (i = 0; i < pHeader->dwNumFields; i++)
  425. {
  426. if ((pHeader->aFields[i].dwValue == 0) &&
  427. !(dwDumpStructsFlags & DS_ZEROFIELDS))
  428. {
  429. continue;
  430. }
  431. sprintf(
  432. buf,
  433. "%s%s=x%lx",
  434. szTab,
  435. pHeader->aFields[i].szName,
  436. pHeader->aFields[i].dwValue
  437. );
  438. switch (pHeader->aFields[i].dwType)
  439. {
  440. case FT_DWORD:
  441. ShowStr (buf);
  442. break;
  443. case FT_FLAGS:
  444. {
  445. PLOOKUP pLookup = pHeader->aFields[i].pLookup;
  446. strcat (buf, ", ");
  447. for(
  448. j = 0;
  449. pHeader->aFields[i].dwValue, pLookup[j].dwVal != 0xffffffff;
  450. j++
  451. )
  452. {
  453. if (pHeader->aFields[i].dwValue & pLookup[j].dwVal)
  454. {
  455. if (buf[0] == 0)
  456. {
  457. sprintf (buf, "%s%s", szTab, szTab);
  458. }
  459. strcat (buf, pLookup[j].lpszVal);
  460. strcat (buf, " ");
  461. pHeader->aFields[i].dwValue =
  462. pHeader->aFields[i].dwValue & ~pLookup[j].dwVal;
  463. if (strlen (buf) > 50)
  464. {
  465. //
  466. // We don't want strings getting so long that
  467. // they're going offscreen, so break them up.
  468. //
  469. ShowStr (buf);
  470. buf[0] = 0;
  471. }
  472. }
  473. }
  474. if (pHeader->aFields[i].dwValue)
  475. {
  476. strcat (buf, "<unknown flag(s)>");
  477. }
  478. if (buf[0])
  479. {
  480. ShowStr (buf);
  481. }
  482. break;
  483. }
  484. case FT_ORD:
  485. {
  486. PLOOKUP pLookup = pHeader->aFields[i].pLookup;
  487. strcat (buf, ", ");
  488. for(
  489. j = 0;
  490. pLookup[j].dwVal != 0xffffffff;
  491. j++
  492. )
  493. {
  494. if (pHeader->aFields[i].dwValue == pLookup[j].dwVal)
  495. {
  496. strcat (buf, pLookup[j].lpszVal);
  497. break;
  498. }
  499. }
  500. if (pLookup[j].dwVal == 0xffffffff)
  501. {
  502. strcpy (buf, "<unknown ordinal>");
  503. }
  504. ShowStr (buf);
  505. break;
  506. }
  507. case FT_SIZE:
  508. ShowStr (buf);
  509. break;
  510. case FT_OFFSET:
  511. ShowStr (buf);
  512. if (IsBadReadPtr(
  513. ((char far *) pHeader->pStruct) +
  514. pHeader->aFields[i].dwValue,
  515. (UINT)pHeader->aFields[i-1].dwValue
  516. ))
  517. {
  518. ShowStr ("<size/offset pair yields bad pointer>");
  519. }
  520. else
  521. {
  522. ShowBytes(
  523. pHeader->aFields[i-1].dwValue,
  524. ((char far *) pHeader->pStruct) +
  525. pHeader->aFields[i].dwValue,
  526. 2
  527. );
  528. }
  529. break;
  530. }
  531. }
  532. free (buf);
  533. UpdateResults (FALSE);
  534. }
  535. void
  536. ShowVARSTRING(
  537. LPVARSTRING lpVarString
  538. )
  539. {
  540. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  541. {
  542. STRUCT_FIELD fields[] =
  543. {
  544. { "dwStringFormat", FT_ORD, lpVarString->dwStringFormat, aStringFormats },
  545. { "dwStringSize", FT_SIZE, lpVarString->dwStringSize, NULL },
  546. { "dwStringOffset", FT_OFFSET, lpVarString->dwStringOffset, NULL }
  547. };
  548. STRUCT_FIELD_HEADER fieldHeader =
  549. {
  550. lpVarString,
  551. "VARSTRING",
  552. 3,
  553. fields
  554. };
  555. ShowStructByField (&fieldHeader, FALSE);
  556. }
  557. }
  558. INT_PTR
  559. LetUserMungeParams(
  560. PFUNC_PARAM_HEADER pParamsHeader
  561. )
  562. {
  563. if (!bShowParams)
  564. {
  565. return TRUE;
  566. }
  567. return (DialogBoxParam(
  568. ghInst,
  569. (LPCSTR)MAKEINTRESOURCE(IDD_DIALOG2),
  570. ghwndMain,
  571. ParamsDlgProc,
  572. (LPARAM) pParamsHeader
  573. ));
  574. }
  575. void
  576. DumpParams(
  577. PFUNC_PARAM_HEADER pHeader
  578. )
  579. {
  580. if (bTimeStamp || bDumpParams)
  581. {
  582. char *pszTimeStamp = GetTimeStamp();
  583. UpdateResults (TRUE);
  584. ShowStr(
  585. "%sCalling %s",
  586. pszTimeStamp,
  587. aFuncNames[pHeader->FuncIndex]
  588. );
  589. if (bDumpParams)
  590. {
  591. DWORD i;
  592. for (i = 0; i < pHeader->dwNumParams; i++)
  593. {
  594. ShowStr(
  595. " %s=x%lx",
  596. pHeader->aParams[i].szName,
  597. pHeader->aParams[i].dwValue
  598. );
  599. }
  600. }
  601. UpdateResults (FALSE);
  602. }
  603. }
  604. void
  605. PASCAL
  606. MakeWideString(
  607. LPVOID pString
  608. )
  609. {
  610. if (!IsBadStringPtr ((LPCSTR) pString, 0xffffffff))
  611. {
  612. int len = strlen ((char *) pString) + 1;
  613. WCHAR buf[MAX_STRING_PARAM_SIZE/2];
  614. MultiByteToWideChar(
  615. GetACP(),
  616. MB_PRECOMPOSED,
  617. (LPCSTR) pString,
  618. (len > MAX_STRING_PARAM_SIZE/2 ? MAX_STRING_PARAM_SIZE/2 - 1 : -1),
  619. buf,
  620. MAX_STRING_PARAM_SIZE/2
  621. );
  622. buf[MAX_STRING_PARAM_SIZE/2 - 1] = 0;
  623. My_lstrcpyW ((WCHAR *) pString, buf);
  624. }
  625. }
  626. LONG
  627. DoFunc(
  628. PFUNC_PARAM_HEADER pHeader
  629. )
  630. {
  631. LONG lResult;
  632. if (!LetUserMungeParams (pHeader))
  633. {
  634. return 0xffffffff;
  635. }
  636. #if TAPI_2_0
  637. //
  638. // Convert any unicode string params as appropriate
  639. //
  640. if (gbWideStringParams)
  641. {
  642. DWORD dwNumParams = pHeader->dwNumParams, i;
  643. PFUNC_PARAM pParam = pHeader->aParams;
  644. for (i = 0; i < dwNumParams; i++)
  645. {
  646. if (pParam->dwType == PT_STRING)
  647. {
  648. MakeWideString ((LPVOID) pParam->dwValue);
  649. }
  650. pParam++;
  651. }
  652. }
  653. #endif
  654. DumpParams (pHeader);
  655. switch (pHeader->dwNumParams)
  656. {
  657. case 1:
  658. lResult = (*pHeader->u.pfn1)(
  659. pHeader->aParams[0].dwValue
  660. );
  661. break;
  662. case 2:
  663. lResult = (*pHeader->u.pfn2)(
  664. pHeader->aParams[0].dwValue,
  665. pHeader->aParams[1].dwValue
  666. );
  667. break;
  668. case 3:
  669. lResult = (*pHeader->u.pfn3)(
  670. pHeader->aParams[0].dwValue,
  671. pHeader->aParams[1].dwValue,
  672. pHeader->aParams[2].dwValue
  673. );
  674. break;
  675. case 4:
  676. lResult = (*pHeader->u.pfn4)(
  677. pHeader->aParams[0].dwValue,
  678. pHeader->aParams[1].dwValue,
  679. pHeader->aParams[2].dwValue,
  680. pHeader->aParams[3].dwValue
  681. );
  682. break;
  683. case 5:
  684. lResult = (*pHeader->u.pfn5)(
  685. pHeader->aParams[0].dwValue,
  686. pHeader->aParams[1].dwValue,
  687. pHeader->aParams[2].dwValue,
  688. pHeader->aParams[3].dwValue,
  689. pHeader->aParams[4].dwValue
  690. );
  691. break;
  692. case 6:
  693. lResult = (*pHeader->u.pfn6)(
  694. pHeader->aParams[0].dwValue,
  695. pHeader->aParams[1].dwValue,
  696. pHeader->aParams[2].dwValue,
  697. pHeader->aParams[3].dwValue,
  698. pHeader->aParams[4].dwValue,
  699. pHeader->aParams[5].dwValue
  700. );
  701. break;
  702. case 7:
  703. lResult = (*pHeader->u.pfn7)(
  704. pHeader->aParams[0].dwValue,
  705. pHeader->aParams[1].dwValue,
  706. pHeader->aParams[2].dwValue,
  707. pHeader->aParams[3].dwValue,
  708. pHeader->aParams[4].dwValue,
  709. pHeader->aParams[5].dwValue,
  710. pHeader->aParams[6].dwValue
  711. );
  712. break;
  713. case 8:
  714. lResult = (*pHeader->u.pfn8)(
  715. pHeader->aParams[0].dwValue,
  716. pHeader->aParams[1].dwValue,
  717. pHeader->aParams[2].dwValue,
  718. pHeader->aParams[3].dwValue,
  719. pHeader->aParams[4].dwValue,
  720. pHeader->aParams[5].dwValue,
  721. pHeader->aParams[6].dwValue,
  722. pHeader->aParams[7].dwValue
  723. );
  724. break;
  725. case 9:
  726. lResult = (*pHeader->u.pfn9)(
  727. pHeader->aParams[0].dwValue,
  728. pHeader->aParams[1].dwValue,
  729. pHeader->aParams[2].dwValue,
  730. pHeader->aParams[3].dwValue,
  731. pHeader->aParams[4].dwValue,
  732. pHeader->aParams[5].dwValue,
  733. pHeader->aParams[6].dwValue,
  734. pHeader->aParams[7].dwValue,
  735. pHeader->aParams[8].dwValue
  736. );
  737. break;
  738. case 10:
  739. lResult = (*pHeader->u.pfn10)(
  740. pHeader->aParams[0].dwValue,
  741. pHeader->aParams[1].dwValue,
  742. pHeader->aParams[2].dwValue,
  743. pHeader->aParams[3].dwValue,
  744. pHeader->aParams[4].dwValue,
  745. pHeader->aParams[5].dwValue,
  746. pHeader->aParams[6].dwValue,
  747. pHeader->aParams[7].dwValue,
  748. pHeader->aParams[8].dwValue,
  749. pHeader->aParams[9].dwValue
  750. );
  751. break;
  752. default: // case 12:
  753. lResult = (*pHeader->u.pfn12)(
  754. pHeader->aParams[0].dwValue,
  755. pHeader->aParams[1].dwValue,
  756. pHeader->aParams[2].dwValue,
  757. pHeader->aParams[3].dwValue,
  758. pHeader->aParams[4].dwValue,
  759. pHeader->aParams[5].dwValue,
  760. pHeader->aParams[6].dwValue,
  761. pHeader->aParams[7].dwValue,
  762. pHeader->aParams[8].dwValue,
  763. pHeader->aParams[9].dwValue,
  764. pHeader->aParams[10].dwValue,
  765. pHeader->aParams[11].dwValue
  766. );
  767. break;
  768. }
  769. if (pHeader->FuncIndex < pClose)
  770. {
  771. ShowLineFuncResult (aFuncNames[pHeader->FuncIndex], lResult);
  772. }
  773. else if (pHeader->FuncIndex < tGetLocationInfo)
  774. {
  775. ShowPhoneFuncResult (aFuncNames[pHeader->FuncIndex], lResult);
  776. }
  777. else
  778. {
  779. ShowTapiFuncResult (aFuncNames[pHeader->FuncIndex], lResult);
  780. }
  781. return lResult;
  782. }
  783. BOOL
  784. IsLineAppSelected(
  785. void
  786. )
  787. {
  788. if (!pLineAppSel)
  789. {
  790. if (gbDisableHandleChecking)
  791. {
  792. pLineAppSel = (PMYLINEAPP) NullWidget;
  793. }
  794. else
  795. {
  796. MessageBox (ghwndMain, "Select an hLineApp", "", MB_OK);
  797. return FALSE;
  798. }
  799. }
  800. return TRUE;
  801. }
  802. BOOL
  803. IsLineSelected(
  804. void
  805. )
  806. {
  807. if (!pLineSel)
  808. {
  809. if (gbDisableHandleChecking)
  810. {
  811. pLineSel = (PMYLINE) NullWidget;
  812. }
  813. else
  814. {
  815. MessageBox (ghwndMain, "Select a Line", "", MB_OK);
  816. return FALSE;
  817. }
  818. }
  819. return TRUE;
  820. }
  821. BOOL
  822. IsCallSelected(
  823. void
  824. )
  825. {
  826. if (!pCallSel)
  827. {
  828. if (gbDisableHandleChecking)
  829. {
  830. pCallSel = (PMYCALL) NullWidget;
  831. }
  832. else
  833. {
  834. MessageBox (ghwndMain, "Select a Call", "", MB_OK);
  835. return FALSE;
  836. }
  837. }
  838. return TRUE;
  839. }
  840. BOOL
  841. IsTwoCallsSelected(
  842. void
  843. )
  844. {
  845. if (!pCallSel || !pCallSel2)
  846. {
  847. if (gbDisableHandleChecking)
  848. {
  849. if (!pCallSel)
  850. {
  851. pCallSel = (PMYCALL) NullWidget;
  852. }
  853. pCallSel2 = (PMYCALL) NullWidget;
  854. }
  855. else
  856. {
  857. MessageBox(
  858. ghwndMain,
  859. "Select a Call (must have at least two calls on same line)",
  860. "",
  861. MB_OK
  862. );
  863. return FALSE;
  864. }
  865. }
  866. return TRUE;
  867. }
  868. BOOL
  869. IsPhoneAppSelected(
  870. void
  871. )
  872. {
  873. if (!pPhoneAppSel)
  874. {
  875. if (gbDisableHandleChecking)
  876. {
  877. pPhoneAppSel = (PMYPHONEAPP) NullWidget;
  878. }
  879. else
  880. {
  881. MessageBox (ghwndMain, "Select a PhoneApp", "", MB_OK);
  882. return FALSE;
  883. }
  884. }
  885. return TRUE;
  886. }
  887. BOOL
  888. IsPhoneSelected(
  889. void
  890. )
  891. {
  892. if (!pPhoneSel)
  893. {
  894. if (gbDisableHandleChecking)
  895. {
  896. pPhoneSel = (PMYPHONE) NullWidget;
  897. }
  898. else
  899. {
  900. MessageBox (ghwndMain, "Select a Phone", "", MB_OK);
  901. return FALSE;
  902. }
  903. }
  904. return TRUE;
  905. }
  906. //
  907. // We get a slough of C4113 (func param lists differed) warnings down below
  908. // in the initialization of FUNC_PARAM_HEADER structs as a result of the
  909. // real func prototypes having params that are pointers rather than DWORDs,
  910. // so since these are known non-interesting warnings just turn them off
  911. //
  912. #pragma warning (disable:4113)
  913. //#pragma code_seg ("myseg")
  914. void
  915. FuncDriver(
  916. FUNC_INDEX funcIndex
  917. )
  918. {
  919. int i;
  920. LONG lResult;
  921. #if TAPI_2_0
  922. //
  923. // Determine if we're doing a ascii or a unicode op
  924. //
  925. gbWideStringParams =
  926. ((aFuncNames[funcIndex])[strlen (aFuncNames[funcIndex]) - 1] == 'W' ?
  927. TRUE : FALSE);
  928. #endif
  929. switch (funcIndex)
  930. {
  931. case lAccept:
  932. {
  933. char szUserUserInfo[MAX_STRING_PARAM_SIZE];
  934. FUNC_PARAM params[] =
  935. {
  936. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  937. { szlpsUserUserInfo, PT_STRING, (ULONG_PTR) szUserUserInfo, szUserUserInfo },
  938. { szdwSize, PT_DWORD, (ULONG_PTR) strlen(szDefUserUserInfo)+1, NULL }
  939. };
  940. FUNC_PARAM_HEADER paramsHeader =
  941. { 3, funcIndex, params, (PFN3) lineAccept };
  942. CHK_CALL_SELECTED()
  943. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  944. strcpy (szUserUserInfo, szDefUserUserInfo);
  945. lResult = DoFunc (&paramsHeader);
  946. break;
  947. }
  948. case lAddToConference:
  949. {
  950. FUNC_PARAM params[] =
  951. {
  952. { "hConfCall", PT_DWORD, (ULONG_PTR) 0, NULL },
  953. { "hConsultCall", PT_DWORD, (ULONG_PTR) 0, NULL }
  954. };
  955. FUNC_PARAM_HEADER paramsHeader =
  956. { 2, funcIndex, params, (PFN2) lineAddToConference };
  957. CHK_TWO_CALLS_SELECTED()
  958. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  959. params[1].dwValue = (ULONG_PTR) pCallSel2->hCall;
  960. lResult = DoFunc (&paramsHeader);
  961. break;
  962. }
  963. #if TAPI_2_0
  964. case lAgentSpecific:
  965. {
  966. FUNC_PARAM params[] =
  967. {
  968. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  969. { szdwAddressID, PT_DWORD, (ULONG_PTR) 0, NULL },
  970. { "dwAgentExtensionIDIndex", PT_DWORD, (ULONG_PTR) 0, NULL },
  971. { szlpParams, PT_STRING, (ULONG_PTR) pBigBuf, pBigBuf },
  972. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  973. };
  974. FUNC_PARAM_HEADER paramsHeader =
  975. { 5, funcIndex, params, (PFN5) lineAgentSpecific };
  976. CHK_LINE_SELECTED()
  977. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  978. lResult = DoFunc (&paramsHeader);
  979. break;
  980. }
  981. #endif
  982. case lAnswer:
  983. {
  984. char szUserUserInfo[MAX_STRING_PARAM_SIZE];
  985. FUNC_PARAM params[] =
  986. {
  987. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  988. { szlpsUserUserInfo, PT_STRING, (ULONG_PTR) szUserUserInfo, szUserUserInfo },
  989. { szdwSize, PT_DWORD, (ULONG_PTR) strlen(szDefUserUserInfo)+1, NULL }
  990. };
  991. FUNC_PARAM_HEADER paramsHeader =
  992. { 3, funcIndex, params, (PFN3) lineAnswer };
  993. CHK_CALL_SELECTED()
  994. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  995. strcpy (szUserUserInfo, szDefUserUserInfo);
  996. lResult = DoFunc (&paramsHeader);
  997. break;
  998. }
  999. case lBlindTransfer:
  1000. #if TAPI_2_0
  1001. case lBlindTransferW:
  1002. #endif
  1003. {
  1004. char szDestAddress[MAX_STRING_PARAM_SIZE];
  1005. FUNC_PARAM params[] =
  1006. {
  1007. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1008. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress },
  1009. { "dwCountryCode", PT_DWORD, (ULONG_PTR) dwDefCountryCode, NULL }
  1010. };
  1011. #if TAPI_2_0
  1012. FUNC_PARAM_HEADER paramsHeader =
  1013. { 3, funcIndex, params, (funcIndex == lBlindTransfer ?
  1014. (PFN3) lineBlindTransfer : (PFN3) lineBlindTransferW) };
  1015. #else
  1016. FUNC_PARAM_HEADER paramsHeader =
  1017. { 3, funcIndex, params, (PFN3) lineBlindTransfer };
  1018. #endif
  1019. CHK_CALL_SELECTED()
  1020. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1021. strcpy (szDestAddress, szDefDestAddress);
  1022. lResult = DoFunc (&paramsHeader);
  1023. break;
  1024. }
  1025. case lClose:
  1026. {
  1027. FUNC_PARAM params[] =
  1028. {
  1029. { szhLine, PT_DWORD, 0, NULL }
  1030. };
  1031. FUNC_PARAM_HEADER paramsHeader =
  1032. { 1, funcIndex, params, (PFN1) lineClose };
  1033. CHK_LINE_SELECTED()
  1034. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1035. if ((lResult = DoFunc(&paramsHeader)) == 0)
  1036. {
  1037. FreeLine (GetLine((HLINE) params[0].dwValue));
  1038. }
  1039. break;
  1040. }
  1041. case lCompleteCall:
  1042. {
  1043. FUNC_PARAM params[] =
  1044. {
  1045. { szhCall, PT_DWORD, 0, NULL },
  1046. { "lpdwCompletionID", PT_POINTER, 0, NULL },
  1047. { "dwCompletionMode", PT_FLAGS, LINECALLCOMPLMODE_CAMPON, aCallComplModes },
  1048. { "dwMessageID", PT_DWORD, 0, NULL },
  1049. };
  1050. FUNC_PARAM_HEADER paramsHeader =
  1051. { 4, funcIndex, params, (PFN4) lineCompleteCall };
  1052. CHK_CALL_SELECTED()
  1053. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1054. params[1].dwValue = (ULONG_PTR) &pCallSel->dwCompletionID;
  1055. // BUGBUG if user chgs hCall the wrong &pCallSel->dwCompletionID filled in
  1056. DoFunc(&paramsHeader);
  1057. break;
  1058. }
  1059. case lCompleteTransfer:
  1060. {
  1061. PMYCALL pNewCall;
  1062. FUNC_PARAM params[] =
  1063. {
  1064. { szhCall, PT_DWORD, 0, NULL },
  1065. { "hConsultCall", PT_DWORD, 0, NULL },
  1066. { "lphConfCall", PT_POINTER, 0, NULL },
  1067. { "dwTransferMode", PT_ORDINAL, LINETRANSFERMODE_TRANSFER, aTransferModes }
  1068. };
  1069. FUNC_PARAM_HEADER paramsHeader =
  1070. { 4, funcIndex, params, (PFN4) lineCompleteTransfer };
  1071. CHK_TWO_CALLS_SELECTED()
  1072. if (!(pNewCall = AllocCall (pLineSel)))
  1073. {
  1074. break;
  1075. }
  1076. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1077. params[1].dwValue = (ULONG_PTR) pCallSel2->hCall;
  1078. params[2].dwValue =
  1079. params[2].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  1080. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  1081. {
  1082. //
  1083. // First make sure we're created the call under the right line,
  1084. // and if not move it to the right place in the widgets list
  1085. //
  1086. LINECALLINFO callInfo;
  1087. memset (&callInfo, 0, sizeof(LINECALLINFO));
  1088. callInfo.dwTotalSize = sizeof(LINECALLINFO);
  1089. if (lineGetCallInfo ((HCALL) params[0].dwValue, &callInfo) == 0)
  1090. {
  1091. if (callInfo.hLine != pLineSel->hLine)
  1092. {
  1093. MoveCallToLine (pNewCall, callInfo.hLine);
  1094. }
  1095. }
  1096. pNewCall->lMakeCallReqID = lResult;
  1097. dwNumPendingMakeCalls++;
  1098. SelectWidget ((PMYWIDGET) pNewCall);
  1099. }
  1100. else
  1101. {
  1102. FreeCall (pNewCall);
  1103. }
  1104. break;
  1105. }
  1106. case lConfigDialog:
  1107. #if TAPI_2_0
  1108. case lConfigDialogW:
  1109. #endif
  1110. {
  1111. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  1112. FUNC_PARAM params[] =
  1113. {
  1114. { szdwDeviceID, PT_DWORD, dwDefLineDeviceID, NULL },
  1115. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1116. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass }
  1117. };
  1118. #if TAPI_2_0
  1119. FUNC_PARAM_HEADER paramsHeader =
  1120. { 3, funcIndex, params, (funcIndex == lConfigDialog ?
  1121. (PFN3) lineConfigDialog : (PFN3) lineConfigDialogW) };
  1122. #else
  1123. FUNC_PARAM_HEADER paramsHeader =
  1124. { 3, funcIndex, params, (PFN3) lineConfigDialog };
  1125. #endif
  1126. CHK_LINEAPP_SELECTED()
  1127. strcpy (szDeviceClass, szDefLineDeviceClass);
  1128. #ifdef WIN32
  1129. lResult = DoFunc (&paramsHeader);
  1130. #else
  1131. //
  1132. // NOTE: on win16 HWNDSs are 16 bits, so we've to hard code this
  1133. //
  1134. if (!LetUserMungeParams (&paramsHeader))
  1135. {
  1136. break;
  1137. }
  1138. DumpParams (&paramsHeader);
  1139. lResult = lineConfigDialog(
  1140. params[0].dwValue,
  1141. (HWND) params[1].dwValue,
  1142. (LPCSTR) params[2].dwValue
  1143. );
  1144. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1145. #endif
  1146. break;
  1147. }
  1148. case lDeallocateCall:
  1149. {
  1150. FUNC_PARAM params[] =
  1151. {
  1152. { szhCall, PT_DWORD, 0, NULL }
  1153. };
  1154. FUNC_PARAM_HEADER paramsHeader =
  1155. { 1, funcIndex, params, (PFN1) lineDeallocateCall };
  1156. CHK_CALL_SELECTED()
  1157. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1158. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1159. {
  1160. FreeCall (GetCall((HCALL) params[0].dwValue));
  1161. }
  1162. break;
  1163. }
  1164. case lDevSpecific:
  1165. {
  1166. FUNC_PARAM params[] =
  1167. {
  1168. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1169. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1170. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1171. { szlpParams, PT_STRING, (ULONG_PTR) pBigBuf, pBigBuf },
  1172. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  1173. };
  1174. FUNC_PARAM_HEADER paramsHeader =
  1175. { 5, funcIndex, params, (PFN5) lineDevSpecific };
  1176. CHK_LINE_SELECTED()
  1177. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1178. if (pCallSel)
  1179. {
  1180. params[2].dwValue = (ULONG_PTR) pCallSel->hCall;
  1181. }
  1182. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  1183. DoFunc (&paramsHeader);
  1184. break;
  1185. }
  1186. case lDevSpecificFeature:
  1187. {
  1188. FUNC_PARAM params[] =
  1189. {
  1190. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1191. // { "dwFeature", PT_???, 0, aPhoneButtonFunctions },
  1192. { "dwFeature", PT_DWORD, (ULONG_PTR) 0, NULL },
  1193. { szlpParams, PT_STRING, (ULONG_PTR) pBigBuf, pBigBuf },
  1194. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  1195. };
  1196. FUNC_PARAM_HEADER paramsHeader =
  1197. { 4, funcIndex, params, (PFN4) lineDevSpecificFeature };
  1198. // BUGBUG need another PT_ type for constants for dwFeature param
  1199. CHK_LINE_SELECTED()
  1200. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1201. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  1202. DoFunc (&paramsHeader);
  1203. break;
  1204. }
  1205. case lDial:
  1206. #if TAPI_2_0
  1207. case lDialW:
  1208. #endif
  1209. {
  1210. char szAddress[MAX_STRING_PARAM_SIZE];
  1211. FUNC_PARAM params[] =
  1212. {
  1213. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1214. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szAddress, szAddress },
  1215. { "dwCountryCode", PT_DWORD, (ULONG_PTR) dwDefCountryCode, NULL }
  1216. };
  1217. #if TAPI_2_0
  1218. FUNC_PARAM_HEADER paramsHeader =
  1219. { 3, funcIndex, params, (funcIndex == lDial ?
  1220. (PFN3) lineDial : (PFN3) lineDialW) };
  1221. #else
  1222. FUNC_PARAM_HEADER paramsHeader =
  1223. { 3, funcIndex, params, (PFN3) lineDial };
  1224. #endif
  1225. CHK_CALL_SELECTED()
  1226. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1227. strcpy (szAddress, szDefDestAddress);
  1228. lResult = DoFunc (&paramsHeader);
  1229. break;
  1230. }
  1231. case lDrop:
  1232. {
  1233. char szUserUserInfo[MAX_STRING_PARAM_SIZE];
  1234. FUNC_PARAM params[] =
  1235. {
  1236. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1237. { szlpsUserUserInfo, PT_STRING, (ULONG_PTR) szUserUserInfo, szUserUserInfo },
  1238. { szdwSize, PT_DWORD, (ULONG_PTR) strlen(szDefUserUserInfo)+1, NULL }
  1239. };
  1240. FUNC_PARAM_HEADER paramsHeader =
  1241. { 3, funcIndex, params, (PFN3) lineDrop };
  1242. CHK_CALL_SELECTED()
  1243. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1244. strcpy (szUserUserInfo, szDefUserUserInfo);
  1245. lResult = DoFunc (&paramsHeader);
  1246. // assert (lResult != 0);
  1247. if (gbDeallocateCall && (lResult > 0))
  1248. {
  1249. PMYCALL pCall = GetCall ((HCALL) params[0].dwValue);
  1250. dwNumPendingDrops++;
  1251. pCall->lDropReqID = lResult;
  1252. }
  1253. break;
  1254. }
  1255. case lForward:
  1256. #if TAPI_2_0
  1257. case lForwardW:
  1258. #endif
  1259. {
  1260. PMYCALL pNewCall;
  1261. FUNC_PARAM params[] =
  1262. {
  1263. { szhLine, PT_DWORD, 0, NULL },
  1264. { "bAllAddresses", PT_DWORD, 1, NULL },
  1265. { szdwAddressID, PT_DWORD, 0, NULL },
  1266. { "lpForwardList", PT_FORWARDLIST, 0, NULL },
  1267. { "dwNumRingsNoAnswer", PT_DWORD, 5, NULL },
  1268. { szlphConsultCall, PT_POINTER, 0, NULL },
  1269. { szlpCallParams, PT_CALLPARAMS, 0, lpCallParams }
  1270. };
  1271. #if TAPI_2_0
  1272. FUNC_PARAM_HEADER paramsHeader =
  1273. { 7, funcIndex, params, (funcIndex == lForward ?
  1274. (PFN7) lineForward : (PFN7) lineForwardW) };
  1275. #else
  1276. FUNC_PARAM_HEADER paramsHeader =
  1277. { 7, funcIndex, params, (PFN7) lineForward };
  1278. #endif
  1279. LPLINEFORWARDLIST lpForwardList;
  1280. DWORD dwTotalSize = sizeof(LINEFORWARDLIST) +
  1281. MAX_LINEFORWARD_ENTRIES *
  1282. (sizeof(LINEFORWARD) + 2*MAX_STRING_PARAM_SIZE);
  1283. CHK_LINE_SELECTED()
  1284. if (!(lpForwardList = malloc (dwTotalSize)))
  1285. {
  1286. ErrorAlert();
  1287. ShowStr ("error alloc'ing data structure");
  1288. break;
  1289. }
  1290. memset (lpForwardList, 0, dwTotalSize);
  1291. lpForwardList->dwTotalSize = dwTotalSize;
  1292. lpForwardList->dwNumEntries = 0;
  1293. if (!(pNewCall = AllocCall (pLineSel)))
  1294. {
  1295. ErrorAlert();
  1296. ShowStr ("error creating data structure");
  1297. free (lpForwardList);
  1298. break;
  1299. }
  1300. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1301. params[3].dwValue =
  1302. params[3].u.dwDefValue = (ULONG_PTR) lpForwardList;
  1303. params[5].dwValue =
  1304. params[5].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  1305. if ((lResult = DoFunc (&paramsHeader)) > 0)
  1306. {
  1307. if (params[0].dwValue != (ULONG_PTR) pLineSel->hLine)
  1308. {
  1309. MoveCallToLine (pNewCall, (HLINE) params[0].dwValue);
  1310. }
  1311. pNewCall->lMakeCallReqID = lResult;
  1312. dwNumPendingMakeCalls++;
  1313. SelectWidget ((PMYWIDGET) pNewCall);
  1314. }
  1315. else
  1316. {
  1317. FreeCall (pNewCall);
  1318. }
  1319. free (lpForwardList);
  1320. break;
  1321. }
  1322. case lGatherDigits:
  1323. #if TAPI_2_0
  1324. case lGatherDigitsW:
  1325. #endif
  1326. {
  1327. char *buf;
  1328. char szTermDigits[MAX_STRING_PARAM_SIZE] = "";
  1329. FUNC_PARAM params[] =
  1330. {
  1331. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1332. { "dwDigitModes", PT_FLAGS, (ULONG_PTR) LINEDIGITMODE_DTMF, aDigitModes },
  1333. { "lpsDigits", PT_POINTER, (ULONG_PTR) 0, NULL },
  1334. { "dwNumDigits", PT_DWORD, (ULONG_PTR) 0, NULL },
  1335. { "lpszTerminationDigits", PT_STRING, (ULONG_PTR) szTermDigits, szTermDigits },
  1336. { "dwFirstDigitTimeout", PT_DWORD, (ULONG_PTR) 0x8000, NULL },
  1337. { "dwInterDigitTimeout", PT_DWORD, (ULONG_PTR) 0x8000, NULL },
  1338. };
  1339. #if TAPI_2_0
  1340. FUNC_PARAM_HEADER paramsHeader =
  1341. { 7, funcIndex, params, (funcIndex == lGatherDigits ?
  1342. (PFN7) lineGatherDigits : (PFN7) lineGatherDigitsW) };
  1343. #else
  1344. FUNC_PARAM_HEADER paramsHeader =
  1345. { 7, funcIndex, params, (PFN7) lineGatherDigits };
  1346. #endif
  1347. CHK_CALL_SELECTED()
  1348. #define DEF_NUM_GATHERED_DIGITS 64
  1349. if (!(buf = (char *) malloc ((DEF_NUM_GATHERED_DIGITS + 1) * 2)))
  1350. {
  1351. ShowStr ("failed to allocate memory");
  1352. break;
  1353. }
  1354. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1355. params[2].dwValue =
  1356. params[2].u.dwDefValue = (ULONG_PTR) buf;
  1357. params[3].dwValue = DEF_NUM_GATHERED_DIGITS;
  1358. memset (buf, 0, DEF_NUM_GATHERED_DIGITS * 2);
  1359. if (!LetUserMungeParams (&paramsHeader))
  1360. {
  1361. break;
  1362. }
  1363. if (params[0].dwValue != (DWORD) pCallSel->hCall)
  1364. {
  1365. pCallSel = GetCall ((HCALL) params[0].dwValue);
  1366. }
  1367. if (params[2].dwValue == (ULONG_PTR) buf &&
  1368. params[3].dwValue > DEF_NUM_GATHERED_DIGITS)
  1369. {
  1370. if (MessageBox(
  1371. ghwndMain,
  1372. "Do you want to allocate a larger GatherDigits buffer?" \
  1373. "(Not doing so may cause undefined app behavior.)",
  1374. "Warning: lineGatherDigits",
  1375. MB_YESNO
  1376. ) == IDYES)
  1377. {
  1378. free (buf);
  1379. // Note: we get weird errors in malloc when specifying a
  1380. // size > 0xffffff00, so special case
  1381. if (params[3].dwValue > 0x10000)
  1382. {
  1383. ShowStr ("sorry, too many digits.");
  1384. break;
  1385. }
  1386. buf = (char *) malloc ((size_t) (params[3].dwValue + 1) * 2);
  1387. if (!(params[2].dwValue = (ULONG_PTR) buf))
  1388. {
  1389. ShowStr ("failed to allocate memory");
  1390. break;
  1391. }
  1392. memset (buf, 0, (size_t) params[3].dwValue * 2);
  1393. }
  1394. }
  1395. if (pCallSel->lpsGatheredDigits && params[2].dwValue)
  1396. {
  1397. if (MessageBox(
  1398. ghwndMain,
  1399. "GatherDigits already in progress on this hCall; if you" \
  1400. "continue previous digits buffer may be discarded" \
  1401. "without being freed",
  1402. "Warning: lineGatherDigits",
  1403. MB_OKCANCEL
  1404. ) == IDCANCEL)
  1405. {
  1406. if (buf)
  1407. {
  1408. free (buf);
  1409. }
  1410. break;
  1411. }
  1412. }
  1413. DumpParams (&paramsHeader);
  1414. #if TAPI_2_0
  1415. if (funcIndex == lGatherDigits)
  1416. {
  1417. lResult = lineGatherDigits(
  1418. (HCALL) params[0].dwValue,
  1419. (DWORD) params[1].dwValue,
  1420. (LPSTR) params[2].dwValue,
  1421. (DWORD) params[3].dwValue,
  1422. (LPCSTR) params[4].dwValue,
  1423. (DWORD) params[5].dwValue,
  1424. (DWORD) params[6].dwValue
  1425. );
  1426. }
  1427. else
  1428. {
  1429. MakeWideString (szTermDigits);
  1430. lResult = lineGatherDigitsW(
  1431. (HCALL) params[0].dwValue,
  1432. (DWORD) params[1].dwValue,
  1433. (LPWSTR) params[2].dwValue,
  1434. (DWORD) params[3].dwValue,
  1435. (LPCWSTR) params[4].dwValue,
  1436. (DWORD) params[5].dwValue,
  1437. (DWORD) params[6].dwValue
  1438. );
  1439. }
  1440. #else
  1441. lResult = lineGatherDigits(
  1442. (HCALL) params[0].dwValue,
  1443. params[1].dwValue,
  1444. (LPSTR) params[2].dwValue,
  1445. params[3].dwValue,
  1446. (LPCSTR) params[4].dwValue,
  1447. params[5].dwValue,
  1448. params[6].dwValue
  1449. );
  1450. #endif
  1451. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1452. if (lResult) // FAILURE
  1453. {
  1454. if (buf)
  1455. {
  1456. free (buf);
  1457. }
  1458. }
  1459. else // SUCCESS
  1460. {
  1461. if (pCallSel->lpsGatheredDigits)
  1462. {
  1463. //free (pCallSel->lpsGatheredDigits);
  1464. }
  1465. pCallSel->lpsGatheredDigits = (char *) params[2].dwValue;
  1466. pCallSel->dwNumGatheredDigits = (DWORD) params[3].dwValue;
  1467. #if TAPI_2_0
  1468. if (funcIndex == lGatherDigitsW)
  1469. {
  1470. pCallSel->dwNumGatheredDigits *= 2;
  1471. }
  1472. #endif
  1473. }
  1474. break;
  1475. }
  1476. case lGenerateDigits:
  1477. #if TAPI_2_0
  1478. case lGenerateDigitsW:
  1479. #endif
  1480. {
  1481. char szDigits[MAX_STRING_PARAM_SIZE] = "123";
  1482. FUNC_PARAM params[] =
  1483. {
  1484. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1485. { "dwDigitMode", PT_FLAGS, (ULONG_PTR) LINEDIGITMODE_DTMF, aDigitModes },
  1486. { "lpszDigits", PT_STRING, (ULONG_PTR) szDigits, szDigits },
  1487. { "dwDuration", PT_DWORD, (ULONG_PTR) 0, NULL }
  1488. };
  1489. #if TAPI_2_0
  1490. FUNC_PARAM_HEADER paramsHeader =
  1491. { 4, funcIndex, params, (funcIndex == lGenerateDigits ?
  1492. (PFN4) lineGenerateDigits : (PFN4) lineGenerateDigitsW) };
  1493. #else
  1494. FUNC_PARAM_HEADER paramsHeader =
  1495. { 4, funcIndex, params, (PFN4) lineGenerateDigits };
  1496. #endif
  1497. CHK_CALL_SELECTED()
  1498. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1499. lResult = DoFunc (&paramsHeader);
  1500. break;
  1501. }
  1502. case lGenerateTone:
  1503. {
  1504. FUNC_PARAM params[] =
  1505. {
  1506. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1507. { "dwToneMode", PT_FLAGS, (ULONG_PTR) LINETONEMODE_CUSTOM, aToneModes },
  1508. { "dwDuration", PT_DWORD, (ULONG_PTR) 0, NULL },
  1509. { "dwNumTones", PT_DWORD, (ULONG_PTR) 1, NULL },
  1510. { "lpTones", PT_POINTER, (ULONG_PTR) pBigBuf, pBigBuf }
  1511. };
  1512. FUNC_PARAM_HEADER paramsHeader =
  1513. { 5, funcIndex, params, (PFN5) lineGenerateTone };
  1514. CHK_CALL_SELECTED()
  1515. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1516. lResult = DoFunc (&paramsHeader);
  1517. break;
  1518. }
  1519. case lGetAddressCaps:
  1520. #if TAPI_2_0
  1521. case lGetAddressCapsW:
  1522. #endif
  1523. {
  1524. LPLINEADDRESSCAPS lpAddrCaps = (LPLINEADDRESSCAPS) pBigBuf;
  1525. FUNC_PARAM params[] =
  1526. {
  1527. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1528. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  1529. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1530. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1531. { "dwExtVersion", PT_DWORD, (ULONG_PTR) dwDefLineExtVersion, NULL },
  1532. { "lpAddressCaps", PT_POINTER, (ULONG_PTR) lpAddrCaps, lpAddrCaps }
  1533. };
  1534. #if TAPI_2_0
  1535. FUNC_PARAM_HEADER paramsHeader =
  1536. { 6, funcIndex, params, (funcIndex == lGetAddressCaps ?
  1537. (PFN6) lineGetAddressCaps : (PFN6) lineGetAddressCapsW) };
  1538. #else
  1539. FUNC_PARAM_HEADER paramsHeader =
  1540. { 6, funcIndex, params, (PFN6) lineGetAddressCaps };
  1541. #endif
  1542. CHK_LINEAPP_SELECTED()
  1543. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1544. memset (lpAddrCaps, 0, (size_t) dwBigBufSize);
  1545. lpAddrCaps->dwTotalSize = dwBigBufSize;
  1546. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1547. {
  1548. ShowStructByDWORDs (lpAddrCaps);
  1549. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1550. {
  1551. STRUCT_FIELD fields[] =
  1552. {
  1553. { "dwLineDeviceID", FT_DWORD, lpAddrCaps->dwLineDeviceID, NULL },
  1554. { "dwAddressSize", FT_SIZE, lpAddrCaps->dwAddressSize, NULL },
  1555. { "dwAddressOffset", FT_OFFSET, lpAddrCaps->dwAddressOffset, NULL },
  1556. { "dwDevSpecificSize", FT_SIZE, lpAddrCaps->dwDevSpecificSize, NULL },
  1557. { "dwDevSpecificOffset", FT_OFFSET, lpAddrCaps->dwDevSpecificOffset, NULL },
  1558. { "dwAddressSharing", FT_FLAGS, lpAddrCaps->dwAddressSharing, aAddressSharing },
  1559. { "dwAddressStates", FT_FLAGS, lpAddrCaps->dwAddressStates, aAddressStates },
  1560. { "dwCallInfoStates", FT_FLAGS, lpAddrCaps->dwCallInfoStates, aCallInfoStates },
  1561. { "dwCallerIDFlags", FT_FLAGS, lpAddrCaps->dwCallerIDFlags, aCallerIDFlags },
  1562. { "dwCalledIDFlags", FT_FLAGS, lpAddrCaps->dwCalledIDFlags, aCallerIDFlags },
  1563. { "dwConnectedIDFlags", FT_FLAGS, lpAddrCaps->dwConnectedIDFlags, aCallerIDFlags },
  1564. { "dwRedirectionIDFlags", FT_FLAGS, lpAddrCaps->dwRedirectionIDFlags, aCallerIDFlags },
  1565. { "dwRedirectingIDFlags", FT_FLAGS, lpAddrCaps->dwRedirectingIDFlags, aCallerIDFlags },
  1566. { "dwCallStates", FT_FLAGS, lpAddrCaps->dwCallStates, aCallStates },
  1567. { "dwDialToneModes", FT_FLAGS, lpAddrCaps->dwDialToneModes, aDialToneModes },
  1568. { "dwBusyModes", FT_FLAGS, lpAddrCaps->dwBusyModes, aBusyModes },
  1569. { "dwSpecialInfo", FT_FLAGS, lpAddrCaps->dwSpecialInfo, aSpecialInfo },
  1570. { "dwDisconnectModes", FT_FLAGS, lpAddrCaps->dwDisconnectModes, aDisconnectModes },
  1571. { "dwMaxNumActiveCalls", FT_DWORD, lpAddrCaps->dwMaxNumActiveCalls, NULL },
  1572. { "dwMaxNumOnHoldCalls", FT_DWORD, lpAddrCaps->dwMaxNumOnHoldCalls, NULL },
  1573. { "dwMaxNumOnHoldPendingCalls", FT_DWORD, lpAddrCaps->dwMaxNumOnHoldPendingCalls, NULL },
  1574. { "dwMaxNumConference", FT_DWORD, lpAddrCaps->dwMaxNumConference, NULL },
  1575. { "dwMaxNumTransConf", FT_DWORD, lpAddrCaps->dwMaxNumTransConf, NULL },
  1576. { "dwAddrCapFlags", FT_FLAGS, lpAddrCaps->dwAddrCapFlags, aAddressCapFlags },
  1577. { "dwCallFeatures", FT_FLAGS, lpAddrCaps->dwCallFeatures, aCallFeatures },
  1578. { "dwRemoveFromConfCaps", FT_ORD, lpAddrCaps->dwRemoveFromConfCaps, aRemoveFromConfCaps },
  1579. { "dwRemoveFromConfState", FT_FLAGS, lpAddrCaps->dwRemoveFromConfState, aCallStates },
  1580. { "dwTransferModes", FT_FLAGS, lpAddrCaps->dwTransferModes, aTransferModes },
  1581. { "dwParkModes", FT_FLAGS, lpAddrCaps->dwParkModes, aParkModes },
  1582. { "dwForwardModes", FT_FLAGS, lpAddrCaps->dwForwardModes, aForwardModes },
  1583. { "dwMaxForwardEntries", FT_DWORD, lpAddrCaps->dwMaxForwardEntries, NULL },
  1584. { "dwMaxSpecificEntries", FT_DWORD, lpAddrCaps->dwMaxSpecificEntries, NULL },
  1585. { "dwMinFwdNumRings", FT_DWORD, lpAddrCaps->dwMinFwdNumRings, NULL },
  1586. { "dwMaxFwdNumRings", FT_DWORD, lpAddrCaps->dwMaxFwdNumRings, NULL },
  1587. { "dwMaxCallCompletions", FT_DWORD, lpAddrCaps->dwMaxCallCompletions, NULL },
  1588. { "dwCallCompletionConds", FT_FLAGS, lpAddrCaps->dwCallCompletionConds, aCallComplConds },
  1589. { "dwCallCompletionModes", FT_FLAGS, lpAddrCaps->dwCallCompletionModes, aCallComplModes },
  1590. { "dwNumCompletionMessages", FT_DWORD, lpAddrCaps->dwNumCompletionMessages, NULL },
  1591. { "dwCompletionMsgTextEntrySize", FT_DWORD, lpAddrCaps->dwCompletionMsgTextEntrySize, NULL },
  1592. { "dwCompletionMsgTextSize", FT_SIZE, lpAddrCaps->dwCompletionMsgTextSize, NULL },
  1593. { "dwCompletionMsgTextOffset", FT_OFFSET, lpAddrCaps->dwCompletionMsgTextOffset, NULL }
  1594. #if TAPI_1_1
  1595. ,
  1596. { "dwAddressFeatures", FT_FLAGS, 0, aAddressFeatures }
  1597. #if TAPI_2_0
  1598. ,
  1599. { "dwPredictiveAutoTransferStates", FT_FLAGS, 0, aCallStates },
  1600. { "dwNumCallTreatments", FT_DWORD, 0, NULL },
  1601. { "dwCallTreatmentListSize", FT_SIZE, 0, NULL },
  1602. { "dwCallTreatmentListOffset", FT_OFFSET, 0, NULL },
  1603. { "dwDeviceClassesSize", FT_SIZE, 0, NULL },
  1604. { "dwDeviceClassesOffset", FT_OFFSET, 0, NULL },
  1605. { "dwMaxCallDataSize", FT_DWORD, 0, NULL },
  1606. { "dwCallFeatures2", FT_FLAGS, 0, aCallFeatures2 },
  1607. { "dwMaxNoAnswerTimeout", FT_DWORD, 0, NULL },
  1608. { "dwConnectedModes", FT_FLAGS, 0, aConnectedModes },
  1609. { "dwOfferingModes", FT_FLAGS, 0, aOfferingModes },
  1610. { "dwAvailableMediaModes", FT_FLAGS, 0, aMediaModes }
  1611. #endif
  1612. #endif
  1613. };
  1614. STRUCT_FIELD_HEADER fieldHeader =
  1615. {
  1616. lpAddrCaps, "LINEADDRESSCAPS", 0, fields
  1617. };
  1618. if (params[3].dwValue == 0x10003)
  1619. {
  1620. //
  1621. // Only show ver 1.0 params
  1622. //
  1623. fieldHeader.dwNumFields = 41;
  1624. }
  1625. #if TAPI_1_1
  1626. else if (params[3].dwValue == 0x10004)
  1627. {
  1628. //
  1629. // Only show <= ver 1.4 params
  1630. //
  1631. fieldHeader.dwNumFields = 42;
  1632. fields[41].dwValue = lpAddrCaps->dwAddressFeatures;
  1633. }
  1634. #if TAPI_2_0
  1635. else
  1636. {
  1637. //
  1638. // Only show <= ver 2.0 params
  1639. //
  1640. fieldHeader.dwNumFields = 54;
  1641. fields[41].dwValue = lpAddrCaps->dwAddressFeatures;
  1642. fields[42].dwValue = lpAddrCaps->dwPredictiveAutoTransferStates;
  1643. fields[43].dwValue = lpAddrCaps->dwNumCallTreatments;
  1644. fields[44].dwValue = lpAddrCaps->dwCallTreatmentListSize;
  1645. fields[45].dwValue = lpAddrCaps->dwCallTreatmentListOffset;
  1646. fields[46].dwValue = lpAddrCaps->dwDeviceClassesSize;
  1647. fields[47].dwValue = lpAddrCaps->dwDeviceClassesOffset;
  1648. fields[48].dwValue = lpAddrCaps->dwMaxCallDataSize;
  1649. fields[49].dwValue = lpAddrCaps->dwCallFeatures2;
  1650. fields[50].dwValue = lpAddrCaps->dwMaxNoAnswerTimeout;
  1651. fields[51].dwValue = lpAddrCaps->dwConnectedModes;
  1652. fields[52].dwValue = lpAddrCaps->dwOfferingModes;
  1653. fields[53].dwValue = lpAddrCaps->dwAvailableMediaModes;
  1654. }
  1655. #endif
  1656. #endif
  1657. ShowStructByField (&fieldHeader, FALSE);
  1658. }
  1659. }
  1660. break;
  1661. }
  1662. case lGetAddressID:
  1663. #if TAPI_2_0
  1664. case lGetAddressIDW:
  1665. #endif
  1666. {
  1667. DWORD dwAddressID;
  1668. char szAddress[MAX_STRING_PARAM_SIZE] = "0";
  1669. LPLINEADDRESSCAPS lpAddrCaps = (LPLINEADDRESSCAPS) pBigBuf;
  1670. FUNC_PARAM params[] =
  1671. {
  1672. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1673. { "lpdwAddressID", PT_POINTER, (ULONG_PTR) &dwAddressID, &dwAddressID },
  1674. { "dwAddressMode", PT_FLAGS, (ULONG_PTR) LINEADDRESSMODE_DIALABLEADDR, aAddressModes },
  1675. { "lpsAddress", PT_STRING, (ULONG_PTR) szAddress, szAddress },
  1676. { szdwSize, PT_DWORD, (ULONG_PTR) 2, NULL }
  1677. };
  1678. #if TAPI_2_0
  1679. FUNC_PARAM_HEADER paramsHeader =
  1680. { 5, funcIndex, params, (funcIndex == lGetAddressID ?
  1681. (PFN5) lineGetAddressID : (PFN5) lineGetAddressIDW) };
  1682. #else
  1683. FUNC_PARAM_HEADER paramsHeader =
  1684. { 5, funcIndex, params, (PFN5) lineGetAddressID };
  1685. #endif
  1686. CHK_LINE_SELECTED()
  1687. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1688. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1689. {
  1690. ShowStr ("%s%s=x%lx", szTab, szdwAddressID, dwAddressID);
  1691. }
  1692. break;
  1693. }
  1694. case lGetAddressStatus:
  1695. #if TAPI_2_0
  1696. case lGetAddressStatusW:
  1697. #endif
  1698. {
  1699. LPLINEADDRESSSTATUS lpAddrStatus = (LPLINEADDRESSSTATUS) pBigBuf;
  1700. FUNC_PARAM params[] =
  1701. {
  1702. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1703. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1704. { "lpAddressCaps", PT_POINTER, (ULONG_PTR) lpAddrStatus, lpAddrStatus }
  1705. };
  1706. #if TAPI_2_0
  1707. FUNC_PARAM_HEADER paramsHeader =
  1708. { 3, funcIndex, params, (funcIndex == lGetAddressStatus ?
  1709. (PFN3) lineGetAddressStatus : (PFN3) lineGetAddressStatusW) };
  1710. #else
  1711. FUNC_PARAM_HEADER paramsHeader =
  1712. { 3, funcIndex, params, (PFN3) lineGetAddressStatus };
  1713. #endif
  1714. CHK_LINE_SELECTED()
  1715. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1716. memset (lpAddrStatus, 0, (size_t) dwBigBufSize);
  1717. lpAddrStatus->dwTotalSize = dwBigBufSize;
  1718. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1719. {
  1720. ShowStructByDWORDs (lpAddrStatus);
  1721. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1722. {
  1723. STRUCT_FIELD fields[] =
  1724. {
  1725. { "dwNumInUse", FT_DWORD, lpAddrStatus->dwNumInUse, NULL },
  1726. { "dwNumActiveCalls", FT_DWORD, lpAddrStatus->dwNumActiveCalls, NULL },
  1727. { "dwNumOnHoldCalls", FT_DWORD, lpAddrStatus->dwNumOnHoldCalls, NULL },
  1728. { "dwNumOnHoldPendCalls", FT_DWORD, lpAddrStatus->dwNumOnHoldPendCalls, NULL },
  1729. { "dwAddressFeatures", FT_FLAGS, lpAddrStatus->dwAddressFeatures, aAddressFeatures },
  1730. { "dwNumRingsNoAnswer", FT_DWORD, lpAddrStatus->dwNumRingsNoAnswer, NULL },
  1731. { "dwForwardNumEntries", FT_DWORD, lpAddrStatus->dwForwardNumEntries, NULL },
  1732. { "dwForwardSize", FT_SIZE, lpAddrStatus->dwForwardSize, NULL },
  1733. { "dwForwardOffset", FT_OFFSET, lpAddrStatus->dwForwardOffset, NULL },
  1734. { "dwTerminalModesSize", FT_SIZE, lpAddrStatus->dwTerminalModesSize, NULL },
  1735. { "dwTerminalModesOffset", FT_OFFSET, lpAddrStatus->dwTerminalModesOffset, NULL },
  1736. { "dwDevSpecificSize", FT_SIZE, lpAddrStatus->dwDevSpecificSize, NULL },
  1737. { "dwDevSpecificOffset", FT_OFFSET, lpAddrStatus->dwDevSpecificOffset, NULL }
  1738. };
  1739. STRUCT_FIELD_HEADER fieldHeader =
  1740. {
  1741. lpAddrStatus,
  1742. "LINEADDRESSSTATUS",
  1743. 13,
  1744. fields
  1745. };
  1746. ShowStructByField (&fieldHeader, FALSE);
  1747. }
  1748. }
  1749. break;
  1750. }
  1751. #if TAPI_2_0
  1752. case lGetAgentActivityList:
  1753. case lGetAgentActivityListW:
  1754. {
  1755. LPLINEAGENTACTIVITYLIST lpActivityList = (LPLINEAGENTACTIVITYLIST)
  1756. pBigBuf;
  1757. FUNC_PARAM params[] =
  1758. {
  1759. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1760. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1761. { "lpAgentActivityList", PT_POINTER, (ULONG_PTR) lpActivityList, lpActivityList }
  1762. };
  1763. FUNC_PARAM_HEADER paramsHeader =
  1764. { 3, funcIndex, params, (funcIndex == lGetAgentActivityList ?
  1765. (PFN3) lineGetAgentActivityList :
  1766. (PFN3) lineGetAgentActivityListW) };
  1767. CHK_LINE_SELECTED()
  1768. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1769. memset (lpActivityList, 0, (size_t) dwBigBufSize);
  1770. lpActivityList->dwTotalSize = dwBigBufSize;
  1771. lResult = DoFunc (&paramsHeader);
  1772. // BUGBUG dump agent activity list on successful async completion
  1773. break;
  1774. }
  1775. case lGetAgentCaps:
  1776. {
  1777. LPLINEAGENTCAPS lpAgentCaps = (LPLINEAGENTCAPS) pBigBuf;
  1778. FUNC_PARAM params[] =
  1779. {
  1780. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1781. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  1782. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1783. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1784. { "lpAgentCaps", PT_POINTER, (ULONG_PTR) lpAgentCaps, lpAgentCaps }
  1785. };
  1786. FUNC_PARAM_HEADER paramsHeader =
  1787. { 5, funcIndex, params, (PFN5) lineGetAgentCaps };
  1788. CHK_LINEAPP_SELECTED()
  1789. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1790. memset (lpAgentCaps, 0, (size_t) dwBigBufSize);
  1791. lpAgentCaps->dwTotalSize = dwBigBufSize;
  1792. lResult = DoFunc (&paramsHeader);
  1793. // BUGBUG dump agent caps on successful async completion
  1794. break;
  1795. }
  1796. case lGetAgentGroupList:
  1797. {
  1798. LPLINEAGENTGROUPLIST lpGroupList = (LPLINEAGENTGROUPLIST) pBigBuf;
  1799. FUNC_PARAM params[] =
  1800. {
  1801. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1802. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1803. { "lpAgentGroupList", PT_POINTER, (ULONG_PTR) lpGroupList, lpGroupList }
  1804. };
  1805. FUNC_PARAM_HEADER paramsHeader =
  1806. { 3, funcIndex, params, (PFN3) lineGetAgentGroupList };
  1807. CHK_LINE_SELECTED()
  1808. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1809. memset (lpGroupList, 0, (size_t) dwBigBufSize);
  1810. lpGroupList->dwTotalSize = dwBigBufSize;
  1811. lResult = DoFunc (&paramsHeader);
  1812. // BUGBUG dump agent group list on successful async completion
  1813. break;
  1814. }
  1815. case lGetAgentStatus:
  1816. {
  1817. LPLINEAGENTSTATUS lpStatus = (LPLINEAGENTSTATUS) pBigBuf;
  1818. FUNC_PARAM params[] =
  1819. {
  1820. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1821. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1822. { "lpAgentStatus", PT_POINTER, (ULONG_PTR) lpStatus, lpStatus }
  1823. };
  1824. FUNC_PARAM_HEADER paramsHeader =
  1825. { 3, funcIndex, params, (PFN3) lineGetAgentStatus };
  1826. CHK_LINE_SELECTED()
  1827. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1828. memset (lpStatus, 0, (size_t) dwBigBufSize);
  1829. lpStatus->dwTotalSize = dwBigBufSize;
  1830. lResult = DoFunc (&paramsHeader);
  1831. // BUGBUG dump agent status on successful async completion
  1832. break;
  1833. }
  1834. #endif
  1835. case lGetCallInfo:
  1836. #if TAPI_2_0
  1837. case lGetCallInfoW:
  1838. #endif
  1839. {
  1840. LPLINECALLINFO lpCallInfo = (LPLINECALLINFO) pBigBuf;
  1841. FUNC_PARAM params[] =
  1842. {
  1843. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1844. { "lpCallInfo", PT_POINTER, (ULONG_PTR) lpCallInfo, lpCallInfo }
  1845. };
  1846. #if TAPI_2_0
  1847. FUNC_PARAM_HEADER paramsHeader =
  1848. { 2, funcIndex, params, (funcIndex == lGetCallInfo ?
  1849. (PFN2) lineGetCallInfo : (PFN2) lineGetCallInfoW) };
  1850. #else
  1851. FUNC_PARAM_HEADER paramsHeader =
  1852. { 2, funcIndex, params, (PFN2) lineGetCallInfo };
  1853. #endif
  1854. CHK_CALL_SELECTED()
  1855. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1856. memset (lpCallInfo, 0x5a, (size_t) dwBigBufSize);
  1857. lpCallInfo->dwTotalSize = dwBigBufSize;
  1858. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1859. {
  1860. ShowStructByDWORDs (lpCallInfo);
  1861. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1862. {
  1863. STRUCT_FIELD fields[] =
  1864. {
  1865. { szhLine, FT_DWORD, (DWORD)lpCallInfo->hLine, NULL },
  1866. { "dwLineDeviceID", FT_DWORD, lpCallInfo->dwLineDeviceID, NULL },
  1867. { szdwAddressID, FT_DWORD, lpCallInfo->dwAddressID, NULL },
  1868. { "dwBearerMode", FT_FLAGS, lpCallInfo->dwBearerMode, aBearerModes },
  1869. { "dwRate", FT_DWORD, lpCallInfo->dwRate, NULL },
  1870. { "dwMediaMode", FT_FLAGS, lpCallInfo->dwMediaMode, aMediaModes },
  1871. { "dwAppSpecific", FT_DWORD, lpCallInfo->dwAppSpecific, NULL },
  1872. { "dwCallID", FT_DWORD, lpCallInfo->dwCallID, NULL },
  1873. { "dwRelatedCallID", FT_DWORD, lpCallInfo->dwRelatedCallID, NULL },
  1874. { "dwCallParamFlags", FT_FLAGS, lpCallInfo->dwCallParamFlags, aCallParamFlags },
  1875. { "dwCallStates", FT_FLAGS, lpCallInfo->dwCallStates, aCallStates },
  1876. { "dwMonitorDigitModes", FT_FLAGS, lpCallInfo->dwMonitorDigitModes, aDigitModes },
  1877. { "dwMonitorMediaModes", FT_FLAGS, lpCallInfo->dwMonitorMediaModes, aMediaModes },
  1878. { "DialParams.dwDialPause", FT_DWORD, lpCallInfo->DialParams.dwDialPause, NULL },
  1879. { "DialParams.dwDialSpeed", FT_DWORD, lpCallInfo->DialParams.dwDialSpeed, NULL },
  1880. { "DialParams.dwDigitDuration", FT_DWORD, lpCallInfo->DialParams.dwDigitDuration, NULL },
  1881. { "DialParams.dwWaitForDialtone", FT_DWORD, lpCallInfo->DialParams.dwWaitForDialtone, NULL },
  1882. { "dwOrigin", FT_FLAGS, lpCallInfo->dwOrigin, aCallOrigins },
  1883. { "dwReason", FT_FLAGS, lpCallInfo->dwReason, aCallReasons },
  1884. { "dwCompletionID", FT_DWORD, lpCallInfo->dwCompletionID, NULL },
  1885. { "dwNumOwners", FT_DWORD, lpCallInfo->dwNumOwners, NULL },
  1886. { "dwNumMonitors", FT_DWORD, lpCallInfo->dwNumMonitors, NULL },
  1887. { "dwCountryCode", FT_DWORD, lpCallInfo->dwCountryCode, NULL },
  1888. { "dwTrunk", FT_DWORD, lpCallInfo->dwTrunk, NULL },
  1889. { "dwCallerIDFlags", FT_FLAGS, lpCallInfo->dwCallerIDFlags, aCallerIDFlags },
  1890. { "dwCallerIDSize", FT_SIZE, lpCallInfo->dwCallerIDSize, NULL },
  1891. { "dwCallerIDOffset", FT_OFFSET, lpCallInfo->dwCallerIDOffset, NULL },
  1892. { "dwCallerIDNameSize", FT_SIZE, lpCallInfo->dwCallerIDNameSize, NULL },
  1893. { "dwCallerIDNameOffset", FT_OFFSET, lpCallInfo->dwCallerIDNameOffset, NULL },
  1894. { "dwCalledIDFlags", FT_FLAGS, lpCallInfo->dwCalledIDFlags, aCallerIDFlags },
  1895. { "dwCalledIDSize", FT_SIZE, lpCallInfo->dwCalledIDSize, NULL },
  1896. { "dwCalledIDOffset", FT_OFFSET, lpCallInfo->dwCalledIDOffset, NULL },
  1897. { "dwCalledIDNameSize", FT_SIZE, lpCallInfo->dwCalledIDNameSize, NULL },
  1898. { "dwCalledIDNameOffset", FT_OFFSET, lpCallInfo->dwCalledIDNameOffset, NULL },
  1899. { "dwConnectedIDFlags", FT_FLAGS, lpCallInfo->dwConnectedIDFlags, aCallerIDFlags },
  1900. { "dwConnectedIDSize", FT_SIZE, lpCallInfo->dwConnectedIDSize, NULL },
  1901. { "dwConnectedIDOffset", FT_OFFSET, lpCallInfo->dwConnectedIDOffset, NULL },
  1902. { "dwConnectedIDNameSize", FT_SIZE, lpCallInfo->dwConnectedIDNameSize, NULL },
  1903. { "dwConnectedIDNameOffset", FT_OFFSET, lpCallInfo->dwConnectedIDNameOffset, NULL },
  1904. { "dwRedirectionIDFlags", FT_FLAGS, lpCallInfo->dwRedirectionIDFlags, aCallerIDFlags },
  1905. { "dwRedirectionIDSize", FT_SIZE, lpCallInfo->dwRedirectionIDSize, NULL },
  1906. { "dwRedirectionIDOffset", FT_OFFSET, lpCallInfo->dwRedirectionIDOffset, NULL },
  1907. { "dwRedirectionIDNameSize", FT_SIZE, lpCallInfo->dwRedirectionIDNameSize, NULL },
  1908. { "dwRedirectionIDNameOffset", FT_OFFSET, lpCallInfo->dwRedirectionIDNameOffset, NULL },
  1909. { "dwRedirectingIDFlags", FT_FLAGS, lpCallInfo->dwRedirectingIDFlags, aCallerIDFlags },
  1910. { "dwRedirectingIDSize", FT_SIZE, lpCallInfo->dwRedirectingIDSize, NULL },
  1911. { "dwRedirectingIDOffset", FT_OFFSET, lpCallInfo->dwRedirectingIDOffset, NULL },
  1912. { "dwRedirectingIDNameSize", FT_SIZE, lpCallInfo->dwRedirectingIDNameSize, NULL },
  1913. { "dwRedirectingIDNameOffset", FT_OFFSET, lpCallInfo->dwRedirectingIDNameOffset, NULL },
  1914. { "dwAppNameSize", FT_SIZE, lpCallInfo->dwAppNameSize, NULL },
  1915. { "dwAppNameOffset", FT_OFFSET, lpCallInfo->dwAppNameOffset, NULL },
  1916. { "dwDisplayableAddressSize", FT_SIZE, lpCallInfo->dwDisplayableAddressSize, NULL },
  1917. { "dwDisplayableAddressOffset", FT_OFFSET, lpCallInfo->dwDisplayableAddressOffset, NULL },
  1918. { "dwCalledPartySize", FT_SIZE, lpCallInfo->dwCalledPartySize, NULL },
  1919. { "dwCalledPartyOffset", FT_OFFSET, lpCallInfo->dwCalledPartyOffset, NULL },
  1920. { "dwCommentSize", FT_SIZE, lpCallInfo->dwCommentSize, NULL },
  1921. { "dwCommentOffset", FT_OFFSET, lpCallInfo->dwCommentOffset, NULL },
  1922. { "dwDisplaySize", FT_SIZE, lpCallInfo->dwDisplaySize, NULL },
  1923. { "dwDisplayOffset", FT_OFFSET, lpCallInfo->dwDisplayOffset, NULL },
  1924. { "dwUserUserInfoSize", FT_SIZE, lpCallInfo->dwUserUserInfoSize, NULL },
  1925. { "dwUserUserInfoOffset", FT_OFFSET, lpCallInfo->dwUserUserInfoOffset, NULL },
  1926. { "dwHighLevelCompSize", FT_SIZE, lpCallInfo->dwHighLevelCompSize, NULL },
  1927. { "dwHighLevelCompOffset", FT_OFFSET, lpCallInfo->dwHighLevelCompOffset, NULL },
  1928. { "dwLowLevelCompSize", FT_SIZE, lpCallInfo->dwLowLevelCompSize, NULL },
  1929. { "dwLowLevelCompOffset", FT_OFFSET, lpCallInfo->dwLowLevelCompOffset, NULL },
  1930. { "dwChargingInfoSize", FT_SIZE, lpCallInfo->dwChargingInfoSize, NULL },
  1931. { "dwChargingInfoOffset", FT_OFFSET, lpCallInfo->dwChargingInfoOffset, NULL },
  1932. { "dwTerminalModesSize", FT_SIZE, lpCallInfo->dwTerminalModesSize, NULL },
  1933. { "dwTerminalModesOffset", FT_OFFSET, lpCallInfo->dwTerminalModesOffset, NULL },
  1934. { "dwDevSpecificSize", FT_SIZE, lpCallInfo->dwDevSpecificSize, NULL },
  1935. { "dwDevSpecificOffset", FT_OFFSET, lpCallInfo->dwDevSpecificOffset, NULL }
  1936. #if TAPI_2_0
  1937. ,
  1938. { "dwCallTreatment", FT_DWORD, 0, NULL },
  1939. { "dwCallDataSize", FT_SIZE, 0, NULL },
  1940. { "dwCallDataOffset", FT_OFFSET, 0, NULL },
  1941. { "dwSendingFlowspecSize", FT_SIZE, 0, NULL },
  1942. { "dwSendingFlowspecOffset", FT_OFFSET, 0, NULL },
  1943. { "dwReceivingFlowspecSize", FT_SIZE, 0, NULL },
  1944. { "dwReceivingFlowspecOffset", FT_OFFSET, 0, NULL }
  1945. #endif
  1946. };
  1947. STRUCT_FIELD_HEADER fieldHeader =
  1948. {
  1949. lpCallInfo, "LINECALLINFO", 0, fields
  1950. };
  1951. if (pLineSel->dwAPIVersion < 0x00020000)
  1952. {
  1953. //
  1954. // Only show ver 1.0 params
  1955. //
  1956. fieldHeader.dwNumFields = 71;
  1957. }
  1958. #if TAPI_2_0
  1959. else
  1960. {
  1961. fieldHeader.dwNumFields = 78;
  1962. fields[71].dwValue = lpCallInfo->dwCallTreatment;
  1963. fields[72].dwValue = lpCallInfo->dwCallDataSize;
  1964. fields[73].dwValue = lpCallInfo->dwCallDataOffset;
  1965. fields[74].dwValue = lpCallInfo->dwSendingFlowspecSize;
  1966. fields[75].dwValue = lpCallInfo->dwSendingFlowspecOffset;
  1967. fields[76].dwValue = lpCallInfo->dwReceivingFlowspecSize;
  1968. fields[77].dwValue = lpCallInfo->dwReceivingFlowspecOffset;
  1969. }
  1970. #endif
  1971. ShowStructByField (&fieldHeader, FALSE);
  1972. }
  1973. }
  1974. break;
  1975. }
  1976. case lGetCallStatus:
  1977. {
  1978. LPLINECALLSTATUS lpCallStatus = (LPLINECALLSTATUS) pBigBuf;
  1979. FUNC_PARAM params[] =
  1980. {
  1981. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  1982. { "lpCallStatus", PT_POINTER, (ULONG_PTR) lpCallStatus, lpCallStatus }
  1983. };
  1984. FUNC_PARAM_HEADER paramsHeader =
  1985. { 2, funcIndex, params, (PFN2) lineGetCallStatus };
  1986. DWORD dwAPIVersion;
  1987. CHK_CALL_SELECTED()
  1988. dwAPIVersion = pLineSel->dwAPIVersion;
  1989. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1990. memset (lpCallStatus, 0, (size_t) dwBigBufSize);
  1991. lpCallStatus->dwTotalSize = dwBigBufSize;
  1992. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1993. {
  1994. ShowStructByDWORDs (lpCallStatus);
  1995. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1996. {
  1997. STRUCT_FIELD fields[] =
  1998. {
  1999. { "dwCallState", FT_FLAGS, lpCallStatus->dwCallState, aCallStates },
  2000. { "dwCallStateMode", FT_FLAGS, lpCallStatus->dwCallStateMode, NULL },
  2001. { "dwCallPrivilege", FT_FLAGS, lpCallStatus->dwCallPrivilege, aCallPrivileges },
  2002. { "dwCallFeatures", FT_FLAGS, lpCallStatus->dwCallFeatures, aCallFeatures },
  2003. { "dwDevSpecificSize", FT_SIZE, lpCallStatus->dwDevSpecificSize, NULL },
  2004. { "dwDevSpecificOffset", FT_OFFSET, lpCallStatus->dwDevSpecificOffset, NULL }
  2005. #if TAPI_2_0
  2006. ,
  2007. { "dwCallFeatures2", FT_FLAGS, 0, aCallFeatures2 },
  2008. { "tStateEntryTime[0]", FT_DWORD, 0, NULL },
  2009. { "tStateEntryTime[1]", FT_DWORD, 0, NULL },
  2010. { "tStateEntryTime[2]", FT_DWORD, 0, NULL },
  2011. { "tStateEntryTime[3]", FT_DWORD, 0, NULL }
  2012. #endif
  2013. };
  2014. STRUCT_FIELD_HEADER fieldHeader =
  2015. {
  2016. lpCallStatus, "LINECALLSTATUS", 0, fields
  2017. };
  2018. switch (lpCallStatus->dwCallState)
  2019. {
  2020. case LINECALLSTATE_DIALTONE:
  2021. fields[1].pLookup = aDialToneModes;
  2022. break;
  2023. case LINECALLSTATE_BUSY:
  2024. fields[1].pLookup = aBusyModes;
  2025. break;
  2026. case LINECALLSTATE_SPECIALINFO:
  2027. fields[1].pLookup = aSpecialInfo;
  2028. break;
  2029. case LINECALLSTATE_DISCONNECTED:
  2030. fields[1].pLookup = aDisconnectModes;
  2031. break;
  2032. default:
  2033. fields[1].dwType = FT_DWORD;
  2034. break;
  2035. }
  2036. if (dwAPIVersion < 0x00020000)
  2037. {
  2038. fieldHeader.dwNumFields = 6;
  2039. }
  2040. #if TAPI_2_0
  2041. else
  2042. {
  2043. fieldHeader.dwNumFields = 11;
  2044. fields[6].dwValue = lpCallStatus->dwCallFeatures2;
  2045. fields[7].dwValue = *((LPDWORD) &lpCallStatus->tStateEntryTime);
  2046. fields[8].dwValue = *(((LPDWORD) &lpCallStatus->tStateEntryTime) + 1);
  2047. fields[9].dwValue = *(((LPDWORD) &lpCallStatus->tStateEntryTime) + 2);
  2048. fields[10].dwValue = *(((LPDWORD) &lpCallStatus->tStateEntryTime) + 3);
  2049. }
  2050. #endif
  2051. ShowStructByField (&fieldHeader, FALSE);
  2052. }
  2053. }
  2054. break;
  2055. }
  2056. case lGetConfRelatedCalls:
  2057. {
  2058. LPLINECALLLIST lpCallList = (LPLINECALLLIST) pBigBuf;
  2059. FUNC_PARAM params[] =
  2060. {
  2061. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  2062. { "lpCallList", PT_POINTER, (ULONG_PTR) lpCallList, lpCallList }
  2063. };
  2064. FUNC_PARAM_HEADER paramsHeader =
  2065. { 2, funcIndex, params, (PFN2) lineGetConfRelatedCalls };
  2066. CHK_CALL_SELECTED()
  2067. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  2068. memset (lpCallList, 0, (size_t) dwBigBufSize);
  2069. lpCallList->dwTotalSize = dwBigBufSize;
  2070. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2071. {
  2072. ShowStructByDWORDs (lpCallList);
  2073. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2074. {
  2075. STRUCT_FIELD fields[] =
  2076. {
  2077. { "dwCallsNumEntries", FT_DWORD, lpCallList->dwCallsNumEntries, NULL },
  2078. { "dwCallsSize", FT_SIZE, lpCallList->dwCallsSize, NULL },
  2079. { "dwCallsOffset", FT_OFFSET, lpCallList->dwCallsOffset, NULL }
  2080. };
  2081. STRUCT_FIELD_HEADER fieldHeader =
  2082. {
  2083. lpCallList,
  2084. "LINECALLLIST",
  2085. 3,
  2086. fields
  2087. };
  2088. ShowStructByField (&fieldHeader, FALSE);
  2089. }
  2090. }
  2091. break;
  2092. }
  2093. case lGetDevCaps:
  2094. #if TAPI_2_0
  2095. case lGetDevCapsW:
  2096. #endif
  2097. {
  2098. LPLINEDEVCAPS lpDevCaps = (LPLINEDEVCAPS) pBigBuf;
  2099. FUNC_PARAM params[] =
  2100. {
  2101. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2102. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  2103. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  2104. { "dwExtVersion", PT_DWORD, (ULONG_PTR) dwDefLineExtVersion, NULL },
  2105. { "lpLineDevCaps", PT_POINTER, (ULONG_PTR) lpDevCaps, lpDevCaps }
  2106. };
  2107. #if TAPI_2_0
  2108. FUNC_PARAM_HEADER paramsHeader =
  2109. { 5, funcIndex, params, (funcIndex == lGetDevCaps ?
  2110. (PFN5) lineGetDevCaps : (PFN5) lineGetDevCapsW) };
  2111. #else
  2112. FUNC_PARAM_HEADER paramsHeader =
  2113. { 5, funcIndex, params, (PFN5) lineGetDevCaps };
  2114. #endif
  2115. CHK_LINEAPP_SELECTED()
  2116. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2117. memset (lpDevCaps, 0, (size_t) dwBigBufSize);
  2118. lpDevCaps->dwTotalSize = dwBigBufSize;
  2119. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2120. {
  2121. ShowStructByDWORDs (lpDevCaps);
  2122. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2123. {
  2124. STRUCT_FIELD fields[] =
  2125. {
  2126. { "dwProviderInfoSize", FT_SIZE, lpDevCaps->dwProviderInfoSize, NULL },
  2127. { "dwProviderInfoOffset", FT_OFFSET, lpDevCaps->dwProviderInfoOffset, NULL },
  2128. { "dwSwitchInfoSize", FT_SIZE, lpDevCaps->dwSwitchInfoSize, NULL },
  2129. { "dwSwitchInfoOffset", FT_OFFSET, lpDevCaps->dwSwitchInfoOffset, NULL },
  2130. { "dwPermanentLineID", FT_DWORD, lpDevCaps->dwPermanentLineID, NULL },
  2131. { "dwLineNameSize", FT_SIZE, lpDevCaps->dwLineNameSize, NULL },
  2132. { "dwLineNameOffset", FT_OFFSET, lpDevCaps->dwLineNameOffset, NULL },
  2133. { "dwStringFormat", FT_ORD, lpDevCaps->dwStringFormat, aStringFormats },
  2134. { "dwAddressModes", FT_FLAGS, lpDevCaps->dwAddressModes, aAddressModes },
  2135. { "dwNumAddresses", FT_DWORD, lpDevCaps->dwNumAddresses, NULL },
  2136. { "dwBearerModes", FT_FLAGS, lpDevCaps->dwBearerModes, aBearerModes },
  2137. { "dwMaxRate", FT_DWORD, lpDevCaps->dwMaxRate, NULL },
  2138. { "dwMediaModes", FT_FLAGS, lpDevCaps->dwMediaModes, aMediaModes },
  2139. { "dwGenerateToneModes", FT_FLAGS, lpDevCaps->dwGenerateToneModes, aToneModes },
  2140. { "dwGenerateToneMaxNumFreq", FT_DWORD, lpDevCaps->dwGenerateToneMaxNumFreq, NULL },
  2141. { "dwGenerateDigitModes", FT_FLAGS, lpDevCaps->dwGenerateDigitModes, aDigitModes },
  2142. { "dwMonitorToneMaxNumFreq", FT_DWORD, lpDevCaps->dwMonitorToneMaxNumFreq, NULL },
  2143. { "dwMonitorToneMaxNumEntries", FT_DWORD, lpDevCaps->dwMonitorToneMaxNumEntries, NULL },
  2144. { "dwMonitorDigitModes", FT_FLAGS, lpDevCaps->dwMonitorDigitModes, aDigitModes },
  2145. { "dwGatherDigitsMinTimeout", FT_DWORD, lpDevCaps->dwGatherDigitsMinTimeout, NULL },
  2146. { "dwGatherDigitsMaxTimeout", FT_DWORD, lpDevCaps->dwGatherDigitsMaxTimeout, NULL },
  2147. { "dwMedCtlDigitMaxListSize", FT_DWORD, lpDevCaps->dwMedCtlDigitMaxListSize, NULL },
  2148. { "dwMedCtlMediaMaxListSize", FT_DWORD, lpDevCaps->dwMedCtlMediaMaxListSize, NULL },
  2149. { "dwMedCtlToneMaxListSize", FT_DWORD, lpDevCaps->dwMedCtlToneMaxListSize, NULL },
  2150. { "dwMedCtlCallStateMaxListSize", FT_DWORD, lpDevCaps->dwMedCtlCallStateMaxListSize, NULL },
  2151. { "dwDevCapFlags", FT_FLAGS, lpDevCaps->dwDevCapFlags, aDevCapsFlags },
  2152. { "dwMaxNumActiveCalls", FT_DWORD, lpDevCaps->dwMaxNumActiveCalls, NULL },
  2153. { "dwAnswerMode", FT_FLAGS, lpDevCaps->dwAnswerMode, aAnswerModes },
  2154. { "dwRingModes", FT_DWORD, lpDevCaps->dwRingModes, NULL },
  2155. { "dwLineStates", FT_FLAGS, lpDevCaps->dwLineStates, aLineStates },
  2156. { "dwUUIAcceptSize", FT_DWORD, lpDevCaps->dwUUIAcceptSize, NULL },
  2157. { "dwUUIAnswerSize", FT_DWORD, lpDevCaps->dwUUIAnswerSize, NULL },
  2158. { "dwUUIMakeCallSize", FT_DWORD, lpDevCaps->dwUUIMakeCallSize, NULL },
  2159. { "dwUUIDropSize", FT_DWORD, lpDevCaps->dwUUIDropSize, NULL },
  2160. { "dwUUISendUserUserInfoSize", FT_DWORD, lpDevCaps->dwUUISendUserUserInfoSize, NULL },
  2161. { "dwUUICallInfoSize", FT_DWORD, lpDevCaps->dwUUICallInfoSize, NULL },
  2162. { "MinDialParams.dwDialPause", FT_DWORD, lpDevCaps->MinDialParams.dwDialPause, NULL },
  2163. { "MinDialParams.dwDialSpeed", FT_DWORD, lpDevCaps->MinDialParams.dwDialSpeed, NULL },
  2164. { "MinDialParams.dwDigitDuration", FT_DWORD, lpDevCaps->MinDialParams.dwDigitDuration, NULL },
  2165. { "MinDialParams.dwWaitForDialtone", FT_DWORD, lpDevCaps->MinDialParams.dwWaitForDialtone, NULL },
  2166. { "MaxDialParams.dwDialPause", FT_DWORD, lpDevCaps->MaxDialParams.dwDialPause, NULL },
  2167. { "MaxDialParams.dwDialSpeed", FT_DWORD, lpDevCaps->MaxDialParams.dwDialSpeed, NULL },
  2168. { "MaxDialParams.dwDigitDuration", FT_DWORD, lpDevCaps->MaxDialParams.dwDigitDuration, NULL },
  2169. { "MaxDialParams.dwWaitForDialtone", FT_DWORD, lpDevCaps->MaxDialParams.dwWaitForDialtone, NULL },
  2170. { "DefDialParams.dwDialPause", FT_DWORD, lpDevCaps->DefaultDialParams.dwDialPause, NULL },
  2171. { "DefDialParams.dwDialSpeed", FT_DWORD, lpDevCaps->DefaultDialParams.dwDialSpeed, NULL },
  2172. { "DefDialParams.dwDigitDuration", FT_DWORD, lpDevCaps->DefaultDialParams.dwDigitDuration, NULL },
  2173. { "DefDialParams.dwWaitForDialtone", FT_DWORD, lpDevCaps->DefaultDialParams.dwWaitForDialtone, NULL },
  2174. { "dwNumTerminals", FT_DWORD, lpDevCaps->dwNumTerminals, NULL },
  2175. { "dwTerminalCapsSize", FT_SIZE, lpDevCaps->dwTerminalCapsSize, NULL },
  2176. { "dwTerminalCapsOffset", FT_OFFSET, lpDevCaps->dwTerminalCapsOffset, NULL },
  2177. { "dwTerminalTextEntrySize", FT_DWORD, lpDevCaps->dwTerminalTextEntrySize, NULL },
  2178. { "dwTerminalTextSize", FT_SIZE, lpDevCaps->dwTerminalTextSize, NULL },
  2179. { "dwTerminalTextOffset", FT_OFFSET, lpDevCaps->dwTerminalTextOffset, NULL },
  2180. { "dwDevSpecificSize", FT_SIZE, lpDevCaps->dwDevSpecificSize, NULL },
  2181. { "dwDevSpecificOffset", FT_OFFSET, lpDevCaps->dwDevSpecificOffset, NULL }
  2182. #if TAPI_1_1
  2183. ,
  2184. { "dwLineFeatures", FT_FLAGS, 0, aLineFeatures }
  2185. #if TAPI_2_0
  2186. ,
  2187. { "dwSettableDevStatus", FT_FLAGS, 0, aLineDevStatusFlags },
  2188. { "dwDeviceClassesSize", FT_SIZE, 0, NULL },
  2189. { "dwDeviceClassesOffset", FT_OFFSET, 0, NULL }
  2190. #if TAPI_2_2
  2191. ,
  2192. { "PermanentLineGuid(Size)", FT_SIZE, sizeof (lpDevCaps->PermanentLineGuid), NULL },
  2193. { "PermanentLineGuid(Offset)", FT_OFFSET, ((LPBYTE) &lpDevCaps->PermanentLineGuid) - ((LPBYTE) lpDevCaps), NULL }
  2194. #endif
  2195. #endif
  2196. #endif
  2197. };
  2198. STRUCT_FIELD_HEADER fieldHeader =
  2199. {
  2200. lpDevCaps, "LINEDEVCAPS", 0, fields
  2201. };
  2202. if (params[2].dwValue == 0x10003)
  2203. {
  2204. //
  2205. // Only show ver 1.0 params
  2206. //
  2207. fieldHeader.dwNumFields = 56;
  2208. }
  2209. #if TAPI_1_1
  2210. else if (params[2].dwValue == 0x10004)
  2211. {
  2212. //
  2213. // Only show <= ver 1.1 params
  2214. //
  2215. fieldHeader.dwNumFields = 57;
  2216. fields[56].dwValue = lpDevCaps->dwLineFeatures;
  2217. }
  2218. #if TAPI_2_0
  2219. else
  2220. {
  2221. //
  2222. // Only show <= ver 2.0 params
  2223. //
  2224. fieldHeader.dwNumFields = 60;
  2225. fields[56].dwValue = lpDevCaps->dwLineFeatures;
  2226. fields[57].dwValue = lpDevCaps->dwSettableDevStatus;
  2227. fields[58].dwValue = lpDevCaps->dwDeviceClassesSize;
  2228. fields[59].dwValue = lpDevCaps->dwDeviceClassesOffset;
  2229. #if TAPI_2_2
  2230. if (params[2].dwValue >= 0x20002)
  2231. {
  2232. fieldHeader.dwNumFields += 2;
  2233. }
  2234. #endif
  2235. }
  2236. #endif
  2237. #endif
  2238. ShowStructByField (&fieldHeader, FALSE);
  2239. }
  2240. }
  2241. break;
  2242. }
  2243. case lGetDevConfig:
  2244. #if TAPI_2_0
  2245. case lGetDevConfigW:
  2246. #endif
  2247. {
  2248. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  2249. LPVARSTRING lpDevConfig = (LPVARSTRING) pBigBuf;
  2250. FUNC_PARAM params[] =
  2251. {
  2252. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  2253. { "lpDeviceConfig", PT_POINTER, (ULONG_PTR) lpDevConfig, lpDevConfig },
  2254. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass }
  2255. };
  2256. #if TAPI_2_0
  2257. FUNC_PARAM_HEADER paramsHeader =
  2258. { 3, funcIndex, params, (funcIndex == lGetDevConfig ?
  2259. (PFN3) lineGetDevConfig : (PFN3) lineGetDevConfigW) };
  2260. #else
  2261. FUNC_PARAM_HEADER paramsHeader =
  2262. { 3, funcIndex, params, (PFN3) lineGetDevConfig };
  2263. #endif
  2264. memset (lpDevConfig, 0, (size_t) dwBigBufSize);
  2265. lpDevConfig->dwTotalSize = dwBigBufSize;
  2266. strcpy (szDeviceClass, szDefLineDeviceClass);
  2267. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2268. {
  2269. ShowStructByDWORDs (lpDevConfig);
  2270. ShowVARSTRING (lpDevConfig);
  2271. }
  2272. break;
  2273. }
  2274. case lGetIcon:
  2275. #if TAPI_2_0
  2276. case lGetIconW:
  2277. #endif
  2278. {
  2279. char szDeviceClass[MAX_STRING_PARAM_SIZE] = "";
  2280. HICON hIcon;
  2281. FUNC_PARAM params[] =
  2282. {
  2283. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  2284. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass },
  2285. { "lphIcon", PT_POINTER, (ULONG_PTR) &hIcon, &hIcon }
  2286. };
  2287. #if TAPI_2_0
  2288. FUNC_PARAM_HEADER paramsHeader =
  2289. { 3, funcIndex, params, (funcIndex == lGetIcon ?
  2290. (PFN3) lineGetIcon : (PFN3) lineGetIconW) };
  2291. #else
  2292. FUNC_PARAM_HEADER paramsHeader =
  2293. { 3, funcIndex, params, (PFN3) lineGetIcon };
  2294. #endif
  2295. strcpy (szDeviceClass, szDefLineDeviceClass);
  2296. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2297. {
  2298. DialogBoxParam (
  2299. ghInst,
  2300. (LPCSTR)MAKEINTRESOURCE(IDD_DIALOG5),
  2301. (HWND) ghwndMain,
  2302. IconDlgProc,
  2303. (LPARAM) hIcon
  2304. );
  2305. }
  2306. break;
  2307. }
  2308. case lGetID:
  2309. #if TAPI_2_0
  2310. case lGetIDW:
  2311. #endif
  2312. {
  2313. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  2314. LPVARSTRING lpDevID = (LPVARSTRING) pBigBuf;
  2315. FUNC_PARAM params[] =
  2316. {
  2317. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  2318. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  2319. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  2320. { "dwSelect", PT_ORDINAL, (ULONG_PTR) LINECALLSELECT_LINE, aCallSelects },
  2321. { "lpDeviceID", PT_POINTER, (ULONG_PTR) lpDevID, lpDevID },
  2322. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass }
  2323. };
  2324. #if TAPI_2_0
  2325. FUNC_PARAM_HEADER paramsHeader =
  2326. { 6, funcIndex, params, (funcIndex == lGetID ?
  2327. (PFN6) lineGetID : (PFN6) lineGetIDW) };
  2328. #else
  2329. FUNC_PARAM_HEADER paramsHeader =
  2330. { 6, funcIndex, params, (PFN6) lineGetID };
  2331. #endif
  2332. CHK_LINE_SELECTED()
  2333. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  2334. if (pCallSel)
  2335. {
  2336. params[2].dwValue = (ULONG_PTR) pCallSel->hCall;
  2337. params[3].dwValue = LINECALLSELECT_CALL;
  2338. }
  2339. else
  2340. {
  2341. params[3].dwValue = LINECALLSELECT_LINE;
  2342. }
  2343. memset (lpDevID, 0, (size_t) dwBigBufSize);
  2344. lpDevID->dwTotalSize = dwBigBufSize;
  2345. strcpy (szDeviceClass, szDefLineDeviceClass);
  2346. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2347. {
  2348. ShowStructByDWORDs (lpDevID);
  2349. ShowVARSTRING (lpDevID);
  2350. }
  2351. break;
  2352. }
  2353. case lGetLineDevStatus:
  2354. #if TAPI_2_0
  2355. case lGetLineDevStatusW:
  2356. #endif
  2357. {
  2358. LPLINEDEVSTATUS lpDevStatus = (LPLINEDEVSTATUS) pBigBuf;
  2359. FUNC_PARAM params[] =
  2360. {
  2361. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  2362. { "lpLineDevStatus", PT_POINTER, (ULONG_PTR) lpDevStatus, lpDevStatus }
  2363. };
  2364. #if TAPI_2_0
  2365. FUNC_PARAM_HEADER paramsHeader =
  2366. { 2, funcIndex, params, (funcIndex == lGetLineDevStatus ?
  2367. (PFN2) lineGetLineDevStatus : (PFN2) lineGetLineDevStatusW) };
  2368. #else
  2369. FUNC_PARAM_HEADER paramsHeader =
  2370. { 2, funcIndex, params, (PFN2) lineGetLineDevStatus };
  2371. #endif
  2372. DWORD dwAPIVersion;
  2373. CHK_LINE_SELECTED()
  2374. dwAPIVersion = pLineSel->dwAPIVersion;
  2375. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  2376. memset (lpDevStatus, 0, (size_t) dwBigBufSize);
  2377. lpDevStatus->dwTotalSize = dwBigBufSize;
  2378. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2379. {
  2380. ShowStructByDWORDs (lpDevStatus);
  2381. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2382. {
  2383. STRUCT_FIELD fields[] =
  2384. {
  2385. { "dwNumOpens", FT_DWORD, lpDevStatus->dwNumOpens, NULL },
  2386. { "dwOpenMediaModes", FT_FLAGS, lpDevStatus->dwOpenMediaModes, aMediaModes },
  2387. { "dwNumActiveCalls", FT_DWORD, lpDevStatus->dwNumActiveCalls, NULL },
  2388. { "dwNumOnHoldCalls", FT_DWORD, lpDevStatus->dwNumOnHoldCalls, NULL },
  2389. { "dwNumOnHoldPendCalls", FT_DWORD, lpDevStatus->dwNumOnHoldPendCalls, NULL },
  2390. { "dwLineFeatures", FT_FLAGS, lpDevStatus->dwLineFeatures, aLineFeatures },
  2391. { "dwNumCallCompletions", FT_DWORD, lpDevStatus->dwNumCallCompletions, NULL },
  2392. { "dwRingMode", FT_DWORD, lpDevStatus->dwRingMode, NULL },
  2393. { "dwSignalLevel", FT_DWORD, lpDevStatus->dwSignalLevel, NULL },
  2394. { "dwBatteryLevel", FT_DWORD, lpDevStatus->dwBatteryLevel, NULL },
  2395. { "dwRoamMode", FT_FLAGS, lpDevStatus->dwRoamMode, aLineRoamModes },
  2396. { "dwDevStatusFlags", FT_FLAGS, lpDevStatus->dwDevStatusFlags, aLineDevStatusFlags },
  2397. { "dwTerminalModesSize", FT_SIZE, lpDevStatus->dwTerminalModesSize, NULL },
  2398. { "dwTerminalModesOffset", FT_OFFSET, lpDevStatus->dwTerminalModesOffset, NULL },
  2399. { "dwDevSpecificSize", FT_SIZE, lpDevStatus->dwDevSpecificSize, NULL },
  2400. { "dwDevSpecificOffset", FT_OFFSET, lpDevStatus->dwDevSpecificOffset, NULL }
  2401. #if TAPI_2_0
  2402. ,
  2403. { "dwAvailableMediaModes", FT_FLAGS, 0, aMediaModes },
  2404. { "dwAppInfoSize", FT_DWORD, 0, NULL },
  2405. { "dwAppInfoOffset", FT_DWORD, 0, NULL }
  2406. #endif
  2407. };
  2408. STRUCT_FIELD_HEADER fieldHeader =
  2409. {
  2410. lpDevStatus, "LINEDEVSTATUS", 0, fields
  2411. };
  2412. if (dwAPIVersion < 0x00020000)
  2413. {
  2414. fieldHeader.dwNumFields = 16;
  2415. }
  2416. #if TAPI_2_0
  2417. else
  2418. {
  2419. fieldHeader.dwNumFields = 19;
  2420. fields[16].dwValue = lpDevStatus->dwAvailableMediaModes;
  2421. fields[17].dwValue = lpDevStatus->dwAppInfoSize;
  2422. fields[18].dwValue = lpDevStatus->dwAppInfoOffset;
  2423. }
  2424. #endif
  2425. ShowStructByField (&fieldHeader, FALSE);
  2426. #if TAPI_2_0
  2427. if (dwAPIVersion >= 0x00020000 && lpDevStatus->dwAppInfoSize)
  2428. {
  2429. char szAppInfoN[16];
  2430. DWORD i;
  2431. LPLINEAPPINFO pAppInfo;
  2432. STRUCT_FIELD fields[] =
  2433. {
  2434. { "dwMachineNameSize", FT_SIZE, 0, NULL },
  2435. { "dwMachineNameOffset", FT_OFFSET, 0, NULL },
  2436. { "dwUserNameSize", FT_SIZE, 0, NULL },
  2437. { "dwUserNameOffset", FT_OFFSET, 0, NULL },
  2438. { "dwModuleFilenameSize", FT_SIZE, 0, NULL },
  2439. { "dwModuleFilenameOffset", FT_OFFSET, 0, NULL },
  2440. { "dwFriendlyNameSize", FT_SIZE, 0, NULL },
  2441. { "dwFriendlyNameOffset", FT_OFFSET, 0, NULL },
  2442. { "dwMediaModes", FT_FLAGS, 0, aMediaModes },
  2443. { "dwAddressID", FT_DWORD, 0, NULL },
  2444. };
  2445. STRUCT_FIELD_HEADER fieldHeader =
  2446. {
  2447. lpDevStatus, szAppInfoN, 10, fields
  2448. };
  2449. pAppInfo = (LPLINEAPPINFO) (((LPBYTE) lpDevStatus) +
  2450. lpDevStatus->dwAppInfoOffset);
  2451. for (i = 0; i < lpDevStatus->dwNumOpens; i++)
  2452. {
  2453. wsprintf (szAppInfoN, "APPINFO[%d]", i);
  2454. fields[0].dwValue = pAppInfo->dwMachineNameSize;
  2455. fields[1].dwValue = pAppInfo->dwMachineNameOffset;
  2456. fields[2].dwValue = pAppInfo->dwUserNameSize;
  2457. fields[3].dwValue = pAppInfo->dwUserNameOffset;
  2458. fields[4].dwValue = pAppInfo->dwModuleFilenameSize;
  2459. fields[5].dwValue = pAppInfo->dwModuleFilenameOffset;
  2460. fields[6].dwValue = pAppInfo->dwFriendlyNameSize;
  2461. fields[7].dwValue = pAppInfo->dwFriendlyNameOffset;
  2462. fields[8].dwValue = pAppInfo->dwMediaModes;;
  2463. fields[9].dwValue = pAppInfo->dwAddressID;
  2464. ShowStructByField (&fieldHeader, TRUE);
  2465. pAppInfo++;
  2466. }
  2467. }
  2468. #endif
  2469. }
  2470. }
  2471. break;
  2472. }
  2473. #if TAPI_2_0
  2474. case lGetMessage:
  2475. {
  2476. LINEMESSAGE msg;
  2477. FUNC_PARAM params[] =
  2478. {
  2479. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2480. { "lpMessage", PT_POINTER, (ULONG_PTR) &msg, &msg },
  2481. { "dwTimeout", PT_DWORD, (ULONG_PTR) 0, NULL }
  2482. };
  2483. FUNC_PARAM_HEADER paramsHeader =
  2484. { 3, funcIndex, params, NULL };
  2485. CHK_LINEAPP_SELECTED()
  2486. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2487. if (!LetUserMungeParams (&paramsHeader))
  2488. {
  2489. break;
  2490. }
  2491. // // Max timeout of 10 seconds (don't want to hang app & excite user)
  2492. // // unless the user wants INFINITE
  2493. //
  2494. // if ( 0xffffffff != params[2].dwValue )
  2495. // {
  2496. // if ( params[2].dwValue > 10000 )
  2497. // {
  2498. // params[2].dwValue = 10000;
  2499. // }
  2500. // }
  2501. DumpParams (&paramsHeader);
  2502. lResult = lineGetMessage(
  2503. (HLINEAPP) params[0].dwValue,
  2504. (LPLINEMESSAGE) params[1].dwValue,
  2505. (DWORD) params[2].dwValue
  2506. );
  2507. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  2508. if (lResult == 0)
  2509. {
  2510. tapiCallback(
  2511. msg.hDevice,
  2512. msg.dwMessageID,
  2513. msg.dwCallbackInstance,
  2514. msg.dwParam1,
  2515. msg.dwParam2,
  2516. msg.dwParam3
  2517. );
  2518. }
  2519. break;
  2520. }
  2521. #endif
  2522. case lGetNewCalls:
  2523. {
  2524. LPLINECALLLIST lpCallList = (LPLINECALLLIST) pBigBuf;
  2525. FUNC_PARAM params[] =
  2526. {
  2527. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  2528. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  2529. { "dwSelect", PT_ORDINAL, (ULONG_PTR) LINECALLSELECT_LINE, aCallSelects },
  2530. { "lpCallList", PT_POINTER, (ULONG_PTR) lpCallList, lpCallList }
  2531. };
  2532. FUNC_PARAM_HEADER paramsHeader =
  2533. { 4, funcIndex, params, (PFN4) lineGetNewCalls };
  2534. CHK_LINE_SELECTED()
  2535. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  2536. memset (lpCallList, 0, (size_t) dwBigBufSize);
  2537. lpCallList->dwTotalSize = dwBigBufSize;
  2538. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2539. {
  2540. ShowStructByDWORDs (lpCallList);
  2541. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2542. {
  2543. STRUCT_FIELD fields[] =
  2544. {
  2545. { "dwCallsNumEntries", FT_DWORD, lpCallList->dwCallsNumEntries, NULL },
  2546. { "dwCallsSize", FT_SIZE, lpCallList->dwCallsSize, NULL },
  2547. { "dwCallsOffset", FT_OFFSET, lpCallList->dwCallsOffset, NULL }
  2548. };
  2549. STRUCT_FIELD_HEADER fieldHeader =
  2550. {
  2551. lpCallList,
  2552. "LINECALLLIST",
  2553. 3,
  2554. fields
  2555. };
  2556. ShowStructByField (&fieldHeader, FALSE);
  2557. }
  2558. //
  2559. // If there are any hCalls returned in this struct we want
  2560. // to add them to the widget list
  2561. //
  2562. if (lpCallList->dwCallsNumEntries)
  2563. {
  2564. PMYLINE pLine = GetLine ((HLINE) params[0].dwValue);
  2565. LPHCALL lphCall = (LPHCALL)
  2566. (((LPBYTE) lpCallList) + lpCallList->dwCallsOffset);
  2567. for (i = 0; i < (int) lpCallList->dwCallsNumEntries; i++)
  2568. {
  2569. PMYCALL pNewCall = AllocCall (pLine);
  2570. LINECALLSTATUS callStatus;
  2571. if (pNewCall)
  2572. {
  2573. pNewCall->hCall = *lphCall;
  2574. pNewCall->bMonitor = TRUE;
  2575. lphCall++;
  2576. memset (&callStatus, 0, sizeof(LINECALLSTATUS));
  2577. callStatus.dwTotalSize = sizeof(LINECALLSTATUS);
  2578. if (lineGetCallStatus (pNewCall->hCall, &callStatus)
  2579. == 0)
  2580. {
  2581. //
  2582. // Special case chk for bNukeIdleMonitorCalls
  2583. //
  2584. if ((callStatus.dwCallState
  2585. == LINECALLSTATE_IDLE) &&
  2586. bNukeIdleMonitorCalls &&
  2587. (callStatus.dwCallPrivilege
  2588. == LINECALLPRIVILEGE_MONITOR))
  2589. {
  2590. if ((lResult = lineDeallocateCall(
  2591. (HCALL) pNewCall->hCall)) == 0)
  2592. {
  2593. ShowStr(
  2594. "Monitored call x%lx deallocated " \
  2595. "on IDLE",
  2596. pNewCall->hCall
  2597. );
  2598. FreeCall (pNewCall);
  2599. }
  2600. else
  2601. {
  2602. ShowStr(
  2603. "lineDeallocateCall failed (x%lx) to" \
  2604. " free idle monitored call x%lx",
  2605. lResult,
  2606. pNewCall->hCall
  2607. );
  2608. pNewCall->dwCallState = callStatus.dwCallState;
  2609. }
  2610. }
  2611. else
  2612. {
  2613. pNewCall->dwCallState = callStatus.dwCallState;
  2614. }
  2615. }
  2616. else
  2617. {
  2618. pNewCall->dwCallState = LINECALLSTATE_UNKNOWN;
  2619. }
  2620. }
  2621. }
  2622. UpdateWidgetList();
  2623. }
  2624. }
  2625. break;
  2626. }
  2627. case lGetNumRings:
  2628. {
  2629. DWORD dwNumRings;
  2630. FUNC_PARAM params[] =
  2631. {
  2632. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  2633. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  2634. { "lpdwNumRings", PT_POINTER, (ULONG_PTR) &dwNumRings, &dwNumRings }
  2635. };
  2636. FUNC_PARAM_HEADER paramsHeader =
  2637. { 3, funcIndex, params, (PFN3) lineGetNumRings };
  2638. CHK_LINE_SELECTED()
  2639. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  2640. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2641. {
  2642. ShowStr ("%snum rings = x%lx", szTab, dwNumRings);
  2643. }
  2644. break;
  2645. }
  2646. case lGetRequest:
  2647. #if TAPI_2_0
  2648. case lGetRequestW:
  2649. #endif
  2650. {
  2651. #if TAPI_2_0
  2652. LINEREQMEDIACALLW reqXxxCall;
  2653. #else
  2654. LINEREQMEDIACALL reqXxxCall;
  2655. #endif
  2656. FUNC_PARAM params[] =
  2657. {
  2658. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2659. { "dwRequestMode", PT_ORDINAL, (ULONG_PTR) LINEREQUESTMODE_MAKECALL, aRequestModes },
  2660. { "lpRequestBuffer", PT_POINTER, (ULONG_PTR) &reqXxxCall, &reqXxxCall }
  2661. };
  2662. #if TAPI_2_0
  2663. FUNC_PARAM_HEADER paramsHeader =
  2664. { 3, funcIndex, params, (funcIndex == lGetRequest ?
  2665. (PFN3) lineGetRequest : (PFN3) lineGetRequestW) };
  2666. #else
  2667. FUNC_PARAM_HEADER paramsHeader =
  2668. { 3, funcIndex, params, (PFN3) lineGetRequest };
  2669. #endif
  2670. CHK_LINEAPP_SELECTED()
  2671. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2672. memset (&reqXxxCall, 0, sizeof (reqXxxCall));
  2673. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2674. {
  2675. if (params[1].dwValue == LINEREQUESTMODE_MAKECALL)
  2676. {
  2677. #if TAPI_2_0
  2678. if (gbWideStringParams)
  2679. {
  2680. LPLINEREQMAKECALLW lpReqMakeCall = (LPLINEREQMAKECALLW)
  2681. &reqXxxCall;
  2682. ShowStr ("%sszDestAddress=%ws", szTab, lpReqMakeCall->szDestAddress);
  2683. ShowStr ("%sszAppName=%ws", szTab, lpReqMakeCall->szAppName);
  2684. ShowStr ("%sszCalledParty=%ws", szTab, lpReqMakeCall->szCalledParty);
  2685. ShowStr ("%sszComment=%ws", szTab, lpReqMakeCall->szComment);
  2686. }
  2687. else
  2688. {
  2689. LPLINEREQMAKECALL lpReqMakeCall = (LPLINEREQMAKECALL)
  2690. &reqXxxCall;
  2691. ShowStr ("%sszDestAddress=%s", szTab, lpReqMakeCall->szDestAddress);
  2692. ShowStr ("%sszAppName=%s", szTab, lpReqMakeCall->szAppName);
  2693. ShowStr ("%sszCalledParty=%s", szTab, lpReqMakeCall->szCalledParty);
  2694. ShowStr ("%sszComment=%s", szTab, lpReqMakeCall->szComment);
  2695. }
  2696. #else
  2697. LPLINEREQMAKECALL lpReqMakeCall = (LPLINEREQMAKECALL)
  2698. &reqXxxCall;
  2699. ShowStr ("%sszDestAddress=%s", szTab, lpReqMakeCall->szDestAddress);
  2700. ShowStr ("%sszAppName=%s", szTab, lpReqMakeCall->szAppName);
  2701. ShowStr ("%sszCalledParty=%s", szTab, lpReqMakeCall->szCalledParty);
  2702. ShowStr ("%sszComment=%s", szTab, lpReqMakeCall->szComment);
  2703. #endif
  2704. }
  2705. else
  2706. {
  2707. //
  2708. // NOTE: lineGetRequest(MEDIACALL) is a NOOP for win32,
  2709. // so we don't have to sweat differing sizes for
  2710. // HWND & WPARAM in the struct
  2711. //
  2712. LPLINEREQMEDIACALL lpReqMediaCall = (LPLINEREQMEDIACALL)
  2713. &reqXxxCall;
  2714. ShowStr ("%shWnd=x%x", szTab, lpReqMediaCall->hWnd);
  2715. ShowStr ("%swRequestID=x%x", szTab, lpReqMediaCall->wRequestID);
  2716. ShowStr ("%sszDeviceClass=%s", szTab, lpReqMediaCall->szDeviceClass);
  2717. ShowStr ("%sdwSize=x%lx", szTab, lpReqMediaCall->dwSize);
  2718. ShowStr ("%sdwSecure=x%lx", szTab, lpReqMediaCall->dwSecure);
  2719. ShowStr ("%sszDestAddress=%s", szTab, lpReqMediaCall->szDestAddress);
  2720. ShowStr ("%sszAppName=%s", szTab, lpReqMediaCall->szAppName);
  2721. ShowStr ("%sszCalledParty=%s", szTab, lpReqMediaCall->szCalledParty);
  2722. ShowStr ("%sszComment=%s", szTab, lpReqMediaCall->szComment);
  2723. }
  2724. }
  2725. break;
  2726. }
  2727. case lGetStatusMessages:
  2728. {
  2729. DWORD aFlags[2];
  2730. FUNC_PARAM params[] =
  2731. {
  2732. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  2733. { "lpdwLineStates", PT_POINTER, (ULONG_PTR) &aFlags[0], &aFlags[0] },
  2734. { "lpdwAddressStates", PT_POINTER, (ULONG_PTR) &aFlags[1], &aFlags[1] }
  2735. };
  2736. FUNC_PARAM_HEADER paramsHeader =
  2737. { 3, funcIndex, params, (PFN3) lineGetStatusMessages };
  2738. CHK_LINE_SELECTED()
  2739. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  2740. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2741. {
  2742. STRUCT_FIELD fields[] =
  2743. {
  2744. { "dwLineStates", FT_FLAGS, aFlags[0], aLineStates },
  2745. { "dwAddressStates", FT_FLAGS, aFlags[1], aAddressStates }
  2746. };
  2747. STRUCT_FIELD_HEADER fieldHeader =
  2748. {
  2749. aFlags,
  2750. "",
  2751. 2,
  2752. fields
  2753. };
  2754. ShowStructByField (&fieldHeader, TRUE);
  2755. }
  2756. break;
  2757. }
  2758. case lGetTranslateCaps:
  2759. #if TAPI_2_0
  2760. case lGetTranslateCapsW:
  2761. #endif
  2762. {
  2763. LPLINETRANSLATECAPS lpTranslateCaps = (LPLINETRANSLATECAPS) pBigBuf;
  2764. FUNC_PARAM params[] =
  2765. {
  2766. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2767. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  2768. { "lpTranslateCaps", PT_POINTER, (ULONG_PTR) lpTranslateCaps, lpTranslateCaps }
  2769. };
  2770. #if TAPI_2_0
  2771. FUNC_PARAM_HEADER paramsHeader =
  2772. { 3, funcIndex, params, (funcIndex == lGetTranslateCaps ?
  2773. (PFN3) lineGetTranslateCaps : (PFN3) lineGetTranslateCapsW) };
  2774. #else
  2775. FUNC_PARAM_HEADER paramsHeader =
  2776. { 3, funcIndex, params, (PFN3) lineGetTranslateCaps };
  2777. #endif
  2778. if (pLineAppSel)
  2779. {
  2780. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2781. }
  2782. memset (lpTranslateCaps, 0, (size_t) dwBigBufSize);
  2783. lpTranslateCaps->dwTotalSize = dwBigBufSize;
  2784. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2785. {
  2786. UpdateResults (TRUE);
  2787. ShowStructByDWORDs (lpTranslateCaps);
  2788. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2789. {
  2790. DWORD i;
  2791. LPLINECARDENTRY lpCardEntry;
  2792. LPLINELOCATIONENTRY lpLocationEntry;
  2793. STRUCT_FIELD fields[] =
  2794. {
  2795. { "dwNumLocations", FT_DWORD, lpTranslateCaps->dwNumLocations, NULL },
  2796. { "dwLocationListSize", FT_DWORD, lpTranslateCaps->dwLocationListSize, NULL },
  2797. { "dwLocationListOffset", FT_DWORD, lpTranslateCaps->dwLocationListOffset, NULL },
  2798. { "dwCurrentLocationID", FT_DWORD, lpTranslateCaps->dwCurrentLocationID, NULL },
  2799. { "dwNumCards", FT_DWORD, lpTranslateCaps->dwNumCards, NULL },
  2800. { "dwCardListSize", FT_DWORD, lpTranslateCaps->dwCardListSize, NULL },
  2801. { "dwCardListOffset", FT_DWORD, lpTranslateCaps->dwCardListOffset, NULL },
  2802. { "dwCurrentPreferredCardID", FT_DWORD, lpTranslateCaps->dwCurrentPreferredCardID, NULL }
  2803. };
  2804. STRUCT_FIELD_HEADER fieldHeader =
  2805. {
  2806. lpTranslateCaps,
  2807. "LINETRANSLATECAPS",
  2808. 8,
  2809. fields
  2810. };
  2811. ShowStructByField (&fieldHeader, FALSE);
  2812. lpLocationEntry = (LPLINELOCATIONENTRY)
  2813. (((LPBYTE) lpTranslateCaps) +
  2814. lpTranslateCaps->dwLocationListOffset);
  2815. for (i = 0; i < lpTranslateCaps->dwNumLocations; i++)
  2816. {
  2817. char buf[32];
  2818. STRUCT_FIELD fields[] =
  2819. {
  2820. { "dwPermanentLocationID", FT_DWORD, lpLocationEntry->dwPermanentLocationID, NULL },
  2821. { "dwLocationNameSize", FT_SIZE, lpLocationEntry->dwLocationNameSize, NULL },
  2822. { "dwLocationNameOffset", FT_OFFSET, lpLocationEntry->dwLocationNameOffset, NULL },
  2823. { "dwCountryCode", FT_DWORD, lpLocationEntry->dwCountryCode, NULL },
  2824. { "dwCityCodeSize", FT_SIZE, lpLocationEntry->dwCityCodeSize, NULL },
  2825. { "dwCityCodeOffset", FT_OFFSET, lpLocationEntry->dwCityCodeOffset, NULL },
  2826. { "dwPreferredCardID", FT_DWORD, lpLocationEntry->dwPreferredCardID, NULL }
  2827. #if TAPI_1_1
  2828. ,
  2829. { "dwLocalAccessCodeSize", FT_SIZE, lpLocationEntry->dwLocalAccessCodeSize, NULL },
  2830. { "dwLocalAccessCodeOffset", FT_OFFSET, lpLocationEntry->dwLocalAccessCodeOffset, NULL },
  2831. { "dwLongDistanceAccessCodeSize", FT_SIZE, lpLocationEntry->dwLongDistanceAccessCodeSize, NULL },
  2832. { "dwLongDistanceAccessCodeOffset", FT_OFFSET, lpLocationEntry->dwLongDistanceAccessCodeOffset, NULL },
  2833. { "dwTollPrefixListSize", FT_SIZE, lpLocationEntry->dwTollPrefixListSize, NULL },
  2834. { "dwTollPrefixListOffset", FT_OFFSET, lpLocationEntry->dwTollPrefixListOffset, NULL },
  2835. { "dwCountryID", FT_DWORD, lpLocationEntry->dwCountryID, NULL },
  2836. { "dwOptions", FT_FLAGS, lpLocationEntry->dwOptions, aLocationOptions },
  2837. { "dwCancelCallWaitingSize", FT_SIZE, lpLocationEntry->dwCancelCallWaitingSize, NULL },
  2838. { "dwCancelCallWaitingOffset", FT_OFFSET, lpLocationEntry->dwCancelCallWaitingOffset, NULL }
  2839. #endif
  2840. };
  2841. STRUCT_FIELD_HEADER fieldHeader =
  2842. {
  2843. lpTranslateCaps, // size,offset relative to lpXlatCaps
  2844. buf,
  2845. #if TAPI_1_1
  2846. 17,
  2847. #else
  2848. 7,
  2849. #endif
  2850. fields
  2851. };
  2852. sprintf (buf, "LINELOCATIONENTRY[%ld]", i);
  2853. lpLocationEntry++;
  2854. #if TAPI_1_1
  2855. if (params[1].dwValue == 0x10003)
  2856. {
  2857. //
  2858. // Only show ver 1.0 params & munge ptr to
  2859. // compensate for for smaller struct size
  2860. //
  2861. fieldHeader.dwNumFields = 7;
  2862. lpLocationEntry = (LPLINELOCATIONENTRY)
  2863. (((LPBYTE) lpLocationEntry) - 10*sizeof(DWORD));
  2864. }
  2865. #endif
  2866. ShowStructByField (&fieldHeader, TRUE);
  2867. }
  2868. lpCardEntry = (LPLINECARDENTRY)
  2869. (((LPBYTE) lpTranslateCaps) +
  2870. lpTranslateCaps->dwCardListOffset);
  2871. for (i = 0; i < lpTranslateCaps->dwNumCards; i++)
  2872. {
  2873. char buf[32];
  2874. STRUCT_FIELD fields[] =
  2875. {
  2876. { "dwPermanentCardID", FT_DWORD, lpCardEntry->dwPermanentCardID, NULL },
  2877. { "dwCardNameSize", FT_SIZE, lpCardEntry->dwCardNameSize, NULL },
  2878. { "dwCardNameOffset", FT_OFFSET, lpCardEntry->dwCardNameOffset, NULL }
  2879. #if TAPI_1_1
  2880. ,
  2881. { "dwCardNumberDigits", FT_DWORD, lpCardEntry->dwCardNumberDigits, NULL },
  2882. { "dwSameAreaRuleSize", FT_SIZE, lpCardEntry->dwSameAreaRuleSize, NULL },
  2883. { "dwSameAreaRuleOffset", FT_OFFSET, lpCardEntry->dwSameAreaRuleOffset, NULL },
  2884. { "dwLongDistanceRuleSize", FT_SIZE, lpCardEntry->dwLongDistanceRuleSize, NULL },
  2885. { "dwLongDistanceRuleOffset", FT_OFFSET, lpCardEntry->dwLongDistanceRuleOffset, NULL },
  2886. { "dwInternationalRuleSize", FT_SIZE, lpCardEntry->dwInternationalRuleSize, NULL },
  2887. { "dwInternationalRuleOffset", FT_OFFSET, lpCardEntry->dwInternationalRuleOffset, NULL },
  2888. { "dwOptions", FT_FLAGS, lpCardEntry->dwOptions, aCardOptions }
  2889. #endif
  2890. };
  2891. STRUCT_FIELD_HEADER fieldHeader =
  2892. {
  2893. lpTranslateCaps, // size,offset relative to lpXlatCaps
  2894. buf,
  2895. #if TAPI_1_1
  2896. 11,
  2897. #else
  2898. 3,
  2899. #endif
  2900. fields
  2901. };
  2902. sprintf (buf, "LINECARDENTRY[%ld]", i);
  2903. lpCardEntry++;
  2904. #if TAPI_1_1
  2905. if (params[1].dwValue == 0x10003)
  2906. {
  2907. //
  2908. // Only show ver 1.0 params & munge ptr to
  2909. // compensate for for smaller struct size
  2910. //
  2911. fieldHeader.dwNumFields = 3;
  2912. lpCardEntry = (LPLINECARDENTRY)
  2913. (((LPBYTE) lpCardEntry) - 8*sizeof(DWORD));
  2914. }
  2915. #endif
  2916. ShowStructByField (&fieldHeader, TRUE);
  2917. }
  2918. }
  2919. UpdateResults (FALSE);
  2920. }
  2921. break;
  2922. }
  2923. case lHandoff:
  2924. #if TAPI_2_0
  2925. case lHandoffW:
  2926. #endif
  2927. {
  2928. char szFilename[MAX_STRING_PARAM_SIZE] = "tb20.exe";
  2929. FUNC_PARAM params[] =
  2930. {
  2931. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  2932. { "lpszFileName", PT_STRING, (ULONG_PTR) szFilename, szFilename },
  2933. { "dwMediaMode", PT_FLAGS, (ULONG_PTR) dwDefMediaMode, aMediaModes }
  2934. };
  2935. #if TAPI_2_0
  2936. FUNC_PARAM_HEADER paramsHeader =
  2937. { 3, funcIndex, params, (funcIndex == lHandoff ?
  2938. (PFN3) lineHandoff : (PFN3) lineHandoffW) };
  2939. #else
  2940. FUNC_PARAM_HEADER paramsHeader =
  2941. { 3, funcIndex, params, (PFN3) lineHandoff };
  2942. #endif
  2943. CHK_CALL_SELECTED()
  2944. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  2945. lResult = DoFunc (&paramsHeader);
  2946. break;
  2947. }
  2948. case lHold:
  2949. {
  2950. FUNC_PARAM params[] =
  2951. {
  2952. { szhCall, PT_DWORD, 0, NULL }
  2953. };
  2954. FUNC_PARAM_HEADER paramsHeader =
  2955. { 1, funcIndex, params, (PFN1) lineHold };
  2956. CHK_CALL_SELECTED()
  2957. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  2958. lResult = DoFunc (&paramsHeader);
  2959. break;
  2960. }
  2961. case lInitialize:
  2962. {
  2963. PMYLINEAPP pNewLineApp;
  2964. char szAppName[MAX_STRING_PARAM_SIZE];
  2965. DWORD dwNumLineDevs;
  2966. FUNC_PARAM params[] =
  2967. {
  2968. { "lphLineApp", PT_POINTER, (ULONG_PTR) 0, NULL },
  2969. { "hInstance", PT_DWORD, (ULONG_PTR) ghInst, NULL },
  2970. { "lpfnCallback", PT_POINTER, (ULONG_PTR) tapiCallback, tapiCallback },
  2971. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  2972. { "lpdwNumDevs", PT_POINTER, (ULONG_PTR) &dwNumLineDevs, &dwNumLineDevs }
  2973. };
  2974. FUNC_PARAM_HEADER paramsHeader =
  2975. { 5, funcIndex, params, (PFN5) lineInitialize };
  2976. if (!(pNewLineApp = AllocLineApp()))
  2977. {
  2978. ErrorAlert();
  2979. ShowStr ("error creating data structure");
  2980. break;
  2981. }
  2982. params[0].dwValue =
  2983. params[0].u.dwDefValue = (ULONG_PTR) &pNewLineApp->hLineApp;
  2984. strcpy (szAppName, szDefAppName);
  2985. #ifdef WIN32
  2986. lResult = DoFunc (&paramsHeader);
  2987. #else
  2988. //
  2989. // NOTE: on win16 HINSTANCEs are 16 bits, so we've to hard code this
  2990. //
  2991. if (!LetUserMungeParams (&paramsHeader))
  2992. {
  2993. FreeLineApp (pNewLineApp);
  2994. break;
  2995. }
  2996. DumpParams (&paramsHeader);
  2997. lResult = lineInitialize(
  2998. (LPHLINEAPP) params[0].dwValue,
  2999. (HINSTANCE) params[1].dwValue,
  3000. (LINECALLBACK) params[2].dwValue,
  3001. (LPCSTR) params[3].dwValue,
  3002. (LPDWORD) params[4].dwValue
  3003. );
  3004. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  3005. #endif
  3006. if (lResult == 0)
  3007. {
  3008. ShowStr ("%snum line devs = %ld", szTab, dwNumLineDevs);
  3009. //SendMessage (ghwndLineApps, LB_SETCURSEL, (WPARAM) i, 0);
  3010. UpdateWidgetList();
  3011. gdwNumLineDevs = dwNumLineDevs;
  3012. SelectWidget ((PMYWIDGET) pNewLineApp);
  3013. }
  3014. else
  3015. {
  3016. FreeLineApp (pNewLineApp);
  3017. }
  3018. break;
  3019. }
  3020. #if TAPI_2_0
  3021. case lInitializeEx:
  3022. case lInitializeExW:
  3023. {
  3024. char szAppName[MAX_STRING_PARAM_SIZE];
  3025. DWORD dwNumLineDevs, dwAPIVersion;
  3026. PMYLINEAPP pNewLineApp;
  3027. LINEINITIALIZEEXPARAMS initExParams;
  3028. FUNC_PARAM params[] =
  3029. {
  3030. { "lphLineApp", PT_POINTER, (ULONG_PTR) 0, NULL },
  3031. { "hInstance", PT_DWORD, (ULONG_PTR) ghInst, NULL },
  3032. { "lpfnCallback", PT_POINTER, (ULONG_PTR) tapiCallback, tapiCallback },
  3033. { szlpszFriendlyAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  3034. { "lpdwNumDevs", PT_POINTER, (ULONG_PTR) &dwNumLineDevs, &dwNumLineDevs },
  3035. { "lpdwAPIVersion", PT_POINTER, (ULONG_PTR) &dwAPIVersion, &dwAPIVersion },
  3036. { " ->dwAPIVersion",PT_ORDINAL,(ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  3037. { "lpInitExParams", PT_POINTER, (ULONG_PTR) &initExParams, &initExParams },
  3038. { " ->dwOptions", PT_FLAGS, (ULONG_PTR) LINEINITIALIZEEXOPTION_USECOMPLETIONPORT, aLineInitExOptions }
  3039. };
  3040. FUNC_PARAM_HEADER paramsHeader =
  3041. { 9, funcIndex, params, NULL };
  3042. if (!(pNewLineApp = AllocLineApp()))
  3043. {
  3044. ErrorAlert();
  3045. ShowStr ("error creating data structure");
  3046. break;
  3047. }
  3048. params[0].dwValue =
  3049. params[0].u.dwDefValue = (ULONG_PTR) &pNewLineApp->hLineApp;
  3050. strcpy (szAppName, szDefAppName);
  3051. if (!LetUserMungeParams (&paramsHeader))
  3052. {
  3053. FreeLineApp (pNewLineApp);
  3054. break;
  3055. }
  3056. initExParams.dwTotalSize = sizeof (LINEINITIALIZEEXPARAMS);
  3057. initExParams.dwOptions = (DWORD) params[8].dwValue;
  3058. initExParams.Handles.hCompletionPort = ghCompletionPort;
  3059. dwAPIVersion = (DWORD) params[6].dwValue;
  3060. DumpParams (&paramsHeader);
  3061. if (funcIndex == lInitializeEx)
  3062. {
  3063. lResult = lineInitializeEx(
  3064. (LPHLINEAPP) params[0].dwValue,
  3065. (HINSTANCE) params[1].dwValue,
  3066. (LINECALLBACK) params[2].dwValue,
  3067. (LPCSTR) params[3].dwValue,
  3068. (LPDWORD) params[4].dwValue,
  3069. (LPDWORD) params[5].dwValue,
  3070. (LPLINEINITIALIZEEXPARAMS) params[7].dwValue
  3071. );
  3072. }
  3073. else
  3074. {
  3075. MakeWideString ((LPVOID) params[3].dwValue);
  3076. lResult = lineInitializeExW(
  3077. (LPHLINEAPP) params[0].dwValue,
  3078. (HINSTANCE) params[1].dwValue,
  3079. (LINECALLBACK) params[2].dwValue,
  3080. (LPCWSTR) params[3].dwValue,
  3081. (LPDWORD) params[4].dwValue,
  3082. (LPDWORD) params[5].dwValue,
  3083. (LPLINEINITIALIZEEXPARAMS) params[7].dwValue
  3084. );
  3085. }
  3086. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  3087. if (lResult == 0)
  3088. {
  3089. ShowStr ("%snum line devs = %ld", szTab, dwNumLineDevs);
  3090. if (params[7].dwValue != 0 &&
  3091. (initExParams.dwOptions & 3) ==
  3092. LINEINITIALIZEEXOPTION_USEEVENT)
  3093. {
  3094. ShowStr(
  3095. "hLineApp x%x was created with the\r\n" \
  3096. "USEEVENT option, so you must use\r\n" \
  3097. "lineGetMessage to retrieve messages.",
  3098. pNewLineApp->hLineApp
  3099. );
  3100. }
  3101. //SendMessage (ghwndLineApps, LB_SETCURSEL, (WPARAM) i, 0);
  3102. UpdateWidgetList();
  3103. gdwNumLineDevs = dwNumLineDevs;
  3104. SelectWidget ((PMYWIDGET) pNewLineApp);
  3105. }
  3106. else
  3107. {
  3108. FreeLineApp (pNewLineApp);
  3109. }
  3110. break;
  3111. }
  3112. #endif
  3113. case lMakeCall:
  3114. #if TAPI_2_0
  3115. case lMakeCallW:
  3116. #endif
  3117. {
  3118. PMYCALL pNewCall;
  3119. char szAddress[MAX_STRING_PARAM_SIZE];
  3120. FUNC_PARAM params[] =
  3121. {
  3122. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  3123. { szlphCall, PT_POINTER, (ULONG_PTR) 0, NULL },
  3124. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szAddress, szAddress },
  3125. { "dwCountryCode", PT_DWORD, (ULONG_PTR) dwDefCountryCode, NULL },
  3126. { szlpCallParams, PT_CALLPARAMS, (ULONG_PTR) 0, lpCallParams }
  3127. };
  3128. #if TAPI_2_0
  3129. FUNC_PARAM_HEADER paramsHeader =
  3130. { 5, funcIndex, params, (funcIndex == lMakeCall ?
  3131. (PFN5) lineMakeCall : (PFN5) lineMakeCallW) };
  3132. #else
  3133. FUNC_PARAM_HEADER paramsHeader =
  3134. { 5, funcIndex, params, (PFN5) lineMakeCall };
  3135. #endif
  3136. CHK_LINE_SELECTED()
  3137. if (!(pNewCall = AllocCall (pLineSel)))
  3138. {
  3139. ErrorAlert();
  3140. ShowStr ("error creating data structure");
  3141. break;
  3142. }
  3143. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  3144. params[1].dwValue =
  3145. params[1].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  3146. strcpy (szAddress, szDefDestAddress);
  3147. if ((lResult = DoFunc (&paramsHeader)) > 0)
  3148. {
  3149. if (params[0].dwValue != (DWORD) pLineSel->hLine)
  3150. {
  3151. MoveCallToLine (pNewCall, (HLINE) params[0].dwValue);
  3152. }
  3153. pNewCall->lMakeCallReqID = lResult;
  3154. dwNumPendingMakeCalls++;
  3155. SelectWidget ((PMYWIDGET) pNewCall);
  3156. }
  3157. else
  3158. {
  3159. FreeCall (pNewCall);
  3160. }
  3161. break;
  3162. }
  3163. case lMonitorDigits:
  3164. {
  3165. FUNC_PARAM params[] =
  3166. {
  3167. { szhCall, PT_DWORD, 0, NULL },
  3168. { "dwDigitModes", PT_FLAGS, LINEDIGITMODE_DTMF, aDigitModes }
  3169. };
  3170. FUNC_PARAM_HEADER paramsHeader =
  3171. { 2, funcIndex, params, (PFN2) lineMonitorDigits };
  3172. CHK_CALL_SELECTED()
  3173. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  3174. lResult = DoFunc (&paramsHeader);
  3175. break;
  3176. }
  3177. case lMonitorMedia:
  3178. {
  3179. FUNC_PARAM params[] =
  3180. {
  3181. { szhCall, PT_DWORD, 0, NULL },
  3182. { "dwMediaModes", PT_FLAGS, dwDefMediaMode, aMediaModes }
  3183. };
  3184. FUNC_PARAM_HEADER paramsHeader =
  3185. { 2, funcIndex, params, (PFN2) lineMonitorMedia };
  3186. CHK_CALL_SELECTED()
  3187. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  3188. lResult = DoFunc (&paramsHeader);
  3189. break;
  3190. }
  3191. case lMonitorTones:
  3192. {
  3193. FUNC_PARAM params[] =
  3194. {
  3195. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  3196. { "lpToneList", PT_POINTER, (ULONG_PTR) pBigBuf, pBigBuf },
  3197. { "dwNumEntries", PT_DWORD, (ULONG_PTR) 1, NULL }
  3198. };
  3199. FUNC_PARAM_HEADER paramsHeader =
  3200. { 3, funcIndex, params, (PFN3) lineMonitorTones };
  3201. CHK_CALL_SELECTED()
  3202. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  3203. lResult = DoFunc (&paramsHeader);
  3204. break;
  3205. }
  3206. case lNegotiateAPIVersion:
  3207. {
  3208. DWORD dwAPIVersion;
  3209. LINEEXTENSIONID extID;
  3210. FUNC_PARAM params[] =
  3211. {
  3212. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  3213. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  3214. { "dwAPILowVersion", PT_DWORD, (ULONG_PTR) 0x00010000, aAPIVersions },
  3215. { "dwAPIHighVersion", PT_DWORD, (ULONG_PTR) 0x10000000, aAPIVersions },
  3216. { "lpdwAPIVersion", PT_POINTER, (ULONG_PTR) &dwAPIVersion, &dwAPIVersion },
  3217. { "lpExtensionID", PT_POINTER, (ULONG_PTR) &extID, &extID }
  3218. };
  3219. FUNC_PARAM_HEADER paramsHeader =
  3220. { 6, funcIndex, params, (PFN6) lineNegotiateAPIVersion };
  3221. CHK_LINEAPP_SELECTED()
  3222. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  3223. if ((lResult = DoFunc (&paramsHeader)) == 0)
  3224. {
  3225. ShowStr ("%s%s=x%lx", szTab, szdwAPIVersion, dwAPIVersion);
  3226. ShowStr(
  3227. "%sextID.ID0=x%lx, .ID1=x%lx, .ID2=x%lx, .ID3=x%lx, ",
  3228. szTab,
  3229. extID.dwExtensionID0,
  3230. extID.dwExtensionID1,
  3231. extID.dwExtensionID2,
  3232. extID.dwExtensionID3
  3233. );
  3234. }
  3235. break;
  3236. }
  3237. case lNegotiateExtVersion:
  3238. {
  3239. DWORD dwExtVersion;
  3240. FUNC_PARAM params[] =
  3241. {
  3242. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  3243. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  3244. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  3245. { "dwExtLowVersion", PT_DWORD, (ULONG_PTR) 0x00000000, NULL },
  3246. { "dwExtHighVersion", PT_DWORD, (ULONG_PTR) 0x80000000, NULL },
  3247. { "lpdwExtVersion", PT_POINTER, (ULONG_PTR) &dwExtVersion, &dwExtVersion }
  3248. };
  3249. FUNC_PARAM_HEADER paramsHeader =
  3250. { 6, funcIndex, params, (PFN6) lineNegotiateExtVersion };
  3251. CHK_LINEAPP_SELECTED()
  3252. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  3253. if (DoFunc (&paramsHeader) == 0)
  3254. {
  3255. ShowStr ("%sdwExtVersion=x%lx", szTab, dwExtVersion);
  3256. }
  3257. break;
  3258. }
  3259. default:
  3260. FuncDriver2 (funcIndex);
  3261. break;
  3262. }
  3263. gbWideStringParams = FALSE;
  3264. }
  3265. //#pragma code_seg ()
  3266. #pragma warning (default:4113)