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.

4760 lines
152 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1994-98 Microsoft Corporation
  3. Module Name:
  4. tb2.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) 18-Aug-1995
  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. extern char szdwDeviceID[];
  21. extern char szdwSize[];
  22. extern char szhCall[];
  23. extern char szhLine[];
  24. extern char szhLineApp[];
  25. extern char szhPhone[];
  26. extern char szlpCallParams[];
  27. extern char szlphCall[];
  28. extern char szlpParams[];
  29. extern char szhwndOwner[];
  30. extern char szdwAddressID[];
  31. extern char szlpszAppName[];
  32. extern char szdwAPIVersion[];
  33. extern char szlphConsultCall[];
  34. extern char szlpszDeviceClass[];
  35. extern char szlpszDestAddress[];
  36. extern char szlpsUserUserInfo[];
  37. extern char szlpszFriendlyAppName[];
  38. char szhMmcApp[] = "hMmcApp";
  39. char szhPhoneApp[] = "hPhoneApp";
  40. char szdwProviderID[] = "dwProviderID";
  41. void
  42. ShowStructByDWORDs(
  43. LPVOID lp
  44. );
  45. void
  46. ShowStructByField(
  47. PSTRUCT_FIELD_HEADER pHeader,
  48. BOOL bSubStructure
  49. );
  50. void
  51. DumpParams(
  52. PFUNC_PARAM_HEADER pHeader
  53. );
  54. void
  55. ShowPhoneFuncResult(
  56. LPSTR lpFuncName,
  57. LONG lResult
  58. );
  59. void
  60. ShowVARSTRING(
  61. LPVARSTRING lpVarString
  62. );
  63. void
  64. ShowTapiFuncResult(
  65. LPSTR lpFuncName,
  66. LONG lResult
  67. );
  68. VOID
  69. UpdateWidgetListCall(
  70. PMYCALL pCall
  71. );
  72. LPWSTR
  73. PASCAL
  74. My_lstrcpyW(
  75. WCHAR *pString1,
  76. WCHAR *pString2
  77. );
  78. void
  79. PASCAL
  80. MakeWideString(
  81. LPVOID pString
  82. );
  83. #if (INTERNAL_VER >= 0x20000)
  84. DWORD
  85. APIENTRY
  86. internalNewLocationW(
  87. IN WCHAR* pszName
  88. );
  89. #endif
  90. void
  91. ShowWidgetList(
  92. BOOL bShow
  93. )
  94. {
  95. static RECT rect;
  96. static int iNumHides = 0;
  97. if (!bShow)
  98. {
  99. iNumHides++;
  100. if (iNumHides > 1)
  101. {
  102. return;
  103. }
  104. GetWindowRect (ghwndList1, &rect);
  105. SetWindowPos(
  106. ghwndList1,
  107. (HWND) NULL,
  108. 0,
  109. 0,
  110. 1,
  111. 1,
  112. SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW |
  113. SWP_NOZORDER | SWP_HIDEWINDOW
  114. );
  115. }
  116. else
  117. {
  118. iNumHides--;
  119. if (iNumHides > 0)
  120. {
  121. return;
  122. }
  123. //
  124. // Do control restoration
  125. //
  126. ShowWindow (ghwndList1, SW_SHOW);
  127. SetWindowPos(
  128. ghwndList1,
  129. (HWND) NULL,
  130. 0,
  131. 0,
  132. rect.right - rect.left,
  133. rect.bottom - rect.top,
  134. SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER
  135. );
  136. }
  137. }
  138. //
  139. // We get a slough of C4113 (func param lists differed) warnings down below
  140. // in the initialization of FUNC_PARAM_HEADER structs as a result of the
  141. // real func prototypes having params that are pointers rather than DWORDs,
  142. // so since these are known non-interesting warnings just turn them off
  143. //
  144. #pragma warning (disable:4113)
  145. void
  146. FuncDriver2(
  147. FUNC_INDEX funcIndex
  148. )
  149. {
  150. LONG lResult;
  151. DWORD i;
  152. switch (funcIndex)
  153. {
  154. case lOpen:
  155. #if TAPI_2_0
  156. case lOpenW:
  157. #endif
  158. {
  159. PMYLINE pNewLine;
  160. FUNC_PARAM params[] =
  161. {
  162. { szhLineApp, PT_DWORD, 0, NULL },
  163. { szdwDeviceID, PT_DWORD, dwDefLineDeviceID, NULL },
  164. { "lphLine", PT_POINTER, 0, NULL },
  165. { szdwAPIVersion, PT_ORDINAL, dwDefLineAPIVersion, aAPIVersions },
  166. { "dwExtVersion", PT_DWORD, dwDefLineExtVersion, NULL },
  167. { "dwCallbackInstance", PT_DWORD, 0, NULL },
  168. { "dwPrivileges", PT_FLAGS, dwDefLinePrivilege, aLineOpenOptions },
  169. { "dwMediaModes", PT_FLAGS, dwDefMediaMode, aMediaModes },
  170. { szlpCallParams, PT_CALLPARAMS, 0, lpCallParams }
  171. };
  172. #if TAPI_2_0
  173. FUNC_PARAM_HEADER paramsHeader =
  174. { 9, funcIndex, params, (funcIndex == lOpen ?
  175. (PFN9) lineOpen : (PFN9) lineOpenW) };
  176. #else
  177. FUNC_PARAM_HEADER paramsHeader =
  178. { 9, funcIndex, params, (PFN9) lineOpen };
  179. #endif
  180. CHK_LINEAPP_SELECTED()
  181. if (!(pNewLine = AllocLine (pLineAppSel)))
  182. {
  183. ErrorAlert();
  184. ShowStr ("error creating data structure");
  185. break;
  186. }
  187. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  188. params[2].dwValue =
  189. params[2].u.dwDefValue = (ULONG_PTR) &pNewLine->hLine;
  190. if ((lResult = DoFunc (&paramsHeader)) == 0)
  191. {
  192. if ((HLINEAPP) params[0].dwValue != pLineAppSel->hLineApp)
  193. {
  194. //
  195. // User has switched line apps on us we need to recreate
  196. // the line data structure under a different line app
  197. //
  198. PMYLINE pNewLine2 =
  199. AllocLine (GetLineApp((HLINEAPP)params[0].dwValue));
  200. if (pNewLine2)
  201. {
  202. pNewLine2->hLine = pNewLine->hLine;
  203. FreeLine (pNewLine);
  204. pNewLine = pNewLine2;
  205. }
  206. else
  207. {
  208. // BUGBUG show error: couldn't alloc a new line struct
  209. lineClose (pNewLine->hLine);
  210. FreeLine (pNewLine);
  211. break;
  212. }
  213. }
  214. //
  215. // Save info about this line that we can display
  216. //
  217. pNewLine->hLineApp = (HLINEAPP) params[0].dwValue;
  218. pNewLine->dwDevID = (DWORD) params[1].dwValue;
  219. pNewLine->dwAPIVersion = (DWORD) params[3].dwValue;
  220. pNewLine->dwPrivileges = (DWORD) params[6].dwValue;
  221. pNewLine->dwMediaModes = (DWORD) params[7].dwValue;
  222. //SendMessage (ghwndLines, LB_SETCURSEL, (WPARAM) i, 0);
  223. UpdateWidgetList();
  224. SelectWidget ((PMYWIDGET) pNewLine);
  225. }
  226. else
  227. {
  228. FreeLine (pNewLine);
  229. }
  230. break;
  231. }
  232. case lPark:
  233. #if TAPI_2_0
  234. case lParkW:
  235. #endif
  236. {
  237. char szDirAddress[MAX_STRING_PARAM_SIZE] = "";
  238. LPVARSTRING lpNonDirAddress = (LPVARSTRING) pBigBuf;
  239. FUNC_PARAM params[] =
  240. {
  241. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  242. { "dwParkMode", PT_ORDINAL, (ULONG_PTR) LINEPARKMODE_DIRECTED, aParkModes },
  243. { "lpszDirAddress", PT_STRING, (ULONG_PTR) szDirAddress, szDirAddress },
  244. { "lpNonDirAddress", PT_POINTER, (ULONG_PTR) lpNonDirAddress, lpNonDirAddress }
  245. };
  246. #if TAPI_2_0
  247. FUNC_PARAM_HEADER paramsHeader =
  248. { 4, funcIndex, params, (funcIndex == lPark ?
  249. (PFN4) linePark : (PFN4) lineParkW) };
  250. #else
  251. FUNC_PARAM_HEADER paramsHeader =
  252. { 4, funcIndex, params, (PFN4) linePark };
  253. #endif
  254. CHK_CALL_SELECTED()
  255. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  256. memset (lpNonDirAddress, 0, (size_t) dwBigBufSize);
  257. lpNonDirAddress->dwTotalSize = dwBigBufSize;
  258. lResult = DoFunc (&paramsHeader);
  259. break;
  260. }
  261. case lPickup:
  262. #if TAPI_2_0
  263. case lPickupW:
  264. #endif
  265. {
  266. PMYCALL pNewCall;
  267. char szDestAddress[MAX_STRING_PARAM_SIZE];
  268. char szGroupID[MAX_STRING_PARAM_SIZE] = "";
  269. FUNC_PARAM params[] =
  270. {
  271. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  272. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  273. { szlphCall, PT_POINTER, (ULONG_PTR) 0, NULL },
  274. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress },
  275. { "lpszGroupID", PT_STRING, (ULONG_PTR) szGroupID, szGroupID }
  276. };
  277. #if TAPI_2_0
  278. FUNC_PARAM_HEADER paramsHeader =
  279. { 5, funcIndex, params, (funcIndex == lPickup ?
  280. (PFN5) linePickup : (PFN5) linePickupW) };
  281. #else
  282. FUNC_PARAM_HEADER paramsHeader =
  283. { 5, funcIndex, params, (PFN5) linePickup };
  284. #endif
  285. CHK_LINE_SELECTED()
  286. //
  287. // Find a free entry in the call array
  288. //
  289. if (!(pNewCall = AllocCall (pLineSel)))
  290. {
  291. break;
  292. }
  293. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  294. params[2].dwValue =
  295. params[2].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  296. strcpy (szDestAddress, szDefDestAddress);
  297. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  298. {
  299. if (params[0].dwValue != (DWORD) pLineSel->hLine)
  300. {
  301. MoveCallToLine (pNewCall, (HLINE) params[0].dwValue);
  302. }
  303. pNewCall->lMakeCallReqID = lResult;
  304. dwNumPendingMakeCalls++;
  305. SelectWidget ((PMYWIDGET) pNewCall);
  306. }
  307. else
  308. {
  309. FreeCall (pNewCall);
  310. }
  311. break;
  312. }
  313. case lPrepareAddToConference:
  314. #if TAPI_2_0
  315. case lPrepareAddToConferenceW:
  316. #endif
  317. {
  318. PMYCALL pNewCall;
  319. FUNC_PARAM params[] =
  320. {
  321. { "hConfCall", PT_DWORD, 0, NULL },
  322. { szlphConsultCall, PT_POINTER, 0, NULL },
  323. { szlpCallParams, PT_CALLPARAMS, 0, lpCallParams }
  324. };
  325. #if TAPI_2_0
  326. FUNC_PARAM_HEADER paramsHeader =
  327. { 3, funcIndex, params, (funcIndex == lPrepareAddToConference ?
  328. (PFN3) linePrepareAddToConference : (PFN3) linePrepareAddToConferenceW) };
  329. #else
  330. FUNC_PARAM_HEADER paramsHeader =
  331. { 3, funcIndex, params, (PFN3) linePrepareAddToConference };
  332. #endif
  333. CHK_CALL_SELECTED()
  334. if (!(pNewCall = AllocCall (pLineSel)))
  335. {
  336. break;
  337. }
  338. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  339. params[1].dwValue =
  340. params[1].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  341. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  342. {
  343. //
  344. // First make sure we're created the call under the right line,
  345. // and if not move it to the right place in the widgets list
  346. //
  347. LINECALLINFO callInfo;
  348. memset (&callInfo, 0, sizeof(LINECALLINFO));
  349. callInfo.dwTotalSize = sizeof(LINECALLINFO);
  350. if (lineGetCallInfo ((HCALL) params[0].dwValue, &callInfo) == 0)
  351. {
  352. if (callInfo.hLine != pLineSel->hLine)
  353. {
  354. MoveCallToLine (pNewCall, callInfo.hLine);
  355. }
  356. }
  357. pNewCall->lMakeCallReqID = lResult;
  358. dwNumPendingMakeCalls++;
  359. SelectWidget ((PMYWIDGET) pNewCall);
  360. }
  361. else
  362. {
  363. FreeCall (pNewCall);
  364. }
  365. break;
  366. }
  367. #if TAPI_2_0
  368. case lProxyMessage:
  369. {
  370. static LOOKUP aValidProxyMsgs[] =
  371. {
  372. { LINE_AGENTSPECIFIC ,"AGENTSPECIFIC" },
  373. { LINE_AGENTSTATUS ,"AGENTSTATUS" },
  374. { 0xffffffff ,"" }
  375. };
  376. FUNC_PARAM params[] =
  377. {
  378. { szhLine, PT_DWORD, 0, NULL },
  379. { szhCall, PT_DWORD, 0, NULL },
  380. { "dwMsg", PT_ORDINAL, LINE_AGENTSTATUS, aValidProxyMsgs },
  381. { "dwParam1", PT_DWORD, 0, NULL },
  382. { "dwParam2", PT_FLAGS, 0, aAgentStatus },
  383. { "dwParam3", PT_ORDINAL, 0, aAgentStates }
  384. };
  385. FUNC_PARAM_HEADER paramsHeader =
  386. { 6, funcIndex, params, (PFN6) lineProxyMessage };
  387. CHK_LINE_SELECTED()
  388. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  389. if (pCallSel)
  390. {
  391. params[1].dwValue = (ULONG_PTR) pCallSel->hCall;
  392. }
  393. DoFunc (&paramsHeader);
  394. break;
  395. }
  396. case lProxyResponse:
  397. {
  398. FUNC_PARAM params[] =
  399. {
  400. { szhLine, PT_DWORD, 0, NULL },
  401. { "lpProxyBuffer", PT_DWORD, 0, NULL },
  402. { "dwResult", PT_DWORD, 0, NULL }
  403. };
  404. FUNC_PARAM_HEADER paramsHeader =
  405. { 3, funcIndex, params, (PFN3) lineProxyResponse };
  406. CHK_LINE_SELECTED()
  407. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  408. DoFunc (&paramsHeader);
  409. break;
  410. }
  411. #endif
  412. case lRedirect:
  413. #if TAPI_2_0
  414. case lRedirectW:
  415. #endif
  416. {
  417. char szDestAddress[MAX_STRING_PARAM_SIZE];
  418. FUNC_PARAM params[] =
  419. {
  420. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  421. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress },
  422. { "dwCountryCode", PT_DWORD, (ULONG_PTR) dwDefCountryCode, NULL }
  423. };
  424. #if TAPI_2_0
  425. FUNC_PARAM_HEADER paramsHeader =
  426. { 3, funcIndex, params, (funcIndex == lRedirect ?
  427. (PFN3) lineRedirect : (PFN3) lineRedirectW) };
  428. #else
  429. FUNC_PARAM_HEADER paramsHeader =
  430. { 3, funcIndex, params, (PFN3) lineRedirect };
  431. #endif
  432. CHK_CALL_SELECTED()
  433. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  434. strcpy (szDestAddress, szDefDestAddress);
  435. lResult = DoFunc (&paramsHeader);
  436. break;
  437. }
  438. case lRegisterRequestRecipient:
  439. {
  440. FUNC_PARAM params[] =
  441. {
  442. { szhLineApp, PT_DWORD, 0, NULL },
  443. { "dwRegistrationInstance", PT_DWORD, 0, NULL },
  444. { "dwRequestMode", PT_FLAGS, LINEREQUESTMODE_MAKECALL, aRequestModes2 },
  445. { "bEnable", PT_DWORD, 1, NULL }
  446. };
  447. FUNC_PARAM_HEADER paramsHeader =
  448. { 4, funcIndex, params, (PFN4) lineRegisterRequestRecipient };
  449. CHK_LINEAPP_SELECTED()
  450. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  451. lResult = DoFunc (&paramsHeader);
  452. break;
  453. }
  454. case lRemoveFromConference:
  455. {
  456. FUNC_PARAM params[] =
  457. {
  458. { szhCall, PT_DWORD, 0, NULL }
  459. };
  460. FUNC_PARAM_HEADER paramsHeader =
  461. { 1, funcIndex, params, (PFN1) lineRemoveFromConference };
  462. CHK_CALL_SELECTED()
  463. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  464. lResult = DoFunc (&paramsHeader);
  465. break;
  466. }
  467. case lSecureCall:
  468. {
  469. FUNC_PARAM params[] =
  470. {
  471. { szhCall, PT_DWORD, 0, NULL }
  472. };
  473. FUNC_PARAM_HEADER paramsHeader =
  474. { 1, funcIndex, params, (PFN1) lineSecureCall };
  475. CHK_CALL_SELECTED()
  476. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  477. lResult = DoFunc (&paramsHeader);
  478. break;
  479. }
  480. case lSendUserUserInfo:
  481. {
  482. char szUserUserInfo[MAX_STRING_PARAM_SIZE];
  483. FUNC_PARAM params[] =
  484. {
  485. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  486. { szlpsUserUserInfo, PT_STRING, (ULONG_PTR) szUserUserInfo, szUserUserInfo },
  487. { szdwSize, PT_DWORD, (ULONG_PTR) strlen(szDefUserUserInfo)+1, NULL }
  488. };
  489. FUNC_PARAM_HEADER paramsHeader =
  490. { 3, funcIndex, params, (PFN3) lineSendUserUserInfo };
  491. CHK_CALL_SELECTED()
  492. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  493. strcpy (szUserUserInfo, szDefUserUserInfo);
  494. lResult = DoFunc (&paramsHeader);
  495. break;
  496. }
  497. #if TAPI_2_0
  498. case lSetAgentActivity:
  499. {
  500. FUNC_PARAM params[] =
  501. {
  502. { szhLine, PT_DWORD, 0, NULL },
  503. { szdwAddressID, PT_DWORD, 0, NULL },
  504. { "dwActivityID", PT_DWORD, 0, NULL }
  505. };
  506. FUNC_PARAM_HEADER paramsHeader =
  507. { 3, funcIndex, params, (PFN3) lineSetAgentActivity };
  508. CHK_LINE_SELECTED()
  509. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  510. DoFunc (&paramsHeader);
  511. break;
  512. }
  513. case lSetAgentGroup:
  514. {
  515. LPLINEAGENTGROUPLIST lpGroupList = (LPLINEAGENTGROUPLIST) pBigBuf;
  516. FUNC_PARAM params[] =
  517. {
  518. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  519. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  520. { "lpAgentGroupList", PT_POINTER, (ULONG_PTR) lpGroupList, lpGroupList }
  521. };
  522. FUNC_PARAM_HEADER paramsHeader =
  523. { 3, funcIndex, params, (PFN3) lineSetAgentGroup };
  524. CHK_LINE_SELECTED()
  525. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  526. // BUGBUG SetAgentGRp: allow user to fill in agent group list
  527. memset (lpGroupList, 0, (size_t) dwBigBufSize);
  528. lpGroupList->dwTotalSize = dwBigBufSize;
  529. DoFunc (&paramsHeader);
  530. break;
  531. }
  532. case lSetAgentState:
  533. {
  534. FUNC_PARAM params[] =
  535. {
  536. { szhLine, PT_DWORD, 0, NULL },
  537. { szdwAddressID, PT_DWORD, 0, NULL },
  538. { "dwAgentState", PT_FLAGS, 0, aAgentStates },
  539. { "dwNextAgentState", PT_FLAGS, 0, aAgentStates }
  540. };
  541. FUNC_PARAM_HEADER paramsHeader =
  542. { 4, funcIndex, params, (PFN4) lineSetAgentState };
  543. CHK_LINE_SELECTED()
  544. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  545. DoFunc (&paramsHeader);
  546. break;
  547. }
  548. #endif
  549. case lSetAppSpecific:
  550. {
  551. FUNC_PARAM params[] =
  552. {
  553. { szhCall, PT_DWORD, 0, NULL },
  554. { "dwAppSpecific", PT_DWORD, 0, NULL }
  555. };
  556. FUNC_PARAM_HEADER paramsHeader =
  557. { 2, funcIndex, params, (PFN2) lineSetAppSpecific };
  558. CHK_CALL_SELECTED()
  559. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  560. lResult = DoFunc (&paramsHeader);
  561. break;
  562. }
  563. #if TAPI_2_0
  564. case lSetCallData:
  565. {
  566. FUNC_PARAM params[] =
  567. {
  568. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  569. { "lpCallData", PT_POINTER, (ULONG_PTR) pBigBuf, pBigBuf },
  570. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  571. };
  572. FUNC_PARAM_HEADER paramsHeader =
  573. { 3, funcIndex, params, (PFN3) lineSetCallData };
  574. CHK_CALL_SELECTED()
  575. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  576. DoFunc (&paramsHeader);
  577. break;
  578. }
  579. #endif
  580. case lSetCallParams:
  581. {
  582. LINEDIALPARAMS dialParams;
  583. FUNC_PARAM params[] =
  584. {
  585. { szhCall, PT_DWORD, 0, NULL },
  586. { "dwBearerMode", PT_FLAGS, dwDefBearerMode, aBearerModes },
  587. { "dwMinRate", PT_DWORD, 3100, NULL },
  588. { "dwMaxRate", PT_DWORD, 3100, NULL },
  589. { "lpDialParams", PT_POINTER, 0, &dialParams },
  590. { " ->dwDialPause", PT_DWORD, 0, NULL },
  591. { " ->dwDialSpeed", PT_DWORD, 0, NULL },
  592. { " ->dwDigitDuration", PT_DWORD, 0, NULL },
  593. { " ->dwWaitForDialtone", PT_DWORD, 0, NULL }
  594. };
  595. FUNC_PARAM_HEADER paramsHeader =
  596. { 9, funcIndex, params, NULL };
  597. CHK_CALL_SELECTED()
  598. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  599. if (!LetUserMungeParams (&paramsHeader))
  600. {
  601. break;
  602. }
  603. dialParams.dwDialPause = (DWORD) params[5].dwValue;
  604. dialParams.dwDialSpeed = (DWORD) params[6].dwValue;
  605. dialParams.dwDigitDuration = (DWORD) params[7].dwValue;
  606. dialParams.dwWaitForDialtone = (DWORD) params[8].dwValue;
  607. lResult = lineSetCallParams(
  608. (HCALL) params[0].dwValue,
  609. (DWORD) params[1].dwValue,
  610. (DWORD) params[2].dwValue,
  611. (DWORD) params[3].dwValue,
  612. (LPLINEDIALPARAMS) params[4].dwValue
  613. );
  614. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  615. break;
  616. }
  617. case lSetCallPrivilege:
  618. {
  619. FUNC_PARAM params[] =
  620. {
  621. { szhCall, PT_DWORD, 0, NULL },
  622. { "dwCallPrivilege", PT_ORDINAL, LINECALLPRIVILEGE_OWNER, aCallPrivileges }
  623. };
  624. FUNC_PARAM_HEADER paramsHeader =
  625. { 2, funcIndex, params, (PFN2) lineSetCallPrivilege };
  626. CHK_CALL_SELECTED()
  627. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  628. if ((lResult = DoFunc (&paramsHeader)) == 0)
  629. {
  630. if (params[0].dwValue == (ULONG_PTR) pCallSel->hCall)
  631. {
  632. pCallSel->bMonitor = (params[0].dwValue ==
  633. LINECALLPRIVILEGE_MONITOR ? TRUE : FALSE);
  634. UpdateWidgetListCall (pCallSel);
  635. }
  636. else
  637. {
  638. PMYCALL pCall;
  639. if ((pCall = GetCall ((HCALL) params[0].dwValue)))
  640. {
  641. pCall->bMonitor = (params[0].dwValue ==
  642. LINECALLPRIVILEGE_MONITOR ? TRUE : FALSE);
  643. UpdateWidgetListCall (pCall);
  644. }
  645. }
  646. }
  647. break;
  648. }
  649. #if TAPI_2_0
  650. case lSetCallQualityOfService:
  651. {
  652. char szSendingFlowspec[MAX_STRING_PARAM_SIZE] = "123";
  653. char szReceivingFlowspec[MAX_STRING_PARAM_SIZE] = "321";
  654. FUNC_PARAM params[] =
  655. {
  656. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  657. { "lpSendingFlowspec", PT_STRING, (ULONG_PTR) szSendingFlowspec, szSendingFlowspec },
  658. { "dwSendingFlowspecSize", PT_DWORD, (ULONG_PTR) 4, 0 },
  659. { "lpReceivingFlowspec", PT_STRING, (ULONG_PTR) szReceivingFlowspec, szReceivingFlowspec },
  660. { "dwReceivingFlowspecSize",PT_DWORD, (ULONG_PTR) 4, 0 }
  661. };
  662. FUNC_PARAM_HEADER paramsHeader =
  663. { 5, funcIndex, params, (PFN5) lineSetCallQualityOfService };
  664. CHK_CALL_SELECTED()
  665. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  666. DoFunc (&paramsHeader);
  667. break;
  668. }
  669. case lSetCallTreatment:
  670. {
  671. FUNC_PARAM params[] =
  672. {
  673. { szhCall, PT_DWORD, 0, NULL },
  674. { "dwTreatment",PT_ORDINAL, LINECALLTREATMENT_SILENCE, aCallTreatments }
  675. };
  676. FUNC_PARAM_HEADER paramsHeader =
  677. { 2, funcIndex, params, (PFN2) lineSetCallTreatment };
  678. CHK_CALL_SELECTED()
  679. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  680. DoFunc (&paramsHeader);
  681. break;
  682. }
  683. #endif
  684. case lSetCurrentLocation:
  685. {
  686. FUNC_PARAM params[] =
  687. {
  688. { szhLineApp, PT_DWORD, 0, NULL },
  689. { "dwLocation", PT_DWORD, 0, NULL }
  690. };
  691. FUNC_PARAM_HEADER paramsHeader =
  692. { 2, funcIndex, params, (PFN2) lineSetCurrentLocation };
  693. if (pLineAppSel)
  694. {
  695. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  696. }
  697. lResult = DoFunc (&paramsHeader);
  698. break;
  699. }
  700. case lSetDevConfig:
  701. #if TAPI_2_0
  702. case lSetDevConfigW:
  703. #endif
  704. {
  705. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  706. char szErrorMsg[] = "Bad config info in buffer";
  707. FUNC_PARAM params[] =
  708. {
  709. { szdwDeviceID, PT_DWORD, (ULONG_PTR) 0, NULL },
  710. { "lpDeviceConfig", PT_POINTER, (ULONG_PTR) 0, NULL },
  711. { szdwSize, PT_DWORD, (ULONG_PTR) 0, NULL },
  712. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass },
  713. };
  714. #if TAPI_2_0
  715. FUNC_PARAM_HEADER paramsHeader =
  716. { 4, funcIndex, params, (funcIndex == lSetDevConfig ?
  717. (PFN4) lineSetDevConfig : (PFN4) lineSetDevConfigW) };
  718. #else
  719. FUNC_PARAM_HEADER paramsHeader =
  720. { 4, funcIndex, params, (PFN4) lineSetDevConfig };
  721. #endif
  722. //
  723. // Check to see if there's existing config info in the global buffer
  724. // (not a foolproof check, but good enough)
  725. //
  726. ShowStr ("Call lineGetDevConfig before calling lineSetDevConfig");
  727. if (dwBigBufSize >= sizeof (VARSTRING))
  728. {
  729. DWORD dwMaxDataSize = dwBigBufSize - sizeof (VARSTRING);
  730. LPVARSTRING pVarString = (LPVARSTRING) pBigBuf;
  731. if (pVarString->dwStringSize > dwMaxDataSize ||
  732. (pVarString->dwStringSize != 0 &&
  733. (pVarString->dwStringOffset < sizeof (VARSTRING) ||
  734. pVarString->dwStringOffset >
  735. (dwBigBufSize - pVarString->dwStringSize))))
  736. {
  737. ShowStr (szErrorMsg);
  738. break;
  739. }
  740. params[1].dwValue =
  741. params[1].u.dwDefValue = (ULONG_PTR)
  742. ((LPBYTE) pBigBuf + pVarString->dwStringOffset);
  743. params[2].dwValue =
  744. params[2].u.dwDefValue = pVarString->dwStringSize;
  745. }
  746. else
  747. {
  748. ShowStr (szErrorMsg);
  749. break;
  750. }
  751. strcpy (szDeviceClass, szDefLineDeviceClass);
  752. lResult = DoFunc (&paramsHeader);
  753. break;
  754. }
  755. #if TAPI_2_0
  756. case lSetLineDevStatus:
  757. {
  758. FUNC_PARAM params[] =
  759. {
  760. { szhLine, PT_DWORD, 0, NULL },
  761. { "dwStatusToChange", PT_FLAGS, 0, aLineDevStatusFlags },
  762. { "fStatus", PT_DWORD, 0, NULL }
  763. };
  764. FUNC_PARAM_HEADER paramsHeader =
  765. { 3, funcIndex, params, (PFN3) lineSetLineDevStatus };
  766. CHK_LINE_SELECTED()
  767. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  768. DoFunc (&paramsHeader);
  769. break;
  770. }
  771. #endif
  772. case lSetMediaControl:
  773. {
  774. LINEMEDIACONTROLDIGIT aDigits[1];
  775. LINEMEDIACONTROLMEDIA aMedias[1];
  776. LINEMEDIACONTROLTONE aTones[1];
  777. LINEMEDIACONTROLCALLSTATE aCallSts[1];
  778. FUNC_PARAM params[] =
  779. {
  780. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  781. { szdwAddressID, PT_DWORD, (ULONG_PTR) 0, NULL },
  782. { szhCall, PT_DWORD, (ULONG_PTR) 0, NULL },
  783. { "dwSelect", PT_ORDINAL, (ULONG_PTR) 0, aCallSelects },
  784. { "lpDigitList", PT_POINTER, (ULONG_PTR) aDigits, aDigits },
  785. { " ->dwDigit", PT_DWORD, (ULONG_PTR) 0, NULL },
  786. { " ->dwDigitModes", PT_FLAGS, (ULONG_PTR) 0, aDigitModes },
  787. { " ->dwMediaControl", PT_ORDINAL, (ULONG_PTR) 0, aMediaControls },
  788. { "dwDigitNumEntries", PT_DWORD, (ULONG_PTR) 0, NULL },
  789. { "lpMediaList", PT_POINTER, (ULONG_PTR) aMedias, aMedias },
  790. { " ->dwMediaModes", PT_FLAGS, (ULONG_PTR) 0, aMediaModes },
  791. { " ->dwDuration", PT_DWORD, (ULONG_PTR) 0, 0 },
  792. { " ->dwMediaControl", PT_ORDINAL, (ULONG_PTR) 0, aMediaControls },
  793. { "dwMediaNumEntries", PT_DWORD, (ULONG_PTR) 0, NULL },
  794. { "lpToneList", PT_POINTER, (ULONG_PTR) aTones, aTones },
  795. { " ->dwAppSpecific", PT_DWORD, (ULONG_PTR) 0, NULL },
  796. { " ->dwDuration", PT_DWORD, (ULONG_PTR) 0, NULL },
  797. { " ->dwFrequency1", PT_DWORD, (ULONG_PTR) 0, NULL },
  798. { " ->dwFrequency2", PT_DWORD, (ULONG_PTR) 0, NULL },
  799. { " ->dwFrequency3", PT_DWORD, (ULONG_PTR) 0, NULL },
  800. { " ->dwMediaControl", PT_ORDINAL, (ULONG_PTR) 0, aMediaControls },
  801. { "dwToneNumEntries", PT_DWORD, (ULONG_PTR) 0, NULL },
  802. { "lpCallStateList", PT_POINTER, (ULONG_PTR) aCallSts, aCallSts },
  803. { " ->dwCallStates", PT_FLAGS, (ULONG_PTR) 0, aCallStates },
  804. { " ->dwMediaControl", PT_ORDINAL, (ULONG_PTR) 0, aMediaControls },
  805. { "dwCallStateNumEntries", PT_DWORD,(ULONG_PTR) 0, NULL }
  806. };
  807. FUNC_PARAM_HEADER paramsHeader =
  808. { 26, funcIndex, params, (PFN12) lineSetMediaControl };
  809. CHK_LINE_SELECTED()
  810. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  811. if (pCallSel)
  812. {
  813. params[2].dwValue = (ULONG_PTR) pCallSel->hCall;
  814. params[3].dwValue = LINECALLSELECT_CALL;
  815. }
  816. else
  817. {
  818. params[3].dwValue = LINECALLSELECT_LINE;
  819. }
  820. if (LetUserMungeParams (&paramsHeader))
  821. {
  822. DumpParams (&paramsHeader);
  823. lResult = lineSetMediaControl(
  824. (HLINE) params[0].dwValue,
  825. (DWORD) params[1].dwValue,
  826. (HCALL) params[2].dwValue,
  827. (DWORD) params[3].dwValue,
  828. (LPLINEMEDIACONTROLDIGIT) params[4].dwValue,
  829. (DWORD) params[8].dwValue,
  830. (LPLINEMEDIACONTROLMEDIA) params[9].dwValue,
  831. (DWORD) params[13].dwValue,
  832. (LPLINEMEDIACONTROLTONE) params[14].dwValue,
  833. (DWORD) params[21].dwValue,
  834. (LPLINEMEDIACONTROLCALLSTATE) params[22].dwValue,
  835. (DWORD) params[25].dwValue
  836. );
  837. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  838. }
  839. break;
  840. }
  841. case lSetMediaMode:
  842. {
  843. FUNC_PARAM params[] =
  844. {
  845. { szhCall, PT_DWORD, 0, NULL },
  846. { "dwMediaModes", PT_FLAGS, dwDefMediaMode, aMediaModes }
  847. };
  848. FUNC_PARAM_HEADER paramsHeader =
  849. { 2, funcIndex, params, (PFN2) lineSetMediaMode };
  850. CHK_CALL_SELECTED()
  851. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  852. lResult = DoFunc (&paramsHeader);
  853. break;
  854. }
  855. case lSetNumRings:
  856. {
  857. FUNC_PARAM params[] =
  858. {
  859. { szhLine, PT_DWORD, 0, NULL },
  860. { szdwAddressID, PT_DWORD, dwDefAddressID, NULL },
  861. { "dwNumRings", PT_DWORD, 5, NULL }
  862. };
  863. FUNC_PARAM_HEADER paramsHeader =
  864. { 3, funcIndex, params, (PFN3) lineSetNumRings };
  865. CHK_LINE_SELECTED()
  866. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  867. lResult = DoFunc (&paramsHeader);
  868. break;
  869. }
  870. case lSetStatusMessages:
  871. {
  872. FUNC_PARAM params[] =
  873. {
  874. { szhLine, PT_DWORD, 0, NULL },
  875. { "dwLineStates", PT_FLAGS, 0, aLineStates },
  876. { "dwAddressStates", PT_FLAGS, 0, aAddressStates }
  877. };
  878. FUNC_PARAM_HEADER paramsHeader =
  879. { 3, funcIndex, params, (PFN3) lineSetStatusMessages };
  880. CHK_LINE_SELECTED()
  881. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  882. lResult = DoFunc (&paramsHeader);
  883. break;
  884. }
  885. case lSetTerminal:
  886. {
  887. FUNC_PARAM params[] =
  888. {
  889. { szhLine, PT_DWORD, 0, NULL },
  890. { szdwAddressID, PT_DWORD, dwDefAddressID, NULL },
  891. { szhCall, PT_DWORD, 0, NULL },
  892. { "dwSelect", PT_ORDINAL, LINECALLSELECT_LINE, aCallSelects },
  893. { "dwTerminalModes", PT_FLAGS, LINETERMMODE_BUTTONS, aTerminalModes },
  894. { "dwTerminalID", PT_DWORD, 0, NULL },
  895. { "bEnable", PT_DWORD, 0, NULL },
  896. };
  897. FUNC_PARAM_HEADER paramsHeader =
  898. { 7, funcIndex, params, (PFN7) lineSetTerminal };
  899. CHK_LINE_SELECTED()
  900. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  901. if (pCallSel)
  902. {
  903. params[2].dwValue = (ULONG_PTR) pCallSel->hCall;
  904. }
  905. lResult = DoFunc (&paramsHeader);
  906. break;
  907. }
  908. case lSetTollList:
  909. #if TAPI_2_0
  910. case lSetTollListW:
  911. #endif
  912. {
  913. char szAddressIn[MAX_STRING_PARAM_SIZE];
  914. FUNC_PARAM params[] =
  915. {
  916. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  917. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  918. { "lpszAddressIn", PT_STRING, (ULONG_PTR) szAddressIn, szAddressIn },
  919. { "dwTollListOption", PT_FLAGS, (ULONG_PTR) LINETOLLLISTOPTION_ADD, aTollListOptions }
  920. };
  921. #if TAPI_2_0
  922. FUNC_PARAM_HEADER paramsHeader =
  923. { 4, funcIndex, params, (funcIndex == lSetTollList ?
  924. (PFN4) lineSetTollList : (PFN4) lineSetTollListW) };
  925. #else
  926. FUNC_PARAM_HEADER paramsHeader =
  927. { 4, funcIndex, params, (PFN4) lineSetTollList };
  928. #endif
  929. if (pLineAppSel)
  930. {
  931. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  932. }
  933. strcpy (szAddressIn, szDefDestAddress);
  934. lResult = DoFunc (&paramsHeader);
  935. break;
  936. }
  937. case lSetupConference:
  938. #if TAPI_2_0
  939. case lSetupConferenceW:
  940. #endif
  941. {
  942. PMYCALL pNewCall, pNewCall2;
  943. FUNC_PARAM params[] =
  944. {
  945. { szhCall, PT_DWORD, 0, NULL },
  946. { szhLine, PT_DWORD, 0, NULL },
  947. { "lphConfCall", PT_POINTER, 0, NULL },
  948. { szlphConsultCall, PT_POINTER, 0, NULL },
  949. { "dwNumParties", PT_DWORD, 3, NULL },
  950. { szlpCallParams, PT_CALLPARAMS, 0, lpCallParams }
  951. };
  952. #if TAPI_2_0
  953. FUNC_PARAM_HEADER paramsHeader =
  954. { 6, funcIndex, params, (funcIndex == lSetupConference ?
  955. (PFN6) lineSetupConference : (PFN6) lineSetupConferenceW) };
  956. #else
  957. FUNC_PARAM_HEADER paramsHeader =
  958. { 6, funcIndex, params, (PFN6) lineSetupConference };
  959. #endif
  960. CHK_LINE_SELECTED()
  961. if (!(pNewCall = AllocCall (pLineSel)))
  962. {
  963. break;
  964. }
  965. if (!(pNewCall2 = AllocCall (pLineSel)))
  966. {
  967. FreeCall (pNewCall);
  968. break;
  969. }
  970. params[0].dwValue = (ULONG_PTR) (pCallSel ? pCallSel->hCall : 0);
  971. params[1].dwValue = (ULONG_PTR) pLineSel->hLine;
  972. params[2].dwValue =
  973. params[2].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  974. params[3].dwValue =
  975. params[3].u.dwDefValue = (ULONG_PTR) &pNewCall2->hCall;
  976. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  977. {
  978. //
  979. // Note that the hLine param is ignored if the hCall is non-NULL
  980. //
  981. if (params[0].dwValue)
  982. {
  983. if (!pCallSel ||
  984. (params[0].dwValue != (ULONG_PTR) pCallSel->hCall))
  985. {
  986. //
  987. // Get the assoc pLine, if it's diff need to move new calls
  988. //
  989. PMYWIDGET pWidget = aWidgets;
  990. PMYLINE pLine = (PMYLINE) NULL;
  991. while (1)
  992. {
  993. if ((pWidget->dwType == WT_CALL) &&
  994. (params[0].dwValue == (ULONG_PTR)
  995. ((PMYCALL)pWidget)->hCall))
  996. {
  997. break;
  998. }
  999. else if (pWidget->dwType == WT_LINE)
  1000. {
  1001. pLine = (PMYLINE) pWidget;
  1002. }
  1003. pWidget = pWidget->pNext;
  1004. }
  1005. if (pLine != pLineSel)
  1006. {
  1007. MoveCallToLine (pNewCall, pLine->hLine);
  1008. MoveCallToLine (pNewCall2, pLine->hLine);
  1009. }
  1010. }
  1011. }
  1012. else if (params[1].dwValue != (ULONG_PTR) pLineSel->hLine)
  1013. {
  1014. MoveCallToLine (pNewCall, (HLINE) params[1].dwValue);
  1015. MoveCallToLine (pNewCall2, (HLINE) params[1].dwValue);
  1016. }
  1017. pNewCall->lMakeCallReqID =
  1018. pNewCall2->lMakeCallReqID = lResult;
  1019. dwNumPendingMakeCalls += 2;
  1020. SelectWidget ((PMYWIDGET) pNewCall);
  1021. }
  1022. else
  1023. {
  1024. FreeCall (pNewCall);
  1025. FreeCall (pNewCall2);
  1026. }
  1027. break;
  1028. }
  1029. case lSetupTransfer:
  1030. #if TAPI_2_0
  1031. case lSetupTransferW:
  1032. #endif
  1033. {
  1034. PMYCALL pNewCall;
  1035. FUNC_PARAM params[] =
  1036. {
  1037. { szhCall, PT_DWORD, 0, NULL },
  1038. { szlphConsultCall, PT_POINTER, 0, NULL },
  1039. { szlpCallParams, PT_CALLPARAMS, 0, lpCallParams }
  1040. };
  1041. #if TAPI_2_0
  1042. FUNC_PARAM_HEADER paramsHeader =
  1043. { 3, funcIndex, params, (funcIndex == lSetupTransfer ?
  1044. (PFN3) lineSetupTransfer : (PFN3) lineSetupTransferW) };
  1045. #else
  1046. FUNC_PARAM_HEADER paramsHeader =
  1047. { 3, funcIndex, params, (PFN3) lineSetupTransfer };
  1048. #endif
  1049. CHK_CALL_SELECTED()
  1050. if (!(pNewCall = AllocCall (pLineSel)))
  1051. {
  1052. break;
  1053. }
  1054. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1055. params[1].dwValue =
  1056. params[1].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  1057. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  1058. {
  1059. //
  1060. // First make sure we're created the call under the right line,
  1061. // and if not move it to the right place in the widgets list
  1062. //
  1063. LINECALLINFO callInfo;
  1064. memset (&callInfo, 0, sizeof(LINECALLINFO));
  1065. callInfo.dwTotalSize = sizeof(LINECALLINFO);
  1066. if (lineGetCallInfo ((HCALL) params[0].dwValue, &callInfo) == 0)
  1067. {
  1068. if (callInfo.hLine != pLineSel->hLine)
  1069. {
  1070. MoveCallToLine (pNewCall, callInfo.hLine);
  1071. }
  1072. }
  1073. pNewCall->lMakeCallReqID = lResult;
  1074. dwNumPendingMakeCalls++;
  1075. SelectWidget ((PMYWIDGET) pNewCall);
  1076. }
  1077. else
  1078. {
  1079. FreeCall (pNewCall);
  1080. }
  1081. break;
  1082. }
  1083. case lShutdown:
  1084. {
  1085. FUNC_PARAM params[] =
  1086. {
  1087. { szhLineApp, PT_DWORD, 0, NULL }
  1088. };
  1089. FUNC_PARAM_HEADER paramsHeader =
  1090. { 1, funcIndex, params, (PFN1) lineShutdown };
  1091. CHK_LINEAPP_SELECTED()
  1092. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1093. lResult = DoFunc (&paramsHeader);
  1094. if (lResult == 0)
  1095. {
  1096. ShowWidgetList (FALSE);
  1097. FreeLineApp (GetLineApp((HLINEAPP) params[0].dwValue));
  1098. ShowWidgetList (TRUE);
  1099. }
  1100. break;
  1101. }
  1102. case lSwapHold:
  1103. {
  1104. FUNC_PARAM params[] =
  1105. {
  1106. { "hActiveCall", PT_DWORD, 0, NULL },
  1107. { "hHeldCall", PT_DWORD, 0, NULL }
  1108. };
  1109. FUNC_PARAM_HEADER paramsHeader =
  1110. { 2, funcIndex, params, (PFN2) lineSwapHold };
  1111. CHK_TWO_CALLS_SELECTED()
  1112. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1113. params[1].dwValue = (ULONG_PTR) pCallSel2->hCall;
  1114. lResult = DoFunc (&paramsHeader);
  1115. break;
  1116. }
  1117. case lTranslateAddress:
  1118. #if TAPI_2_0
  1119. case lTranslateAddressW:
  1120. #endif
  1121. {
  1122. char szAddressIn[MAX_STRING_PARAM_SIZE];
  1123. LPLINETRANSLATEOUTPUT lpXlatOutput = (LPLINETRANSLATEOUTPUT) pBigBuf;
  1124. FUNC_PARAM params[] =
  1125. {
  1126. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1127. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  1128. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1129. { "lpszAddressIn", PT_STRING, (ULONG_PTR) szAddressIn, szAddressIn },
  1130. { "dwCard", PT_DWORD, (ULONG_PTR) 0, NULL },
  1131. { "dwTranslateOptions", PT_FLAGS, (ULONG_PTR) LINETRANSLATEOPTION_CARDOVERRIDE, aTranslateOptions },
  1132. { "lpTranslateOutput", PT_POINTER, (ULONG_PTR) lpXlatOutput, lpXlatOutput }
  1133. };
  1134. #if TAPI_2_0
  1135. FUNC_PARAM_HEADER paramsHeader =
  1136. { 7, funcIndex, params, (funcIndex == lTranslateAddress ?
  1137. (PFN7) lineTranslateAddress : (PFN7) lineTranslateAddressW) };
  1138. #else
  1139. FUNC_PARAM_HEADER paramsHeader =
  1140. { 7, funcIndex, params, (PFN7) lineTranslateAddress };
  1141. #endif
  1142. if (pLineAppSel)
  1143. {
  1144. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1145. }
  1146. else
  1147. {
  1148. params[0].dwValue = 0;
  1149. }
  1150. memset (lpXlatOutput, 0, (size_t) dwBigBufSize);
  1151. lpXlatOutput->dwTotalSize = dwBigBufSize;
  1152. strcpy (szAddressIn, szDefDestAddress);
  1153. lResult = DoFunc (&paramsHeader);
  1154. if (lResult == 0)
  1155. {
  1156. ShowStructByDWORDs (lpXlatOutput);
  1157. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1158. {
  1159. STRUCT_FIELD fields[] =
  1160. {
  1161. { "dwDialableStringSize", FT_SIZE, lpXlatOutput->dwDialableStringSize, NULL },
  1162. { "dwDialableStringOffset", FT_OFFSET, lpXlatOutput->dwDialableStringOffset, NULL },
  1163. { "dwDisplayableStringSize", FT_SIZE, lpXlatOutput->dwDisplayableStringSize, NULL },
  1164. { "dwDisplayableStringOffset", FT_OFFSET, lpXlatOutput->dwDisplayableStringOffset, NULL },
  1165. { "dwCurrentCountry", FT_DWORD, lpXlatOutput->dwCurrentCountry, NULL },
  1166. { "dwDestCountry", FT_DWORD, lpXlatOutput->dwDestCountry, NULL },
  1167. { "dwTranslateResults", FT_FLAGS, lpXlatOutput->dwTranslateResults, aTranslateResults },
  1168. };
  1169. STRUCT_FIELD_HEADER fieldHeader =
  1170. {
  1171. lpXlatOutput,
  1172. "LINETRANSLATEOUTPUT",
  1173. 7,
  1174. fields
  1175. };
  1176. ShowStructByField (&fieldHeader, FALSE);
  1177. }
  1178. }
  1179. break;
  1180. }
  1181. case lUncompleteCall:
  1182. {
  1183. FUNC_PARAM params[] =
  1184. {
  1185. { szhLine, PT_DWORD, 0, NULL },
  1186. { "dwCompletionID", PT_DWORD, 0, NULL }
  1187. };
  1188. FUNC_PARAM_HEADER paramsHeader =
  1189. { 2, funcIndex, params, (PFN2) lineUncompleteCall };
  1190. CHK_LINE_SELECTED()
  1191. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1192. lResult = DoFunc (&paramsHeader);
  1193. break;
  1194. }
  1195. case lUnhold:
  1196. {
  1197. FUNC_PARAM params[] =
  1198. {
  1199. { szhCall, PT_DWORD, 0, NULL }
  1200. };
  1201. FUNC_PARAM_HEADER paramsHeader =
  1202. { 1, funcIndex, params, (PFN1) lineUnhold };
  1203. CHK_CALL_SELECTED()
  1204. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1205. lResult = DoFunc (&paramsHeader);
  1206. break;
  1207. }
  1208. case lUnpark:
  1209. #if TAPI_2_0
  1210. case lUnparkW:
  1211. #endif
  1212. {
  1213. PMYCALL pNewCall;
  1214. char szDestAddress[MAX_STRING_PARAM_SIZE];
  1215. FUNC_PARAM params[] =
  1216. {
  1217. { szhLine, PT_DWORD, (ULONG_PTR) 0, NULL },
  1218. { szdwAddressID, PT_DWORD, (ULONG_PTR) dwDefAddressID, NULL },
  1219. { szlphCall, PT_POINTER, (ULONG_PTR) 0, NULL },
  1220. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress }
  1221. };
  1222. #if TAPI_2_0
  1223. FUNC_PARAM_HEADER paramsHeader =
  1224. { 4, funcIndex, params, (funcIndex == lUnpark ?
  1225. (PFN4) lineUnpark : (PFN4) lineUnparkW) };
  1226. #else
  1227. FUNC_PARAM_HEADER paramsHeader =
  1228. { 4, funcIndex, params, (PFN4) lineUnpark };
  1229. #endif
  1230. CHK_LINE_SELECTED()
  1231. if (!(pNewCall = AllocCall (pLineSel)))
  1232. {
  1233. break;
  1234. }
  1235. params[0].dwValue = (ULONG_PTR) pLineSel->hLine;
  1236. params[2].dwValue =
  1237. params[2].u.dwDefValue = (ULONG_PTR) &pNewCall->hCall;
  1238. strcpy (szDestAddress, szDefDestAddress);
  1239. if ((lResult = DoFunc (&paramsHeader)) >= 0)
  1240. {
  1241. if (params[0].dwValue != (ULONG_PTR) pLineSel->hLine)
  1242. {
  1243. MoveCallToLine (pNewCall, (HLINE) params[0].dwValue);
  1244. }
  1245. pNewCall->lMakeCallReqID = lResult;
  1246. dwNumPendingMakeCalls++;
  1247. SelectWidget ((PMYWIDGET) pNewCall);
  1248. }
  1249. else
  1250. {
  1251. FreeCall (pNewCall);
  1252. }
  1253. break;
  1254. }
  1255. #if TAPI_1_1
  1256. case lAddProvider:
  1257. #if TAPI_2_0
  1258. case lAddProviderW:
  1259. #endif
  1260. {
  1261. #if TAPI_2_0
  1262. char szProviderFilename[MAX_STRING_PARAM_SIZE] = "esp32.tsp";
  1263. #else
  1264. char szProviderFilename[MAX_STRING_PARAM_SIZE] = "esp.tsp";
  1265. #endif
  1266. DWORD dwPermanentProviderID;
  1267. FUNC_PARAM params[] =
  1268. {
  1269. { "lpszProviderFilename", PT_STRING, (ULONG_PTR) szProviderFilename, szProviderFilename },
  1270. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1271. { "lpdwPermanentProviderID", PT_POINTER, (ULONG_PTR) &dwPermanentProviderID, &dwPermanentProviderID }
  1272. };
  1273. #if TAPI_2_0
  1274. FUNC_PARAM_HEADER paramsHeader =
  1275. { 3, funcIndex, params, (funcIndex == lAddProvider ?
  1276. (PFN3) lineAddProvider : (PFN3) lineAddProviderW) };
  1277. #else
  1278. FUNC_PARAM_HEADER paramsHeader =
  1279. { 3, funcIndex, params, (PFN3) lineAddProvider };
  1280. #endif
  1281. #ifdef WIN32
  1282. lResult = DoFunc (&paramsHeader);
  1283. #else
  1284. //
  1285. // NOTE: on win16 HWNDs are 16 bits, so we've to hard code this
  1286. //
  1287. if (!LetUserMungeParams (&paramsHeader))
  1288. {
  1289. break;
  1290. }
  1291. DumpParams (&paramsHeader);
  1292. lResult = lineAddProvider(
  1293. (LPCSTR) params[0].dwValue,
  1294. (HWND) params[1].dwValue,
  1295. (LPDWORD) params[2].dwValue
  1296. );
  1297. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1298. if (lResult == 0)
  1299. {
  1300. ShowStr ("%sdwPermanentProviderID = x%lx", szTab, dwPermanentProviderID);
  1301. }
  1302. #endif
  1303. break;
  1304. }
  1305. case lConfigDialogEdit:
  1306. #if TAPI_2_0
  1307. case lConfigDialogEditW:
  1308. #endif
  1309. {
  1310. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  1311. char szDeviceConfigIn[MAX_STRING_PARAM_SIZE] = "";
  1312. char szErrorMsg[] = "Bad config info in buffer";
  1313. LPBYTE pDataIn;
  1314. LPVARSTRING lpDeviceConfigOut = (LPVARSTRING) pBigBuf;
  1315. FUNC_PARAM params[] =
  1316. {
  1317. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  1318. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1319. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass },
  1320. { "lpDeviceConfigIn", PT_POINTER, (ULONG_PTR) 0, NULL },
  1321. { szdwSize, PT_DWORD, (ULONG_PTR) 0, NULL },
  1322. { "lpDeviceConfigOut", PT_POINTER, (ULONG_PTR) lpDeviceConfigOut, lpDeviceConfigOut }
  1323. };
  1324. #if TAPI_2_0
  1325. FUNC_PARAM_HEADER paramsHeader =
  1326. { 6, funcIndex, params, (funcIndex == lConfigDialogEdit ?
  1327. (PFN6) lineConfigDialogEdit : (PFN6) lineConfigDialogEditW) };
  1328. #else
  1329. FUNC_PARAM_HEADER paramsHeader =
  1330. { 6, funcIndex, params, (PFN6) lineConfigDialogEdit };
  1331. #endif
  1332. //
  1333. // Check to see if there's existing config info in the global buffer
  1334. // (not a foolproof check, but good enough), and if so alloc an
  1335. // intermediate buffer to use for config in data & copy the
  1336. // existing data over
  1337. //
  1338. ShowStr ("Call lineGetDevConfig before calling lineConfigDialogEdit");
  1339. if (dwBigBufSize >= sizeof (VARSTRING))
  1340. {
  1341. DWORD dwMaxDataSize = dwBigBufSize - sizeof (VARSTRING);
  1342. LPVARSTRING pVarString = (LPVARSTRING) pBigBuf;
  1343. if (pVarString->dwStringSize > dwMaxDataSize ||
  1344. (pVarString->dwStringSize != 0 &&
  1345. (pVarString->dwStringOffset < sizeof (VARSTRING) ||
  1346. pVarString->dwStringOffset >
  1347. (dwBigBufSize - pVarString->dwStringSize))))
  1348. {
  1349. ShowStr (szErrorMsg);
  1350. break;
  1351. }
  1352. pDataIn = malloc (pVarString->dwStringSize);
  1353. memcpy(
  1354. pDataIn,
  1355. (LPBYTE) pBigBuf + pVarString->dwStringOffset,
  1356. pVarString->dwStringSize
  1357. );
  1358. params[3].dwValue =
  1359. params[3].u.dwDefValue = (ULONG_PTR) pDataIn;
  1360. }
  1361. else
  1362. {
  1363. ShowStr (szErrorMsg);
  1364. break;
  1365. }
  1366. strcpy (szDeviceClass, szDefLineDeviceClass);
  1367. memset (lpDeviceConfigOut, 0, (size_t) dwBigBufSize);
  1368. lpDeviceConfigOut->dwTotalSize = dwBigBufSize;
  1369. #ifdef WIN32
  1370. lResult = DoFunc (&paramsHeader);
  1371. #else
  1372. //
  1373. // NOTE: on win16 HWNDSs are 16 bits, so we've to hard code this
  1374. //
  1375. if (!LetUserMungeParams (&paramsHeader))
  1376. {
  1377. break;
  1378. }
  1379. DumpParams (&paramsHeader);
  1380. lResult = lineConfigDialogEdit(
  1381. params[0].dwValue,
  1382. (HWND) params[1].dwValue,
  1383. (LPCSTR) params[2].dwValue,
  1384. (LPVOID) params[3].dwValue,
  1385. params[4].dwValue,
  1386. (LPVARSTRING) params[5].dwValue
  1387. );
  1388. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1389. #endif
  1390. if (lResult == 0)
  1391. {
  1392. ShowStructByDWORDs (lpDeviceConfigOut);
  1393. ShowVARSTRING (lpDeviceConfigOut);
  1394. }
  1395. free (pDataIn);
  1396. break;
  1397. }
  1398. case lConfigProvider:
  1399. {
  1400. FUNC_PARAM params[] =
  1401. {
  1402. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1403. { "dwPermanentProviderID", PT_DWORD, (ULONG_PTR) 2, NULL }
  1404. };
  1405. FUNC_PARAM_HEADER paramsHeader =
  1406. { 2, funcIndex, params, (PFN2) lineConfigProvider };
  1407. #ifdef WIN32
  1408. lResult = DoFunc (&paramsHeader);
  1409. #else
  1410. //
  1411. // NOTE: on win16 HWNDs are 16 bits, so we've to hard code this
  1412. //
  1413. if (!LetUserMungeParams (&paramsHeader))
  1414. {
  1415. break;
  1416. }
  1417. DumpParams (&paramsHeader);
  1418. lResult = lineConfigProvider(
  1419. (HWND) params[0].dwValue,
  1420. params[1].dwValue
  1421. );
  1422. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1423. #endif
  1424. break;
  1425. }
  1426. case lGetAppPriority:
  1427. #if TAPI_2_0
  1428. case lGetAppPriorityW:
  1429. #endif
  1430. {
  1431. DWORD dwPriority;
  1432. LINEEXTENSIONID extID;
  1433. char szAppName[MAX_STRING_PARAM_SIZE];
  1434. LPVARSTRING lpExtName = (LPVARSTRING) pBigBuf;
  1435. FUNC_PARAM params[] =
  1436. {
  1437. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  1438. { "dwMediaMode", PT_FLAGS, (ULONG_PTR) dwDefMediaMode, aMediaModes },
  1439. { "lpExtensionID", PT_POINTER, (ULONG_PTR) &extID, &extID },
  1440. { " ->dwExtensionID0", PT_DWORD, (ULONG_PTR) 0, NULL },
  1441. { " ->dwExtensionID1", PT_DWORD, (ULONG_PTR) 0, NULL },
  1442. { " ->dwExtensionID2", PT_DWORD, (ULONG_PTR) 0, NULL },
  1443. { " ->dwExtensionID3", PT_DWORD, (ULONG_PTR) 0, NULL },
  1444. { "dwRequestMode", PT_FLAGS, (ULONG_PTR) LINEREQUESTMODE_MAKECALL, aRequestModes },
  1445. { "lpExtensionName", PT_POINTER, (ULONG_PTR) lpExtName, lpExtName },
  1446. { "lpdwPriority", PT_POINTER, (ULONG_PTR) &dwPriority, &dwPriority }
  1447. };
  1448. FUNC_PARAM_HEADER paramsHeader =
  1449. { 10, funcIndex, params, NULL };
  1450. memset (lpExtName, 0, (size_t) dwBigBufSize);
  1451. lpExtName->dwTotalSize = dwBigBufSize;
  1452. strcpy (szAppName, szDefAppName);
  1453. if (!LetUserMungeParams (&paramsHeader))
  1454. {
  1455. break;
  1456. }
  1457. extID.dwExtensionID0 = (DWORD) params[3].dwValue;
  1458. extID.dwExtensionID1 = (DWORD) params[4].dwValue;
  1459. extID.dwExtensionID2 = (DWORD) params[5].dwValue;
  1460. extID.dwExtensionID3 = (DWORD) params[6].dwValue;
  1461. #if TAPI_2_0
  1462. if (funcIndex == lGetAppPriority)
  1463. {
  1464. lResult = lineGetAppPriority(
  1465. (LPCSTR) params[0].dwValue,
  1466. (DWORD) params[1].dwValue,
  1467. (LPLINEEXTENSIONID) params[2].dwValue,
  1468. (DWORD) params[7].dwValue,
  1469. (LPVARSTRING) params[8].dwValue,
  1470. (LPDWORD) params[9].dwValue
  1471. );
  1472. }
  1473. else
  1474. {
  1475. MakeWideString ((LPVOID) params[0].dwValue);
  1476. lResult = lineGetAppPriorityW(
  1477. (LPCWSTR) params[0].dwValue,
  1478. (DWORD) params[1].dwValue,
  1479. (LPLINEEXTENSIONID) params[2].dwValue,
  1480. (DWORD) params[7].dwValue,
  1481. (LPVARSTRING) params[8].dwValue,
  1482. (LPDWORD) params[9].dwValue
  1483. );
  1484. }
  1485. #else
  1486. lResult = lineGetAppPriority(
  1487. (LPCSTR) params[0].dwValue,
  1488. params[1].dwValue,
  1489. (LPLINEEXTENSIONID) params[2].dwValue,
  1490. params[7].dwValue,
  1491. (LPVARSTRING) params[8].dwValue,
  1492. (LPDWORD) params[9].dwValue
  1493. );
  1494. #endif
  1495. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1496. if (lResult == 0)
  1497. {
  1498. ShowStr ("%sdwPriority = x%lx", szTab, dwPriority);
  1499. ShowStructByDWORDs (lpExtName);
  1500. }
  1501. break;
  1502. }
  1503. case lGetCountry:
  1504. #if TAPI_2_0
  1505. case lGetCountryW:
  1506. #endif
  1507. {
  1508. LPLINECOUNTRYLIST lpCountryList = (LPLINECOUNTRYLIST) pBigBuf;
  1509. FUNC_PARAM params[] =
  1510. {
  1511. { "dwCountryID", PT_DWORD, (ULONG_PTR) 1, NULL },
  1512. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1513. { "lpLineCountryList", PT_POINTER, (ULONG_PTR) lpCountryList, lpCountryList }
  1514. };
  1515. #if TAPI_2_0
  1516. FUNC_PARAM_HEADER paramsHeader =
  1517. { 3, funcIndex, params, (funcIndex == lGetCountry ?
  1518. (PFN3) lineGetCountry : (PFN3) lineGetCountryW) };
  1519. #else
  1520. FUNC_PARAM_HEADER paramsHeader =
  1521. { 3, funcIndex, params, (PFN3) lineGetCountry };
  1522. #endif
  1523. memset (lpCountryList, 0, (size_t) dwBigBufSize);
  1524. lpCountryList->dwTotalSize = dwBigBufSize;
  1525. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1526. {
  1527. UpdateResults (TRUE);
  1528. ShowStructByDWORDs (lpCountryList);
  1529. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1530. {
  1531. LPLINECOUNTRYENTRY lpCountryEntry;
  1532. STRUCT_FIELD fields[] =
  1533. {
  1534. { "dwNumCountries", FT_DWORD, lpCountryList->dwNumCountries, NULL },
  1535. { "dwCountryListSize", FT_DWORD, lpCountryList->dwCountryListSize, NULL },
  1536. { "dwCountryListOffset", FT_DWORD, lpCountryList->dwCountryListOffset, NULL }
  1537. };
  1538. STRUCT_FIELD_HEADER fieldHeader =
  1539. {
  1540. lpCountryList,
  1541. "LINECOUNTRYLIST",
  1542. 3,
  1543. fields
  1544. };
  1545. ShowStructByField (&fieldHeader, FALSE);
  1546. lpCountryEntry = (LPLINECOUNTRYENTRY)
  1547. (((LPBYTE)lpCountryList) +
  1548. lpCountryList->dwCountryListOffset);
  1549. for (i = 0; i < lpCountryList->dwNumCountries; i++)
  1550. {
  1551. char buf[32];
  1552. STRUCT_FIELD fields[] =
  1553. {
  1554. { "dwCountryID", FT_DWORD, lpCountryEntry->dwCountryID, NULL },
  1555. { "dwCountryCode", FT_DWORD, lpCountryEntry->dwCountryCode, NULL },
  1556. { "dwNextCountryID", FT_DWORD, lpCountryEntry->dwNextCountryID, NULL },
  1557. { "dwCountryNameSize", FT_SIZE, lpCountryEntry->dwCountryNameSize, NULL },
  1558. { "dwCountryNameOffset", FT_OFFSET, lpCountryEntry->dwCountryNameOffset, NULL },
  1559. { "dwSameAreaRuleSize", FT_SIZE, lpCountryEntry->dwSameAreaRuleSize, NULL },
  1560. { "dwSameAreaRuleOffset", FT_OFFSET, lpCountryEntry->dwSameAreaRuleOffset, NULL },
  1561. { "dwLongDistanceRuleSize", FT_SIZE, lpCountryEntry->dwLongDistanceRuleSize, NULL },
  1562. { "dwLongDistanceRuleOffset", FT_OFFSET, lpCountryEntry->dwLongDistanceRuleOffset, NULL },
  1563. { "dwInternationalRuleSize", FT_SIZE, lpCountryEntry->dwInternationalRuleSize, NULL },
  1564. { "dwInternationalRuleOffset", FT_OFFSET, lpCountryEntry->dwInternationalRuleOffset, NULL }
  1565. };
  1566. STRUCT_FIELD_HEADER fieldHeader =
  1567. {
  1568. lpCountryList, // size,offset relative to ctrylist
  1569. buf,
  1570. 11,
  1571. fields
  1572. };
  1573. sprintf (buf, "LINECOUNTRYENTRY[%ld]", i);
  1574. ShowStructByField (&fieldHeader, TRUE);
  1575. lpCountryEntry++;
  1576. }
  1577. }
  1578. UpdateResults (FALSE);
  1579. }
  1580. break;
  1581. }
  1582. case lGetProviderList:
  1583. #if TAPI_2_0
  1584. case lGetProviderListW:
  1585. #endif
  1586. {
  1587. LPLINEPROVIDERLIST lpProviderList = (LPLINEPROVIDERLIST) pBigBuf;
  1588. FUNC_PARAM params[] =
  1589. {
  1590. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1591. { "lpProviderList", PT_POINTER, (ULONG_PTR) lpProviderList, lpProviderList }
  1592. };
  1593. #if TAPI_2_0
  1594. FUNC_PARAM_HEADER paramsHeader =
  1595. { 2, funcIndex, params, (funcIndex == lGetProviderList ?
  1596. (PFN3) lineGetProviderList : (PFN3) lineGetProviderListW) };
  1597. #else
  1598. FUNC_PARAM_HEADER paramsHeader =
  1599. { 2, funcIndex, params, (PFN3) lineGetProviderList };
  1600. #endif
  1601. memset (lpProviderList, 0, (size_t) dwBigBufSize);
  1602. lpProviderList->dwTotalSize = dwBigBufSize;
  1603. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1604. {
  1605. UpdateResults (TRUE);
  1606. ShowStructByDWORDs (lpProviderList);
  1607. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1608. {
  1609. LPLINEPROVIDERENTRY lpProviderEntry;
  1610. STRUCT_FIELD fields[] =
  1611. {
  1612. { "dwNumProviders", FT_DWORD, lpProviderList->dwNumProviders, NULL },
  1613. { "dwProviderListSize", FT_DWORD, lpProviderList->dwProviderListSize, NULL },
  1614. { "dwProviderListOffset", FT_DWORD, lpProviderList->dwProviderListOffset, NULL },
  1615. };
  1616. STRUCT_FIELD_HEADER fieldHeader =
  1617. {
  1618. lpProviderList,
  1619. "LINEPROVIDERLIST",
  1620. 3,
  1621. fields
  1622. };
  1623. ShowStructByField (&fieldHeader, FALSE);
  1624. lpProviderEntry = (LPLINEPROVIDERENTRY)
  1625. (((LPBYTE) lpProviderList) +
  1626. lpProviderList->dwProviderListOffset);
  1627. for (i = 0; i < lpProviderList->dwNumProviders; i++)
  1628. {
  1629. char buf[32];
  1630. STRUCT_FIELD fields[] =
  1631. {
  1632. { "dwPermanentProviderID", FT_DWORD, lpProviderEntry->dwPermanentProviderID, NULL },
  1633. { "dwProviderFilenameSize", FT_SIZE, lpProviderEntry->dwProviderFilenameSize, NULL },
  1634. { "dwProviderFilenameOffset", FT_OFFSET, lpProviderEntry->dwProviderFilenameOffset, NULL }
  1635. };
  1636. STRUCT_FIELD_HEADER fieldHeader =
  1637. {
  1638. lpProviderList, // size,offset relative to ctrylist
  1639. buf,
  1640. 3,
  1641. fields
  1642. };
  1643. sprintf (buf, "LINEPROVIDERENTRY[%ld]", i);
  1644. ShowStructByField (&fieldHeader, TRUE);
  1645. lpProviderEntry++;
  1646. }
  1647. }
  1648. UpdateResults (FALSE);
  1649. }
  1650. break;
  1651. }
  1652. case lReleaseUserUserInfo:
  1653. {
  1654. FUNC_PARAM params[] =
  1655. {
  1656. { szhCall, PT_DWORD, 0, NULL }
  1657. };
  1658. FUNC_PARAM_HEADER paramsHeader =
  1659. { 1, funcIndex, params, (PFN1) lineReleaseUserUserInfo };
  1660. CHK_CALL_SELECTED()
  1661. params[0].dwValue = (ULONG_PTR) pCallSel->hCall;
  1662. lResult = DoFunc (&paramsHeader);
  1663. break;
  1664. }
  1665. case lRemoveProvider:
  1666. {
  1667. FUNC_PARAM params[] =
  1668. {
  1669. { "dwPermanentProviderID", PT_DWORD, (ULONG_PTR) 2, NULL },
  1670. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL }
  1671. };
  1672. FUNC_PARAM_HEADER paramsHeader =
  1673. { 2, funcIndex, params, (PFN2) lineRemoveProvider };
  1674. #ifdef WIN32
  1675. lResult = DoFunc (&paramsHeader);
  1676. #else
  1677. //
  1678. // NOTE: on win16 HWNDs are 16 bits, so we've to hard code this
  1679. //
  1680. if (!LetUserMungeParams (&paramsHeader))
  1681. {
  1682. break;
  1683. }
  1684. DumpParams (&paramsHeader);
  1685. lResult = lineRemoveProvider(
  1686. params[0].dwValue,
  1687. (HWND) params[1].dwValue
  1688. );
  1689. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1690. #endif
  1691. break;
  1692. }
  1693. case lSetAppPriority:
  1694. #if TAPI_2_0
  1695. case lSetAppPriorityW:
  1696. #endif
  1697. {
  1698. char szAppName[MAX_STRING_PARAM_SIZE];
  1699. char szExtName[MAX_STRING_PARAM_SIZE] = "";
  1700. LINEEXTENSIONID extID;
  1701. FUNC_PARAM params[] =
  1702. {
  1703. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  1704. { "dwMediaMode", PT_FLAGS, (ULONG_PTR) dwDefMediaMode, aMediaModes },
  1705. { "lpExtensionID", PT_POINTER, (ULONG_PTR) &extID, &extID },
  1706. { " ->dwExtensionID0", PT_DWORD, (ULONG_PTR) 0, NULL },
  1707. { " ->dwExtensionID1", PT_DWORD, (ULONG_PTR) 0, NULL },
  1708. { " ->dwExtensionID2", PT_DWORD, (ULONG_PTR) 0, NULL },
  1709. { " ->dwExtensionID3", PT_DWORD, (ULONG_PTR) 0, NULL },
  1710. { "dwRequestMode", PT_FLAGS, (ULONG_PTR) LINEREQUESTMODE_MAKECALL, aRequestModes },
  1711. { "lpszExtensionName", PT_STRING, (ULONG_PTR) szExtName, szExtName },
  1712. { "dwPriority", PT_DWORD, (ULONG_PTR) 0, NULL }
  1713. };
  1714. FUNC_PARAM_HEADER paramsHeader =
  1715. { 10, funcIndex, params, NULL };
  1716. strcpy (szAppName, szDefAppName);
  1717. if (!LetUserMungeParams (&paramsHeader))
  1718. {
  1719. break;
  1720. }
  1721. extID.dwExtensionID0 = (DWORD) params[3].dwValue;
  1722. extID.dwExtensionID1 = (DWORD) params[4].dwValue;
  1723. extID.dwExtensionID2 = (DWORD) params[5].dwValue;
  1724. extID.dwExtensionID3 = (DWORD) params[6].dwValue;
  1725. #if TAPI_2_0
  1726. if (funcIndex == lSetAppPriority)
  1727. {
  1728. lResult = lineSetAppPriority(
  1729. (LPCSTR) params[0].dwValue,
  1730. (DWORD) params[1].dwValue,
  1731. (LPLINEEXTENSIONID) params[2].dwValue,
  1732. (DWORD) params[7].dwValue,
  1733. (LPCSTR) params[8].dwValue,
  1734. (DWORD) params[9].dwValue
  1735. );
  1736. }
  1737. else
  1738. {
  1739. MakeWideString ((LPVOID) params[0].dwValue);
  1740. lResult = lineSetAppPriorityW(
  1741. (LPCWSTR) params[0].dwValue,
  1742. (DWORD) params[1].dwValue,
  1743. (LPLINEEXTENSIONID) params[2].dwValue,
  1744. (DWORD) params[7].dwValue,
  1745. (LPCWSTR) params[8].dwValue,
  1746. (DWORD) params[9].dwValue
  1747. );
  1748. }
  1749. #else
  1750. lResult = lineSetAppPriority(
  1751. (LPCSTR) params[0].dwValue,
  1752. params[1].dwValue,
  1753. (LPLINEEXTENSIONID) params[2].dwValue,
  1754. params[7].dwValue,
  1755. (LPCSTR) params[8].dwValue,
  1756. params[9].dwValue
  1757. );
  1758. #endif
  1759. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1760. break;
  1761. }
  1762. case lTranslateDialog:
  1763. #if TAPI_2_0
  1764. case lTranslateDialogW:
  1765. #endif
  1766. {
  1767. char szAddressIn[MAX_STRING_PARAM_SIZE];
  1768. FUNC_PARAM params[] =
  1769. {
  1770. { szhLineApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1771. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefLineDeviceID, NULL },
  1772. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  1773. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, 0 },
  1774. { "lpszAddressIn", PT_STRING, (ULONG_PTR) szAddressIn, szAddressIn }
  1775. };
  1776. #if TAPI_2_0
  1777. FUNC_PARAM_HEADER paramsHeader =
  1778. { 5, funcIndex, params, (funcIndex == lTranslateDialog ?
  1779. (PFN5) lineTranslateDialog : (PFN5) lineTranslateDialogW) };
  1780. #else
  1781. FUNC_PARAM_HEADER paramsHeader =
  1782. { 5, funcIndex, params, (PFN5) lineTranslateDialog };
  1783. #endif
  1784. if (pLineAppSel)
  1785. {
  1786. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1787. }
  1788. strcpy (szAddressIn, szDefDestAddress);
  1789. #ifdef WIN32
  1790. lResult = DoFunc (&paramsHeader);
  1791. #else
  1792. //
  1793. // NOTE: on win16 HWNDs are 16 bits, so we've to hard code this
  1794. //
  1795. if (!LetUserMungeParams (&paramsHeader))
  1796. {
  1797. break;
  1798. }
  1799. DumpParams (&paramsHeader);
  1800. lResult = lineTranslateDialog(
  1801. (HLINEAPP) params[0].dwValue,
  1802. params[1].dwValue,
  1803. params[2].dwValue,
  1804. (HWND) params[3].dwValue,
  1805. (LPCSTR) params[4].dwValue
  1806. );
  1807. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  1808. #endif
  1809. break;
  1810. }
  1811. #endif // TAPI_1_1
  1812. #if INTERNAL_3_0
  1813. case mmcAddProvider:
  1814. {
  1815. char szProviderFilename[MAX_STRING_PARAM_SIZE] = "";
  1816. DWORD dwPermanentProviderID;
  1817. FUNC_PARAM params[] =
  1818. {
  1819. { szhMmcApp, PT_DWORD , (ULONG_PTR) 0, NULL },
  1820. { "lpszProviderFilename", PT_STRING, (ULONG_PTR) szProviderFilename, szProviderFilename },
  1821. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1822. { "lpdwPermanentProviderID", PT_POINTER, (ULONG_PTR) &dwPermanentProviderID, &dwPermanentProviderID }
  1823. };
  1824. FUNC_PARAM_HEADER paramsHeader =
  1825. { 4, funcIndex, params, (PFN4) MMCAddProvider };
  1826. CHK_LINEAPP_SELECTED()
  1827. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1828. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1829. {
  1830. ShowStr(
  1831. "%sdwPermanentProviderID = x%lx",
  1832. szTab,
  1833. dwPermanentProviderID
  1834. );
  1835. }
  1836. break;
  1837. }
  1838. case mmcConfigProvider:
  1839. {
  1840. FUNC_PARAM params[] =
  1841. {
  1842. { szhMmcApp, PT_DWORD , (ULONG_PTR) 0, NULL },
  1843. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1844. { szdwProviderID, PT_DWORD, (ULONG_PTR) 2, NULL }
  1845. };
  1846. FUNC_PARAM_HEADER paramsHeader =
  1847. { 3, funcIndex, params, (PFN3) MMCConfigProvider };
  1848. CHK_LINEAPP_SELECTED()
  1849. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1850. lResult = DoFunc (&paramsHeader);
  1851. break;
  1852. }
  1853. case mmcGetAvailableProviders:
  1854. {
  1855. LPAVAILABLEPROVIDERLIST lpList = (LPAVAILABLEPROVIDERLIST) pBigBuf;
  1856. FUNC_PARAM params[] =
  1857. {
  1858. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1859. { "lpProviderList", PT_POINTER, (ULONG_PTR) lpList, lpList }
  1860. };
  1861. FUNC_PARAM_HEADER paramsHeader =
  1862. { 2, funcIndex, params, MMCGetAvailableProviders };
  1863. CHK_LINEAPP_SELECTED()
  1864. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1865. memset (lpList, 0, (size_t) dwBigBufSize);
  1866. lpList->dwTotalSize = dwBigBufSize;
  1867. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1868. {
  1869. UpdateResults (TRUE);
  1870. ShowStructByDWORDs (lpList);
  1871. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1872. {
  1873. LPAVAILABLEPROVIDERENTRY lpEntry;
  1874. STRUCT_FIELD fields[] =
  1875. {
  1876. { "dwNumProviderListEntries", FT_DWORD, lpList->dwNumProviderListEntries, NULL },
  1877. { "dwProviderListSize", FT_DWORD, lpList->dwProviderListSize, NULL },
  1878. { "dwProviderListOffset", FT_DWORD, lpList->dwProviderListOffset, NULL },
  1879. };
  1880. STRUCT_FIELD_HEADER fieldHeader =
  1881. {
  1882. lpList,
  1883. "AVAILABLEPROVIDERLIST",
  1884. 3,
  1885. fields
  1886. };
  1887. ShowStructByField (&fieldHeader, FALSE);
  1888. lpEntry = (LPAVAILABLEPROVIDERENTRY)
  1889. (((LPBYTE) lpList) + lpList->dwProviderListOffset);
  1890. for (i = 0; i < lpList->dwNumProviderListEntries; i++)
  1891. {
  1892. char buf[32];
  1893. STRUCT_FIELD fields[] =
  1894. {
  1895. { "dwFileNameSize", FT_SIZE, lpEntry->dwFileNameSize, NULL },
  1896. { "dwFileNameOffset", FT_OFFSET, lpEntry->dwFileNameOffset, NULL },
  1897. { "dwFriendlyNameSize", FT_SIZE, lpEntry->dwFriendlyNameSize, NULL },
  1898. { "dwFriendlyNameOffset", FT_OFFSET, lpEntry->dwFriendlyNameOffset, NULL },
  1899. { "dwOptions", FT_FLAGS, lpEntry->dwOptions, aAvailableProviderOptions }
  1900. };
  1901. STRUCT_FIELD_HEADER fieldHeader =
  1902. {
  1903. lpList, // size,offset relative to list
  1904. buf,
  1905. 5,
  1906. fields
  1907. };
  1908. sprintf (buf, "AVAILABLEPROVIDERENTRY[%ld]", i);
  1909. ShowStructByField (&fieldHeader, TRUE);
  1910. lpEntry++;
  1911. }
  1912. }
  1913. UpdateResults (FALSE);
  1914. }
  1915. break;
  1916. }
  1917. case mmcGetLineInfo:
  1918. case mmcGetPhoneInfo:
  1919. {
  1920. LPDEVICEINFOLIST pList = (LPDEVICEINFOLIST) pBigBuf;
  1921. FUNC_PARAM params[] =
  1922. {
  1923. { szhMmcApp, PT_DWORD , (ULONG_PTR) 0, NULL },
  1924. { "lpInfoList", PT_POINTER, (ULONG_PTR) pList, pList }
  1925. };
  1926. FUNC_PARAM_HEADER paramsHeader =
  1927. { 2, funcIndex, params, (funcIndex == mmcGetLineInfo ?
  1928. (PFN5) MMCGetLineInfo : (PFN5) MMCGetPhoneInfo) };
  1929. CHK_LINEAPP_SELECTED()
  1930. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  1931. memset (pList, 0, (size_t) dwBigBufSize);
  1932. pList->dwTotalSize = dwBigBufSize;
  1933. if ((lResult = DoFunc (&paramsHeader)) == 0)
  1934. {
  1935. LPDEVICEINFO pInfo = (LPDEVICEINFO) (((LPBYTE)
  1936. pList) + pList->dwDeviceInfoOffset);
  1937. UpdateResults (TRUE);
  1938. ShowStructByDWORDs (pList);
  1939. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  1940. {
  1941. STRUCT_FIELD fields[] =
  1942. {
  1943. { "dwNumDevInfoEntries", FT_DWORD, pList->dwNumDeviceInfoEntries, NULL },
  1944. { "dwDevInfoSize", FT_SIZE, pList->dwDeviceInfoSize, NULL },
  1945. { "dwDevInfoOffset", FT_OFFSET, pList->dwDeviceInfoOffset, NULL },
  1946. };
  1947. STRUCT_FIELD_HEADER fieldHeader =
  1948. {
  1949. pList, "DEVICEINFOLIST", 3, fields
  1950. };
  1951. ShowStructByField (&fieldHeader, FALSE);
  1952. for (i = 0; i < pList->dwNumDeviceInfoEntries; i++, pInfo++)
  1953. {
  1954. char szDevInfoN[16];
  1955. STRUCT_FIELD fields[] =
  1956. {
  1957. { "dwPermanentDevID", FT_DWORD, pInfo->dwPermanentDeviceID, NULL },
  1958. { szdwProviderID, FT_DWORD, pInfo->dwProviderID, NULL },
  1959. { "dwDevNameSize", FT_SIZE, pInfo->dwDeviceNameSize, NULL },
  1960. { "dwDevNameOffset", FT_OFFSET, pInfo->dwDeviceNameOffset, NULL },
  1961. { "dwDomainUserNamesSize", FT_SIZE, pInfo->dwDomainUserNamesSize, NULL },
  1962. { "dwDomainUserNamesOffset", FT_OFFSET, pInfo->dwDomainUserNamesOffset, NULL },
  1963. { "dwFriendlyUserNamesSize", FT_SIZE, pInfo->dwFriendlyUserNamesSize, NULL },
  1964. { "dwFriendlyUserNamesOffset", FT_OFFSET, pInfo->dwFriendlyUserNamesOffset, NULL },
  1965. { "dwAddressesSize", FT_SIZE, pInfo->dwAddressesSize, NULL },
  1966. { "dwAddressesOffset", FT_OFFSET, pInfo->dwAddressesOffset, NULL },
  1967. };
  1968. STRUCT_FIELD_HEADER fieldHeader =
  1969. {
  1970. pList,
  1971. szDevInfoN,
  1972. (funcIndex == mmcGetLineInfo ? 10 : 8),
  1973. fields
  1974. };
  1975. wsprintf (szDevInfoN, "DEVICEINFO[%d]", i);
  1976. ShowStructByField (&fieldHeader, TRUE);
  1977. }
  1978. }
  1979. UpdateResults (FALSE);
  1980. }
  1981. break;
  1982. }
  1983. case mmcGetLineStatus:
  1984. case mmcGetPhoneStatus:
  1985. {
  1986. LPVARSTRING pStatus = (LPVARSTRING) pBigBuf;
  1987. FUNC_PARAM params[] =
  1988. {
  1989. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  1990. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  1991. { "dwStatusLevel", PT_DWORD, (ULONG_PTR) 0, NULL },
  1992. { szdwProviderID, PT_DWORD, (ULONG_PTR) 0, NULL },
  1993. { "dwPermanentDevID", PT_DWORD, (ULONG_PTR) 0, NULL },
  1994. { "lpStatusBuffer", PT_POINTER, (ULONG_PTR) pStatus, pStatus }
  1995. };
  1996. FUNC_PARAM_HEADER paramsHeader =
  1997. { 6, funcIndex, params, (funcIndex == mmcGetLineStatus ?
  1998. (PFN6) MMCGetLineStatus : (PFN6) MMCGetPhoneStatus) };
  1999. CHK_LINEAPP_SELECTED()
  2000. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2001. memset (pStatus, 0, (size_t) dwBigBufSize);
  2002. pStatus->dwTotalSize = dwBigBufSize;
  2003. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2004. {
  2005. ShowStructByDWORDs (pStatus);
  2006. ShowVARSTRING (pStatus);
  2007. }
  2008. break;
  2009. }
  2010. case mmcGetProviderList:
  2011. {
  2012. LPLINEPROVIDERLIST lpList = (LPLINEPROVIDERLIST) pBigBuf;
  2013. FUNC_PARAM params[] =
  2014. {
  2015. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2016. { "lpProviderList", PT_POINTER, (ULONG_PTR) lpList, lpList }
  2017. };
  2018. FUNC_PARAM_HEADER paramsHeader =
  2019. { 2, funcIndex, params, MMCGetProviderList };
  2020. CHK_LINEAPP_SELECTED()
  2021. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2022. memset (lpList, 0, (size_t) dwBigBufSize);
  2023. lpList->dwTotalSize = dwBigBufSize;
  2024. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2025. {
  2026. UpdateResults (TRUE);
  2027. ShowStructByDWORDs (lpList);
  2028. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2029. {
  2030. LPLINEPROVIDERENTRY lpEntry;
  2031. STRUCT_FIELD fields[] =
  2032. {
  2033. { "dwNumProviders", FT_DWORD, lpList->dwNumProviders, NULL },
  2034. { "dwProviderListSize", FT_DWORD, lpList->dwProviderListSize, NULL },
  2035. { "dwProviderListOffset", FT_DWORD, lpList->dwProviderListOffset, NULL },
  2036. };
  2037. STRUCT_FIELD_HEADER fieldHeader =
  2038. {
  2039. lpList,
  2040. "LINEPROVIDERLIST",
  2041. 3,
  2042. fields
  2043. };
  2044. ShowStructByField (&fieldHeader, FALSE);
  2045. lpEntry = (LPLINEPROVIDERENTRY)
  2046. (((LPBYTE) lpList) + lpList->dwProviderListOffset);
  2047. for (i = 0; i < lpList->dwNumProviders; i++)
  2048. {
  2049. char buf[32];
  2050. STRUCT_FIELD fields[] =
  2051. {
  2052. { "dwPermanentProviderID", FT_DWORD, lpEntry->dwPermanentProviderID, NULL },
  2053. { "dwProviderFilenameSize", FT_SIZE, lpEntry->dwProviderFilenameSize, NULL },
  2054. { "dwProviderFilenameOffset", FT_OFFSET, lpEntry->dwProviderFilenameOffset, NULL }
  2055. };
  2056. STRUCT_FIELD_HEADER fieldHeader =
  2057. {
  2058. lpList, // size,offset relative to list
  2059. buf,
  2060. 3,
  2061. fields
  2062. };
  2063. sprintf (buf, "LINEPROVIDERENTRY[%ld]", i);
  2064. ShowStructByField (&fieldHeader, TRUE);
  2065. lpEntry++;
  2066. }
  2067. }
  2068. UpdateResults (FALSE);
  2069. }
  2070. break;
  2071. }
  2072. case mmcGetServerConfig:
  2073. {
  2074. LPTAPISERVERCONFIG pConfig = (LPTAPISERVERCONFIG) pBigBuf;
  2075. FUNC_PARAM params[] =
  2076. {
  2077. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2078. { "lpConfig", PT_POINTER, (ULONG_PTR) pConfig, pConfig }
  2079. };
  2080. FUNC_PARAM_HEADER paramsHeader =
  2081. { 2, funcIndex, params, MMCGetServerConfig };
  2082. CHK_LINEAPP_SELECTED()
  2083. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2084. memset (pConfig, 0, (size_t) dwBigBufSize);
  2085. pConfig->dwTotalSize = dwBigBufSize;
  2086. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2087. {
  2088. UpdateResults (TRUE);
  2089. ShowStructByDWORDs (pConfig);
  2090. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2091. {
  2092. STRUCT_FIELD fields[] =
  2093. {
  2094. { "dwFlags", FT_FLAGS, pConfig->dwFlags, aServerConfigFlags },
  2095. { "dwDomainNameSize", FT_SIZE, pConfig->dwDomainNameSize, NULL },
  2096. { "dwDomainNameOffset", FT_OFFSET, pConfig->dwDomainNameOffset, NULL },
  2097. { "dwUserNameSize", FT_SIZE, pConfig->dwUserNameSize, NULL },
  2098. { "dwUserNameOffset", FT_OFFSET, pConfig->dwUserNameOffset, NULL },
  2099. { "dwPasswordSize", FT_SIZE, pConfig->dwPasswordSize, NULL },
  2100. { "dwPasswordOffset", FT_OFFSET, pConfig->dwPasswordOffset, NULL },
  2101. { "dwAdministratorsSize", FT_SIZE, pConfig->dwAdministratorsSize, NULL },
  2102. { "dwAdministratorsOffset", FT_OFFSET, pConfig->dwAdministratorsOffset, NULL },
  2103. };
  2104. STRUCT_FIELD_HEADER fieldHeader =
  2105. {
  2106. pConfig,
  2107. "TAPISERVERCONFIG",
  2108. 9,
  2109. fields
  2110. };
  2111. ShowStructByField (&fieldHeader, FALSE);
  2112. }
  2113. UpdateResults (FALSE);
  2114. }
  2115. break;
  2116. }
  2117. case mmcInitialize:
  2118. {
  2119. PMYLINEAPP pNewLineApp;
  2120. char szComputerName[MAX_STRING_PARAM_SIZE];
  2121. DWORD dwAPIVersion, dwLength;
  2122. FUNC_PARAM params[] =
  2123. {
  2124. { "lpszComputerName", PT_STRING, (ULONG_PTR) szComputerName, szComputerName },
  2125. { "lphLineApp", PT_POINTER, (ULONG_PTR) 0, NULL },
  2126. { "lpdwAPIVersion", PT_POINTER, (ULONG_PTR) &dwAPIVersion, &dwAPIVersion },
  2127. { " ->dwAPIVersion", PT_ORDINAL, (ULONG_PTR) dwDefLineAPIVersion, aAPIVersions },
  2128. { "hInstance", PT_DWORD, (ULONG_PTR) NULL, NULL }
  2129. };
  2130. FUNC_PARAM_HEADER paramsHeader =
  2131. { 5, funcIndex, params, NULL };
  2132. if (!(pNewLineApp = AllocLineApp()))
  2133. {
  2134. ErrorAlert();
  2135. ShowStr ("error creating data structure");
  2136. break;
  2137. }
  2138. params[1].dwValue =
  2139. params[1].u.dwDefValue = (ULONG_PTR) &pNewLineApp->hLineApp;
  2140. dwLength = sizeof (szComputerName);
  2141. GetComputerName (szComputerName, &dwLength);
  2142. if (!LetUserMungeParams (&paramsHeader))
  2143. {
  2144. FreeLineApp (pNewLineApp);
  2145. break;
  2146. }
  2147. MakeWideString (szComputerName);
  2148. dwAPIVersion = params[3].dwValue;
  2149. DumpParams (&paramsHeader);
  2150. lResult = MMCInitialize(
  2151. (LPCWSTR) params[0].dwValue,
  2152. (LPHMMCAPP) params[1].dwValue,
  2153. (LPDWORD) params[2].dwValue,
  2154. (HANDLE) params[4].dwValue
  2155. );
  2156. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  2157. if (lResult == 0)
  2158. {
  2159. UpdateWidgetList();
  2160. SelectWidget ((PMYWIDGET) pNewLineApp);
  2161. }
  2162. else
  2163. {
  2164. FreeLineApp (pNewLineApp);
  2165. }
  2166. break;
  2167. }
  2168. case mmcRemoveProvider:
  2169. {
  2170. FUNC_PARAM params[] =
  2171. {
  2172. { szhMmcApp, PT_DWORD , (ULONG_PTR) 0, NULL },
  2173. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  2174. { szdwProviderID, PT_DWORD, (ULONG_PTR) 2, NULL }
  2175. };
  2176. FUNC_PARAM_HEADER paramsHeader =
  2177. { 3, funcIndex, params, (PFN3) MMCRemoveProvider };
  2178. CHK_LINEAPP_SELECTED()
  2179. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2180. lResult = DoFunc (&paramsHeader);
  2181. break;
  2182. }
  2183. case mmcSetLineInfo:
  2184. case mmcSetPhoneInfo:
  2185. {
  2186. char szDomainUser0[MAX_STRING_PARAM_SIZE] = "",
  2187. szDomainUser1[MAX_STRING_PARAM_SIZE] = "",
  2188. szFriendlyUser0[MAX_STRING_PARAM_SIZE] = "",
  2189. szFriendlyUser1[MAX_STRING_PARAM_SIZE] = "";
  2190. DWORD dwSize;
  2191. LPDEVICEINFO pInfo;
  2192. LPDEVICEINFOLIST pList = (LPDEVICEINFOLIST) pBigBuf;
  2193. FUNC_PARAM params[] =
  2194. {
  2195. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2196. { "lpInfoList", PT_POINTER, (ULONG_PTR) pList, pList },
  2197. { " ->dwPermDevID", PT_DWORD, (ULONG_PTR) 0, NULL },
  2198. { " ->dwProviderID", PT_DWORD, (ULONG_PTR) 0, NULL },
  2199. { " ->DomainUser0", PT_STRING, (ULONG_PTR) szDomainUser0, szDomainUser0 },
  2200. { " ->DomainUser1", PT_STRING, (ULONG_PTR) szDomainUser1, szDomainUser1 },
  2201. { " ->FriendlyUser0", PT_STRING, (ULONG_PTR) szFriendlyUser0, szFriendlyUser0 },
  2202. { " ->FriendlyUser1", PT_STRING, (ULONG_PTR) szFriendlyUser1, szFriendlyUser1 }
  2203. };
  2204. FUNC_PARAM_HEADER paramsHeader =
  2205. { 8, funcIndex, params, NULL };
  2206. CHK_LINEAPP_SELECTED()
  2207. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2208. memset (pList, 0, (size_t) dwBigBufSize);
  2209. if (!LetUserMungeParams (&paramsHeader))
  2210. {
  2211. break;
  2212. }
  2213. pList->dwTotalSize = sizeof (*pList) + sizeof (DEVICEINFO);
  2214. pList->dwNumDeviceInfoEntries = 1;
  2215. pList->dwDeviceInfoSize = sizeof (DEVICEINFO);
  2216. pList->dwDeviceInfoOffset = sizeof (*pList);
  2217. pInfo = (LPDEVICEINFO) (pList + 1);
  2218. pInfo->dwPermanentDeviceID = params[2].dwValue;
  2219. pInfo->dwProviderID = params[3].dwValue;
  2220. MakeWideString (szDomainUser0);
  2221. MakeWideString (szDomainUser1);
  2222. MakeWideString (szFriendlyUser0);
  2223. MakeWideString (szFriendlyUser1);
  2224. if (params[3].dwValue &&
  2225. (dwSize = wcslen ((WCHAR *) szDomainUser0)))
  2226. {
  2227. //
  2228. //
  2229. //
  2230. wcscpy(
  2231. (WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize),
  2232. (WCHAR *) szDomainUser0
  2233. );
  2234. dwSize++;
  2235. dwSize *= sizeof (WCHAR);
  2236. pInfo->dwDomainUserNamesSize = dwSize;
  2237. pInfo->dwDomainUserNamesOffset = pList->dwTotalSize;
  2238. pList->dwTotalSize += dwSize;
  2239. if (params[4].dwValue &&
  2240. (dwSize = wcslen ((WCHAR *) szDomainUser1)))
  2241. {
  2242. wcscpy(
  2243. (WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize),
  2244. (WCHAR *) szDomainUser1
  2245. );
  2246. dwSize++;
  2247. dwSize *= sizeof (WCHAR);
  2248. pInfo->dwDomainUserNamesSize += dwSize;
  2249. pList->dwTotalSize += dwSize;
  2250. }
  2251. *((WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize)) =
  2252. L'\0';
  2253. pInfo->dwDomainUserNamesSize += sizeof (WCHAR);
  2254. pList->dwTotalSize += sizeof (WCHAR);
  2255. //
  2256. //
  2257. //
  2258. dwSize = (wcslen ((WCHAR *) szFriendlyUser0) + 1) * sizeof (WCHAR);
  2259. wcscpy(
  2260. (WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize),
  2261. (WCHAR *) szFriendlyUser0
  2262. );
  2263. pInfo->dwFriendlyUserNamesSize = dwSize;
  2264. pInfo->dwFriendlyUserNamesOffset = pList->dwTotalSize;
  2265. pList->dwTotalSize += dwSize;
  2266. if (params[4].dwValue &&
  2267. (dwSize = wcslen ((WCHAR *) szFriendlyUser1)))
  2268. {
  2269. wcscpy(
  2270. (WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize),
  2271. (WCHAR *) szFriendlyUser1
  2272. );
  2273. dwSize++;
  2274. dwSize *= sizeof (WCHAR);
  2275. pInfo->dwFriendlyUserNamesSize += dwSize;
  2276. pList->dwTotalSize += dwSize;
  2277. }
  2278. *((WCHAR *) (((LPBYTE) pList) + pList->dwTotalSize)) =
  2279. L'\0';
  2280. pInfo->dwFriendlyUserNamesSize += sizeof (WCHAR);
  2281. pList->dwTotalSize += sizeof (WCHAR);
  2282. }
  2283. DumpParams (&paramsHeader);
  2284. if (funcIndex == mmcSetLineInfo)
  2285. {
  2286. lResult = MMCSetLineInfo(
  2287. (HMMCAPP) params[0].dwValue,
  2288. (LPDEVICEINFOLIST) params[1].dwValue
  2289. );
  2290. }
  2291. else
  2292. {
  2293. lResult = MMCSetPhoneInfo(
  2294. (HMMCAPP) params[0].dwValue,
  2295. (LPDEVICEINFOLIST) params[1].dwValue
  2296. );
  2297. }
  2298. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  2299. break;
  2300. }
  2301. case mmcSetServerConfig:
  2302. {
  2303. char szDomain[MAX_STRING_PARAM_SIZE] = "",
  2304. szUser[MAX_STRING_PARAM_SIZE] = "",
  2305. szPassword[MAX_STRING_PARAM_SIZE] = "",
  2306. szAdmin0[MAX_STRING_PARAM_SIZE] = "",
  2307. szAdmin1[MAX_STRING_PARAM_SIZE] = "";
  2308. LPTAPISERVERCONFIG pConfig = (LPTAPISERVERCONFIG) pBigBuf;
  2309. FUNC_PARAM params[] =
  2310. {
  2311. { szhMmcApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2312. { "lpConfig", PT_POINTER, (ULONG_PTR) pConfig, pConfig },
  2313. { " ->dwFlags", PT_FLAGS, (ULONG_PTR) 0, aServerConfigFlags },
  2314. { " ->DomainName", PT_STRING, (ULONG_PTR) szDomain, szDomain },
  2315. { " ->UserName", PT_STRING, (ULONG_PTR) szUser, szUser },
  2316. { " ->Password", PT_STRING, (ULONG_PTR) szPassword, szPassword },
  2317. { " ->Admin0", PT_STRING, (ULONG_PTR) szAdmin0, szAdmin0 },
  2318. { " ->Admin1", PT_STRING, (ULONG_PTR) szAdmin1, szAdmin1 }
  2319. };
  2320. FUNC_PARAM_HEADER paramsHeader =
  2321. { 8, funcIndex, params, NULL };
  2322. CHK_LINEAPP_SELECTED()
  2323. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2324. memset (pConfig, 0, (size_t) dwBigBufSize);
  2325. if (!LetUserMungeParams (&paramsHeader))
  2326. {
  2327. break;
  2328. }
  2329. pConfig->dwTotalSize = sizeof (*pConfig);
  2330. pConfig->dwFlags = params[2].dwValue;
  2331. if (pConfig->dwFlags & TAPISERVERCONFIGFLAGS_SETACCOUNT)
  2332. {
  2333. MakeWideString (szDomain);
  2334. MakeWideString (szUser);
  2335. MakeWideString (szPassword);
  2336. wcscpy(
  2337. (WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize),
  2338. (WCHAR *) szDomain
  2339. );
  2340. pConfig->dwDomainNameOffset = pConfig->dwTotalSize;
  2341. pConfig->dwTotalSize +=
  2342. (pConfig->dwDomainNameSize =
  2343. (wcslen ((WCHAR *) szDomain) + 1) * sizeof (WCHAR));
  2344. wcscpy(
  2345. (WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize),
  2346. (WCHAR *) szUser
  2347. );
  2348. pConfig->dwUserNameOffset = pConfig->dwTotalSize;
  2349. pConfig->dwTotalSize +=
  2350. (pConfig->dwUserNameSize =
  2351. (wcslen ((WCHAR *) szUser) + 1) * sizeof (WCHAR));
  2352. wcscpy(
  2353. (WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize),
  2354. (WCHAR *) szPassword
  2355. );
  2356. pConfig->dwPasswordOffset = pConfig->dwTotalSize;
  2357. pConfig->dwTotalSize +=
  2358. (pConfig->dwPasswordSize =
  2359. (wcslen ((WCHAR *) szPassword) + 1) * sizeof (WCHAR));
  2360. }
  2361. MakeWideString (szAdmin0);
  2362. MakeWideString (szAdmin1);
  2363. if ((pConfig->dwFlags & TAPISERVERCONFIGFLAGS_SETTAPIADMINISTRATORS) &&
  2364. params[6].dwValue &&
  2365. wcslen ((WCHAR *) szAdmin0))
  2366. {
  2367. wcscpy(
  2368. (WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize),
  2369. (WCHAR *) szAdmin0
  2370. );
  2371. pConfig->dwAdministratorsOffset = pConfig->dwTotalSize;
  2372. pConfig->dwTotalSize +=
  2373. (pConfig->dwAdministratorsSize =
  2374. (wcslen ((WCHAR *) szAdmin0) + 1) * sizeof (WCHAR));
  2375. if (params[7].dwValue && wcslen ((WCHAR *) szAdmin1))
  2376. {
  2377. DWORD dwSize;
  2378. wcscpy(
  2379. (WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize),
  2380. (WCHAR *) szAdmin1
  2381. );
  2382. dwSize = (wcslen ((WCHAR *) szAdmin1) + 1) * sizeof (WCHAR);
  2383. pConfig->dwAdministratorsSize += dwSize;
  2384. pConfig->dwTotalSize += dwSize;
  2385. }
  2386. *((WCHAR *) (((LPBYTE) pConfig) + pConfig->dwTotalSize)) = L'\0';
  2387. pConfig->dwAdministratorsSize += sizeof (WCHAR);
  2388. pConfig->dwTotalSize += sizeof (WCHAR);
  2389. }
  2390. DumpParams (&paramsHeader);
  2391. lResult = MMCSetServerConfig(
  2392. (HMMCAPP) params[0].dwValue,
  2393. (LPTAPISERVERCONFIG) params[1].dwValue
  2394. );
  2395. ShowLineFuncResult (aFuncNames[funcIndex], lResult);
  2396. break;
  2397. }
  2398. case mmcShutdown:
  2399. {
  2400. FUNC_PARAM params[] =
  2401. {
  2402. { szhMmcApp, PT_DWORD, 0, NULL }
  2403. };
  2404. FUNC_PARAM_HEADER paramsHeader =
  2405. { 1, funcIndex, params, (PFN1) MMCShutdown };
  2406. CHK_LINEAPP_SELECTED()
  2407. params[0].dwValue = (ULONG_PTR) pLineAppSel->hLineApp;
  2408. lResult = DoFunc (&paramsHeader);
  2409. if (lResult == 0)
  2410. {
  2411. ShowWidgetList (FALSE);
  2412. FreeLineApp (GetLineApp((HLINEAPP) params[0].dwValue));
  2413. ShowWidgetList (TRUE);
  2414. }
  2415. break;
  2416. }
  2417. #endif // INTERNAL_3_0
  2418. case pClose:
  2419. {
  2420. FUNC_PARAM params[] =
  2421. {
  2422. { szhPhone, PT_DWORD, 0, NULL }
  2423. };
  2424. FUNC_PARAM_HEADER paramsHeader =
  2425. { 1, funcIndex, params, (PFN1) phoneClose };
  2426. CHK_PHONE_SELECTED()
  2427. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2428. if ((lResult = DoFunc(&paramsHeader)) == 0)
  2429. {
  2430. FreePhone (GetPhone((HPHONE) params[0].dwValue));
  2431. // Try to auto select the next valid hPhone in the list
  2432. }
  2433. break;
  2434. }
  2435. case pConfigDialog:
  2436. #if TAPI_2_0
  2437. case pConfigDialogW:
  2438. #endif
  2439. {
  2440. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  2441. FUNC_PARAM params[] =
  2442. {
  2443. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefPhoneDeviceID, NULL },
  2444. { szhwndOwner, PT_DWORD, (ULONG_PTR) ghwndMain, NULL },
  2445. { szlpszDeviceClass, PT_STRING,(ULONG_PTR) szDeviceClass, szDeviceClass }
  2446. };
  2447. #if TAPI_2_0
  2448. FUNC_PARAM_HEADER paramsHeader =
  2449. { 3, funcIndex, params, (funcIndex == pConfigDialog ?
  2450. (PFN3) phoneConfigDialog : (PFN3) phoneConfigDialogW) };
  2451. #else
  2452. FUNC_PARAM_HEADER paramsHeader =
  2453. { 3, funcIndex, params, (PFN3) phoneConfigDialog };
  2454. #endif
  2455. CHK_PHONEAPP_SELECTED()
  2456. strcpy (szDeviceClass, szDefPhoneDeviceClass);
  2457. #ifdef WIN32
  2458. lResult = DoFunc (&paramsHeader);
  2459. #else
  2460. //
  2461. // NOTE: on win16 HWNDSs are 16 bits, so we've to hard code this
  2462. //
  2463. if (!LetUserMungeParams (&paramsHeader))
  2464. {
  2465. break;
  2466. }
  2467. DumpParams (&paramsHeader);
  2468. lResult = phoneConfigDialog(
  2469. params[0].dwValue,
  2470. (HWND) params[1].dwValue,
  2471. (LPCSTR) params[2].dwValue
  2472. );
  2473. ShowPhoneFuncResult (aFuncNames[funcIndex], lResult);
  2474. #endif
  2475. break;
  2476. }
  2477. case pDevSpecific:
  2478. {
  2479. FUNC_PARAM params[] =
  2480. {
  2481. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2482. { szlpParams, PT_STRING, (ULONG_PTR) pBigBuf, pBigBuf },
  2483. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  2484. };
  2485. FUNC_PARAM_HEADER paramsHeader =
  2486. { 3, funcIndex, params, (PFN3) phoneDevSpecific };
  2487. CHK_PHONE_SELECTED()
  2488. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  2489. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2490. DoFunc (&paramsHeader);
  2491. break;
  2492. }
  2493. case pGetButtonInfo:
  2494. #if TAPI_2_0
  2495. case pGetButtonInfoW:
  2496. #endif
  2497. {
  2498. LPPHONEBUTTONINFO lpButtonInfo = (LPPHONEBUTTONINFO) pBigBuf;
  2499. FUNC_PARAM params[] =
  2500. {
  2501. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2502. { "dwButtonLampID", PT_DWORD, (ULONG_PTR) 0, NULL },
  2503. { "lpButtonInfo", PT_POINTER, (ULONG_PTR) lpButtonInfo, lpButtonInfo }
  2504. };
  2505. #if TAPI_2_0
  2506. FUNC_PARAM_HEADER paramsHeader =
  2507. { 3, funcIndex, params, (funcIndex == pGetButtonInfo ?
  2508. (PFN3) phoneGetButtonInfo : (PFN3) phoneGetButtonInfoW) };
  2509. #else
  2510. FUNC_PARAM_HEADER paramsHeader =
  2511. { 3, funcIndex, params, (PFN3) phoneGetButtonInfo };
  2512. #endif
  2513. CHK_PHONE_SELECTED()
  2514. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2515. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  2516. lpButtonInfo->dwTotalSize = dwBigBufSize;
  2517. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2518. {
  2519. ShowStructByDWORDs (lpButtonInfo);
  2520. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2521. {
  2522. STRUCT_FIELD fields[] =
  2523. {
  2524. { "dwButtonMode", FT_FLAGS, lpButtonInfo->dwButtonMode, aButtonModes },
  2525. { "dwButtonFunction", FT_ORD, lpButtonInfo->dwButtonFunction, aButtonFunctions },
  2526. { "dwButtonTextSize", FT_SIZE, lpButtonInfo->dwButtonTextSize, NULL },
  2527. { "dwButtonTextOffset", FT_OFFSET, lpButtonInfo->dwButtonTextOffset, NULL },
  2528. { "dwDevSpecificSize", FT_SIZE, lpButtonInfo->dwDevSpecificSize, NULL },
  2529. { "dwDevSpecificOffset", FT_OFFSET, lpButtonInfo->dwDevSpecificOffset, NULL }
  2530. #if TAPI_1_1
  2531. ,
  2532. { "dwButtonState", FT_FLAGS, lpButtonInfo->dwButtonState, aButtonStates }
  2533. #endif
  2534. };
  2535. STRUCT_FIELD_HEADER fieldHeader =
  2536. {
  2537. lpButtonInfo,
  2538. "PHONEBUTTONINFO",
  2539. #if TAPI_1_1
  2540. 7,
  2541. #else
  2542. 6,
  2543. #endif
  2544. fields
  2545. };
  2546. #if TAPI_1_1
  2547. // BUGBUG only show v1.0 fields if APIver == 0x10003
  2548. // fieldHeader.dwNumFields--;
  2549. #endif
  2550. ShowStructByField (&fieldHeader, FALSE);
  2551. }
  2552. }
  2553. break;
  2554. }
  2555. case pGetData:
  2556. {
  2557. FUNC_PARAM params[] =
  2558. {
  2559. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2560. { "dwDataID", PT_DWORD, (ULONG_PTR) 0, NULL },
  2561. { "lpData", PT_POINTER, (ULONG_PTR) pBigBuf, pBigBuf },
  2562. { szdwSize, PT_DWORD, (ULONG_PTR) (dwBigBufSize > 64 ? 64 : dwBigBufSize), 0}
  2563. };
  2564. FUNC_PARAM_HEADER paramsHeader =
  2565. { 4, funcIndex, params, (PFN4) phoneGetData };
  2566. CHK_PHONE_SELECTED()
  2567. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2568. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2569. {
  2570. ShowBytes(
  2571. (dwBigBufSize > (DWORD) params[3].dwValue ?
  2572. (DWORD) params[3].dwValue : dwBigBufSize),
  2573. pBigBuf,
  2574. 0
  2575. );
  2576. }
  2577. break;
  2578. }
  2579. case pGetDevCaps:
  2580. #if TAPI_2_0
  2581. case pGetDevCapsW:
  2582. #endif
  2583. {
  2584. LPPHONECAPS lpDevCaps = (LPPHONECAPS) pBigBuf;
  2585. FUNC_PARAM params[] =
  2586. {
  2587. { szhPhoneApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2588. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefPhoneDeviceID, NULL },
  2589. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefPhoneAPIVersion, aAPIVersions },
  2590. { "dwExtVersion", PT_DWORD, (ULONG_PTR) dwDefPhoneExtVersion, NULL },
  2591. { "lpPhoneDevCaps", PT_POINTER, (ULONG_PTR) lpDevCaps, lpDevCaps }
  2592. };
  2593. #if TAPI_2_0
  2594. FUNC_PARAM_HEADER paramsHeader =
  2595. { 5, funcIndex, params, (funcIndex == pGetDevCaps ?
  2596. (PFN5) phoneGetDevCaps : (PFN5) phoneGetDevCapsW ) };
  2597. #else
  2598. FUNC_PARAM_HEADER paramsHeader =
  2599. { 5, funcIndex, params, (PFN5) phoneGetDevCaps };
  2600. #endif
  2601. CHK_PHONEAPP_SELECTED()
  2602. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  2603. memset (lpDevCaps, 0, (size_t) dwBigBufSize);
  2604. lpDevCaps->dwTotalSize = dwBigBufSize;
  2605. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2606. {
  2607. ShowStructByDWORDs (lpDevCaps);
  2608. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2609. {
  2610. STRUCT_FIELD fields[] =
  2611. {
  2612. { "dwProviderInfoSize", FT_SIZE, lpDevCaps->dwProviderInfoSize, NULL },
  2613. { "dwProviderInfoOffset", FT_OFFSET, lpDevCaps->dwProviderInfoOffset, NULL },
  2614. { "dwPhoneInfoSize", FT_SIZE, lpDevCaps->dwPhoneInfoSize, NULL },
  2615. { "dwPhoneInfoOffset", FT_OFFSET, lpDevCaps->dwPhoneInfoOffset, NULL },
  2616. { "dwPermanentPhoneID", FT_DWORD, lpDevCaps->dwPermanentPhoneID, NULL },
  2617. { "dwPhoneNameSize", FT_SIZE, lpDevCaps->dwPhoneNameSize, NULL },
  2618. { "dwPhoneNameOffset", FT_OFFSET, lpDevCaps->dwPhoneNameOffset, NULL },
  2619. { "dwStringFormat", FT_ORD, lpDevCaps->dwStringFormat, aStringFormats },
  2620. { "dwPhoneStates", FT_FLAGS, lpDevCaps->dwPhoneStates, aPhoneStates },
  2621. { "dwHookSwitchDevs", FT_FLAGS, lpDevCaps->dwHookSwitchDevs, aHookSwitchDevs },
  2622. { "dwHandsetHookSwitchModes", FT_FLAGS, lpDevCaps->dwHandsetHookSwitchModes, aHookSwitchModes },
  2623. { "dwSpeakerHookSwitchModes", FT_FLAGS, lpDevCaps->dwSpeakerHookSwitchModes, aHookSwitchModes },
  2624. { "dwHeadsetHookSwitchModes", FT_FLAGS, lpDevCaps->dwHeadsetHookSwitchModes, aHookSwitchModes },
  2625. { "dwVolumeFlags", FT_FLAGS, lpDevCaps->dwVolumeFlags, aHookSwitchDevs },
  2626. { "dwGainFlags", FT_FLAGS, lpDevCaps->dwGainFlags, aHookSwitchDevs },
  2627. { "dwDisplayNumRows", FT_DWORD, lpDevCaps->dwDisplayNumRows, NULL },
  2628. { "dwDisplayNumColumns", FT_DWORD, lpDevCaps->dwDisplayNumColumns, NULL },
  2629. { "dwNumRingModes", FT_DWORD, lpDevCaps->dwNumRingModes, NULL },
  2630. { "dwNumButtonLamps", FT_DWORD, lpDevCaps->dwNumButtonLamps, NULL },
  2631. { "dwButtonModesSize", FT_SIZE, lpDevCaps->dwButtonModesSize, NULL },
  2632. { "dwButtonModesOffset", FT_OFFSET, lpDevCaps->dwButtonModesOffset, NULL },
  2633. { "dwButtonFunctionsSize", FT_SIZE, lpDevCaps->dwButtonFunctionsSize, NULL },
  2634. { "dwButtonFunctionsOffset", FT_OFFSET, lpDevCaps->dwButtonFunctionsOffset, NULL },
  2635. { "dwLampModesSize", FT_SIZE, lpDevCaps->dwLampModesSize, NULL },
  2636. { "dwLampModesOffset", FT_OFFSET, lpDevCaps->dwLampModesOffset, NULL },
  2637. { "dwNumSetData", FT_DWORD, lpDevCaps->dwNumSetData, NULL },
  2638. { "dwSetDataSize", FT_SIZE, lpDevCaps->dwSetDataSize, NULL },
  2639. { "dwSetDataOffset", FT_OFFSET, lpDevCaps->dwSetDataOffset, NULL },
  2640. { "dwNumGetData", FT_DWORD, lpDevCaps->dwNumGetData, NULL },
  2641. { "dwGetDataSize", FT_SIZE, lpDevCaps->dwGetDataSize, NULL },
  2642. { "dwGetDataOffset", FT_OFFSET, lpDevCaps->dwGetDataOffset, NULL },
  2643. { "dwDevSpecificSize", FT_SIZE, lpDevCaps->dwDevSpecificSize, NULL },
  2644. { "dwDevSpecificOffset", FT_OFFSET, lpDevCaps->dwDevSpecificOffset, NULL }
  2645. #if TAPI_2_0
  2646. ,
  2647. { "dwDeviceClassesSize", FT_SIZE, 0, NULL },
  2648. { "dwDeviceClassesOffset", FT_OFFSET, 0, NULL },
  2649. { "dwPhoneFeatures", FT_FLAGS, 0, aPhoneFeatures },
  2650. { "dwSettableHandsetHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes },
  2651. { "dwSettableSpeakerHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes },
  2652. { "dwSettableHeadsetHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes },
  2653. { "dwMonitoredHandsetHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes },
  2654. { "dwMonitoredSpeakerHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes },
  2655. { "dwMonitoredHeadsetHookSwitchModes", FT_FLAGS, 0, aHookSwitchModes }
  2656. #if TAPI_2_2
  2657. ,
  2658. { "PermanentPhoneGuid(Size)", FT_SIZE, sizeof (lpDevCaps->PermanentPhoneGuid), NULL },
  2659. { "PermanentPhoneGuid(Offset)", FT_OFFSET, ((LPBYTE) &lpDevCaps->PermanentPhoneGuid) - ((LPBYTE) lpDevCaps), NULL }
  2660. #endif
  2661. #endif
  2662. };
  2663. STRUCT_FIELD_HEADER fieldHeader =
  2664. {
  2665. lpDevCaps, "PHONECAPS", 0, fields
  2666. };
  2667. if (params[2].dwValue < 0x00020000)
  2668. {
  2669. fieldHeader.dwNumFields = 33;
  2670. }
  2671. #if TAPI_2_0
  2672. else
  2673. {
  2674. fieldHeader.dwNumFields = 42;
  2675. fields[33].dwValue = lpDevCaps->dwDeviceClassesSize;
  2676. fields[34].dwValue = lpDevCaps->dwDeviceClassesOffset;
  2677. fields[35].dwValue = lpDevCaps->dwPhoneFeatures;
  2678. fields[36].dwValue = lpDevCaps->dwSettableHandsetHookSwitchModes;
  2679. fields[37].dwValue = lpDevCaps->dwSettableSpeakerHookSwitchModes;
  2680. fields[38].dwValue = lpDevCaps->dwSettableHeadsetHookSwitchModes;
  2681. fields[39].dwValue = lpDevCaps->dwMonitoredHandsetHookSwitchModes;
  2682. fields[40].dwValue = lpDevCaps->dwMonitoredSpeakerHookSwitchModes;
  2683. fields[41].dwValue = lpDevCaps->dwMonitoredHeadsetHookSwitchModes;
  2684. #if TAPI_2_2
  2685. if (params[2].dwValue >= 0x20002)
  2686. {
  2687. fieldHeader.dwNumFields += 2;
  2688. }
  2689. #endif
  2690. }
  2691. #endif
  2692. ShowStructByField (&fieldHeader, FALSE);
  2693. }
  2694. }
  2695. break;
  2696. }
  2697. case pGetDisplay:
  2698. {
  2699. LPVARSTRING lpDisplay = (LPVARSTRING) pBigBuf;
  2700. FUNC_PARAM params[] =
  2701. {
  2702. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2703. { "lpDisplay", PT_POINTER, (ULONG_PTR) lpDisplay, lpDisplay }
  2704. };
  2705. FUNC_PARAM_HEADER paramsHeader =
  2706. { 2, funcIndex, params, (PFN2) phoneGetDisplay };
  2707. CHK_PHONE_SELECTED()
  2708. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2709. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  2710. lpDisplay->dwTotalSize = dwBigBufSize;
  2711. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2712. {
  2713. ShowStructByDWORDs (lpDisplay);
  2714. ShowVARSTRING (lpDisplay);
  2715. }
  2716. break;
  2717. }
  2718. case pGetGain:
  2719. {
  2720. DWORD dwGain;
  2721. FUNC_PARAM params[] =
  2722. {
  2723. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2724. { "dwHookSwitchDev", PT_ORDINAL, (ULONG_PTR) PHONEHOOKSWITCHDEV_HANDSET, aHookSwitchDevs },
  2725. { "lpdwGain", PT_POINTER, (ULONG_PTR) &dwGain, &dwGain }
  2726. };
  2727. FUNC_PARAM_HEADER paramsHeader =
  2728. { 3, funcIndex, params, (PFN3) phoneGetGain };
  2729. CHK_PHONE_SELECTED()
  2730. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2731. if (DoFunc (&paramsHeader) == 0)
  2732. {
  2733. ShowStr ("%sdwGain=x%lx", szTab, dwGain);
  2734. }
  2735. break;
  2736. }
  2737. case pGetHookSwitch:
  2738. {
  2739. DWORD dwHookSwitchDevs;
  2740. FUNC_PARAM params[] =
  2741. {
  2742. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2743. { "lpdwHookSwitchDevs", PT_POINTER, (ULONG_PTR) &dwHookSwitchDevs, &dwHookSwitchDevs },
  2744. };
  2745. FUNC_PARAM_HEADER paramsHeader =
  2746. { 2, funcIndex, params, (PFN2) phoneGetHookSwitch };
  2747. CHK_PHONE_SELECTED()
  2748. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2749. if (DoFunc (&paramsHeader) == 0)
  2750. {
  2751. char szDevsOnHook[32] = "";
  2752. char szDevsOffHook[32] = "";
  2753. if (dwHookSwitchDevs & PHONEHOOKSWITCHDEV_HANDSET)
  2754. {
  2755. strcat (szDevsOffHook, "HANDSET ");
  2756. }
  2757. else
  2758. {
  2759. strcat (szDevsOnHook, "HANDSET ");
  2760. }
  2761. if (dwHookSwitchDevs & PHONEHOOKSWITCHDEV_SPEAKER)
  2762. {
  2763. strcat (szDevsOffHook, "SPEAKER ");
  2764. }
  2765. else
  2766. {
  2767. strcat (szDevsOnHook, "SPEAKER ");
  2768. }
  2769. if (dwHookSwitchDevs & PHONEHOOKSWITCHDEV_HEADSET)
  2770. {
  2771. strcat (szDevsOffHook, "HEADSET");
  2772. }
  2773. else
  2774. {
  2775. strcat (szDevsOnHook, "HEADSET");
  2776. }
  2777. ShowStr ("%sOn hook : %s", szTab, szDevsOnHook);
  2778. ShowStr ("%sOff hook: %s", szTab, szDevsOffHook);
  2779. }
  2780. break;
  2781. }
  2782. case pGetIcon:
  2783. #if TAPI_2_0
  2784. case pGetIconW:
  2785. #endif
  2786. {
  2787. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  2788. HICON hIcon;
  2789. FUNC_PARAM params[] =
  2790. {
  2791. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefPhoneDeviceID, NULL },
  2792. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass },
  2793. { "lphIcon", PT_POINTER, (ULONG_PTR) &hIcon, &hIcon }
  2794. };
  2795. #if TAPI_2_0
  2796. FUNC_PARAM_HEADER paramsHeader =
  2797. { 3, funcIndex, params, (funcIndex == pGetIcon ?
  2798. (PFN3) phoneGetIcon : (PFN3) phoneGetIconW) };
  2799. #else
  2800. FUNC_PARAM_HEADER paramsHeader =
  2801. { 3, funcIndex, params, (PFN3) phoneGetIcon };
  2802. #endif
  2803. strcpy (szDeviceClass, szDefPhoneDeviceClass);
  2804. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2805. {
  2806. DialogBoxParam (
  2807. ghInst,
  2808. (LPCSTR)MAKEINTRESOURCE(IDD_DIALOG5),
  2809. (HWND) ghwndMain,
  2810. IconDlgProc,
  2811. (LPARAM) hIcon
  2812. );
  2813. }
  2814. break;
  2815. }
  2816. case pGetID:
  2817. #if TAPI_2_0
  2818. case pGetIDW:
  2819. #endif
  2820. {
  2821. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  2822. LPVARSTRING lpDevID = (LPVARSTRING) pBigBuf;
  2823. FUNC_PARAM params[] =
  2824. {
  2825. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2826. { "lpDeviceID", PT_POINTER, (ULONG_PTR) lpDevID, lpDevID },
  2827. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass }
  2828. };
  2829. #if TAPI_2_0
  2830. FUNC_PARAM_HEADER paramsHeader =
  2831. { 3, funcIndex, params, (funcIndex == pGetID ?
  2832. (PFN3) phoneGetID : (PFN3) phoneGetIDW) };
  2833. #else
  2834. FUNC_PARAM_HEADER paramsHeader =
  2835. { 3, funcIndex, params, (PFN3) phoneGetID };
  2836. #endif
  2837. CHK_PHONE_SELECTED()
  2838. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2839. memset (lpDevID, 0, (size_t) dwBigBufSize);
  2840. lpDevID->dwTotalSize = dwBigBufSize;
  2841. strcpy (szDeviceClass, szDefPhoneDeviceClass);
  2842. if (DoFunc (&paramsHeader) == 0)
  2843. {
  2844. ShowStructByDWORDs (lpDevID);
  2845. ShowVARSTRING (lpDevID);
  2846. }
  2847. break;
  2848. }
  2849. case pGetLamp:
  2850. {
  2851. DWORD dwLampMode;
  2852. FUNC_PARAM params[] =
  2853. {
  2854. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2855. { "dwButtonLampID", PT_DWORD, (ULONG_PTR) 0, NULL },
  2856. { "lpdwLampMode", PT_POINTER, (ULONG_PTR) &dwLampMode, &dwLampMode }
  2857. };
  2858. FUNC_PARAM_HEADER paramsHeader =
  2859. { 3, funcIndex, params, (PFN3) phoneGetLamp };
  2860. CHK_PHONE_SELECTED()
  2861. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2862. if (DoFunc (&paramsHeader) == 0)
  2863. {
  2864. for (i = 0; aLampModes[i].dwVal != 0xffffffff; i++)
  2865. {
  2866. if (dwLampMode == aLampModes[i].dwVal)
  2867. {
  2868. ShowStr ("%slamp mode = %s", szTab, aLampModes[i].lpszVal);
  2869. break;
  2870. }
  2871. }
  2872. if (aLampModes[i].dwVal == 0xffffffff)
  2873. {
  2874. ShowStr ("%sdwLampMode=%xlx (invalid)", szTab, dwLampMode);
  2875. }
  2876. }
  2877. break;
  2878. }
  2879. #if TAPI_2_0
  2880. case pGetMessage:
  2881. {
  2882. PHONEMESSAGE msg;
  2883. FUNC_PARAM params[] =
  2884. {
  2885. { szhPhoneApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  2886. { "lpMessage", PT_POINTER, (ULONG_PTR) &msg, &msg },
  2887. { "dwTimeout", PT_DWORD, (ULONG_PTR) 0, NULL }
  2888. };
  2889. FUNC_PARAM_HEADER paramsHeader =
  2890. { 3, funcIndex, params, NULL };
  2891. CHK_PHONEAPP_SELECTED()
  2892. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  2893. if (!LetUserMungeParams (&paramsHeader))
  2894. {
  2895. break;
  2896. }
  2897. // Max timeout of 2 seconds (don't want to hang app & excite user)
  2898. params[2].dwValue = (params[2].dwValue > 2000 ?
  2899. 2000 : params[2].dwValue);
  2900. DumpParams (&paramsHeader);
  2901. lResult = phoneGetMessage(
  2902. (HPHONEAPP) params[0].dwValue,
  2903. (LPPHONEMESSAGE) params[1].dwValue,
  2904. (DWORD) params[2].dwValue
  2905. );
  2906. ShowPhoneFuncResult (aFuncNames[funcIndex], lResult);
  2907. if (lResult == 0)
  2908. {
  2909. tapiCallback(
  2910. msg.hDevice,
  2911. msg.dwMessageID,
  2912. msg.dwCallbackInstance,
  2913. msg.dwParam1,
  2914. msg.dwParam2,
  2915. msg.dwParam3
  2916. );
  2917. }
  2918. break;
  2919. }
  2920. #endif
  2921. case pGetRing:
  2922. {
  2923. DWORD dwRingMode, dwVolume;
  2924. FUNC_PARAM params[] =
  2925. {
  2926. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2927. { "lpdwRingMode", PT_POINTER, (ULONG_PTR) &dwRingMode, &dwRingMode },
  2928. { "lpdwVolume", PT_POINTER, (ULONG_PTR) &dwVolume, &dwVolume }
  2929. };
  2930. FUNC_PARAM_HEADER paramsHeader =
  2931. { 3, funcIndex, params, (PFN3) phoneGetRing };
  2932. CHK_PHONE_SELECTED()
  2933. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2934. if (DoFunc (&paramsHeader) == 0)
  2935. {
  2936. ShowStr(
  2937. "%sdwRingMode=x%lx, dwVolume=x%lx",
  2938. szTab,
  2939. dwRingMode,
  2940. dwVolume
  2941. );
  2942. }
  2943. break;
  2944. }
  2945. case pGetStatus:
  2946. #if TAPI_2_0
  2947. case pGetStatusW:
  2948. #endif
  2949. {
  2950. LPPHONESTATUS lpPhoneStatus = (LPPHONESTATUS) pBigBuf;
  2951. FUNC_PARAM params[] =
  2952. {
  2953. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  2954. { "lpPhoneStatus", PT_POINTER, (ULONG_PTR) lpPhoneStatus, lpPhoneStatus }
  2955. };
  2956. #if TAPI_2_0
  2957. FUNC_PARAM_HEADER paramsHeader =
  2958. { 2, funcIndex, params, (funcIndex == pGetStatus ?
  2959. (PFN2) phoneGetStatus : (PFN2) phoneGetStatusW) };
  2960. #else
  2961. FUNC_PARAM_HEADER paramsHeader =
  2962. { 2, funcIndex, params, (PFN2) phoneGetStatus };
  2963. #endif
  2964. DWORD dwAPIVersion;
  2965. CHK_PHONE_SELECTED()
  2966. dwAPIVersion = pPhoneSel->dwAPIVersion;
  2967. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  2968. memset (pBigBuf, 0, (size_t) dwBigBufSize);
  2969. lpPhoneStatus->dwTotalSize = dwBigBufSize;
  2970. if ((lResult = DoFunc (&paramsHeader)) == 0)
  2971. {
  2972. ShowStructByDWORDs (lpPhoneStatus);
  2973. if (dwDumpStructsFlags & DS_NONZEROFIELDS)
  2974. {
  2975. STRUCT_FIELD fields[] =
  2976. {
  2977. { "dwStatusFlags", FT_FLAGS, lpPhoneStatus->dwStatusFlags, aPhoneStatusFlags },
  2978. { "dwNumOwners", FT_DWORD, lpPhoneStatus->dwNumOwners, NULL },
  2979. { "dwNumMonitors", FT_DWORD, lpPhoneStatus->dwNumMonitors, NULL },
  2980. { "dwRingMode", FT_DWORD, lpPhoneStatus->dwRingMode, NULL },
  2981. { "dwRingVolume", FT_DWORD, lpPhoneStatus->dwRingVolume, NULL },
  2982. { "dwHandsetHookSwitchMode", FT_FLAGS, lpPhoneStatus->dwHandsetHookSwitchMode, aHookSwitchModes },
  2983. { "dwHandsetVolume", FT_DWORD, lpPhoneStatus->dwHandsetVolume, NULL },
  2984. { "dwHandsetGain", FT_DWORD, lpPhoneStatus->dwHandsetGain, NULL },
  2985. { "dwSpeakerHookSwitchMode", FT_FLAGS, lpPhoneStatus->dwSpeakerHookSwitchMode, aHookSwitchModes },
  2986. { "dwSpeakerVolume", FT_DWORD, lpPhoneStatus->dwSpeakerVolume, NULL },
  2987. { "dwSpeakerGain", FT_DWORD, lpPhoneStatus->dwSpeakerGain, NULL },
  2988. { "dwHeadsetHookSwitchMode", FT_FLAGS, lpPhoneStatus->dwHeadsetHookSwitchMode, aHookSwitchModes },
  2989. { "dwHeadsetVolume", FT_DWORD, lpPhoneStatus->dwHeadsetVolume, NULL },
  2990. { "dwHeadsetGain", FT_DWORD, lpPhoneStatus->dwHeadsetGain, NULL },
  2991. { "dwDisplaySize", FT_SIZE, lpPhoneStatus->dwDisplaySize, NULL },
  2992. { "dwDisplayOffset", FT_OFFSET, lpPhoneStatus->dwDisplayOffset, NULL },
  2993. { "dwLampModesSize", FT_SIZE, lpPhoneStatus->dwLampModesSize, NULL },
  2994. { "dwLampModesOffset", FT_OFFSET, lpPhoneStatus->dwLampModesOffset, NULL },
  2995. { "dwOwnerNameSize", FT_SIZE, lpPhoneStatus->dwOwnerNameSize, NULL },
  2996. { "dwOwnerNameOffset", FT_OFFSET, lpPhoneStatus->dwOwnerNameOffset, NULL },
  2997. { "dwDevSpecificSize", FT_SIZE, lpPhoneStatus->dwDevSpecificSize, NULL },
  2998. { "dwDevSpecificOffset", FT_OFFSET, lpPhoneStatus->dwDevSpecificOffset, NULL }
  2999. #if TAPI_2_0
  3000. ,
  3001. { "dwPhoneFeatures", FT_FLAGS, 0, aPhoneFeatures }
  3002. #endif
  3003. };
  3004. STRUCT_FIELD_HEADER fieldHeader =
  3005. {
  3006. lpPhoneStatus, "PHONESTATUS", 0, fields
  3007. };
  3008. if (dwAPIVersion < 0x00020000)
  3009. {
  3010. fieldHeader.dwNumFields = 22;
  3011. }
  3012. #if TAPI_2_0
  3013. else
  3014. {
  3015. fieldHeader.dwNumFields = 23;
  3016. fields[22].dwValue = lpPhoneStatus->dwPhoneFeatures;
  3017. }
  3018. #endif
  3019. ShowStructByField (&fieldHeader, FALSE);
  3020. }
  3021. }
  3022. break;
  3023. }
  3024. case pGetStatusMessages:
  3025. {
  3026. DWORD aFlags[3];
  3027. FUNC_PARAM params[] =
  3028. {
  3029. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  3030. { "lpdwPhoneStates", PT_POINTER, (ULONG_PTR) &aFlags[0], &aFlags[0] },
  3031. { "lpdwButtonModes", PT_POINTER, (ULONG_PTR) &aFlags[1], &aFlags[1] },
  3032. { "lpdwButtonStates", PT_POINTER, (ULONG_PTR) &aFlags[2], &aFlags[2] }
  3033. };
  3034. FUNC_PARAM_HEADER paramsHeader =
  3035. { 4, funcIndex, params, (PFN4) phoneGetStatusMessages };
  3036. CHK_PHONE_SELECTED()
  3037. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3038. if (DoFunc (&paramsHeader) == 0)
  3039. {
  3040. STRUCT_FIELD fields[] =
  3041. {
  3042. { "dwPhoneStates", FT_FLAGS, aFlags[0], aPhoneStates },
  3043. { "dwButtonModes", FT_FLAGS, aFlags[1], aButtonModes },
  3044. { "dwButtonStates", FT_FLAGS, aFlags[2], aButtonStates }
  3045. };
  3046. STRUCT_FIELD_HEADER fieldHeader =
  3047. {
  3048. aFlags,
  3049. "",
  3050. 3,
  3051. fields
  3052. };
  3053. ShowStructByField (&fieldHeader, TRUE);
  3054. }
  3055. break;
  3056. }
  3057. case pGetVolume:
  3058. {
  3059. DWORD dwVolume;
  3060. FUNC_PARAM params[] =
  3061. {
  3062. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  3063. { "dwHookSwitchDev", PT_ORDINAL, (ULONG_PTR) PHONEHOOKSWITCHDEV_HANDSET, aHookSwitchDevs },
  3064. { "lpdwVolume", PT_POINTER, (ULONG_PTR) &dwVolume, &dwVolume }
  3065. };
  3066. FUNC_PARAM_HEADER paramsHeader =
  3067. { 3, funcIndex, params, (PFN3) phoneGetVolume };
  3068. CHK_PHONE_SELECTED()
  3069. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3070. if (DoFunc (&paramsHeader) == 0)
  3071. {
  3072. ShowStr ("%sdwVolume=x%lx", szTab, dwVolume);
  3073. }
  3074. break;
  3075. }
  3076. case pInitialize:
  3077. {
  3078. DWORD dwNumDevs;
  3079. PMYPHONEAPP pNewPhoneApp;
  3080. char szAppName[MAX_STRING_PARAM_SIZE];
  3081. FUNC_PARAM params[] =
  3082. {
  3083. { "lphPhoneApp", PT_POINTER, (ULONG_PTR) 0, NULL },
  3084. { "hInstance", PT_DWORD, (ULONG_PTR) ghInst, NULL },
  3085. { "lpfnCallback", PT_POINTER, (ULONG_PTR) tapiCallback, tapiCallback },
  3086. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  3087. { "lpdwNumDevs", PT_POINTER, (ULONG_PTR) &dwNumDevs, &dwNumDevs }
  3088. };
  3089. FUNC_PARAM_HEADER paramsHeader =
  3090. { 5, funcIndex, params, (PFN5) phoneInitialize };
  3091. if (!(pNewPhoneApp = AllocPhoneApp()))
  3092. {
  3093. ErrorAlert();
  3094. ShowStr ("error creating data structure");
  3095. break;
  3096. }
  3097. params[0].dwValue =
  3098. params[0].u.dwDefValue = (ULONG_PTR) &pNewPhoneApp->hPhoneApp;
  3099. strcpy (szAppName, szDefAppName);
  3100. #ifdef WIN32
  3101. lResult = DoFunc (&paramsHeader);
  3102. #else
  3103. //
  3104. // NOTE: on win16 HINSTANCEs are 16 bits, so we've to hard code this
  3105. //
  3106. if (!LetUserMungeParams (&paramsHeader))
  3107. {
  3108. FreePhoneApp (pNewPhoneApp);
  3109. break;
  3110. }
  3111. DumpParams (&paramsHeader);
  3112. lResult = phoneInitialize(
  3113. (LPHPHONEAPP) params[0].dwValue,
  3114. (HINSTANCE) params[1].dwValue,
  3115. (PHONECALLBACK) params[2].dwValue,
  3116. (LPCSTR) params[3].dwValue,
  3117. (LPDWORD) params[4].dwValue
  3118. );
  3119. ShowPhoneFuncResult (aFuncNames[funcIndex], lResult);
  3120. #endif // WIN32
  3121. if (lResult == 0)
  3122. {
  3123. ShowStr ("%snum phone devs=%ld", szTab, dwNumDevs);
  3124. UpdateWidgetList();
  3125. gdwNumPhoneDevs = dwNumDevs;
  3126. SelectWidget ((PMYWIDGET) pNewPhoneApp);
  3127. }
  3128. else
  3129. {
  3130. FreePhoneApp (pNewPhoneApp);
  3131. }
  3132. break;
  3133. }
  3134. #if TAPI_2_0
  3135. case pInitializeEx:
  3136. case pInitializeExW:
  3137. {
  3138. char szAppName[MAX_STRING_PARAM_SIZE];
  3139. DWORD dwNumDevs, dwAPIVersion;
  3140. PMYPHONEAPP pNewPhoneApp;
  3141. PHONEINITIALIZEEXPARAMS initExParams;
  3142. FUNC_PARAM params[] =
  3143. {
  3144. { "lphPhoneApp", PT_POINTER, (ULONG_PTR) 0, NULL },
  3145. { "hInstance", PT_DWORD, (ULONG_PTR) ghInst, NULL },
  3146. { "lpfnCallback", PT_POINTER, (ULONG_PTR) tapiCallback, tapiCallback },
  3147. { szlpszFriendlyAppName,PT_STRING, (ULONG_PTR) szAppName, szAppName },
  3148. { "lpdwNumDevs", PT_POINTER, (ULONG_PTR) &dwNumDevs, &dwNumDevs },
  3149. { "lpdwAPIVersion", PT_POINTER, (ULONG_PTR) &dwAPIVersion, &dwAPIVersion },
  3150. { " ->dwAPIVersion",PT_ORDINAL,(ULONG_PTR) dwDefPhoneAPIVersion, aAPIVersions },
  3151. { "lpInitExParams", PT_POINTER, (ULONG_PTR) &initExParams, &initExParams },
  3152. { " ->dwOptions", PT_ORDINAL, (ULONG_PTR) PHONEINITIALIZEEXOPTION_USECOMPLETIONPORT, aPhoneInitExOptions }
  3153. };
  3154. FUNC_PARAM_HEADER paramsHeader =
  3155. { 9, funcIndex, params, NULL };
  3156. if (!(pNewPhoneApp = AllocPhoneApp()))
  3157. {
  3158. ErrorAlert();
  3159. ShowStr ("error creating data structure");
  3160. break;
  3161. }
  3162. params[0].dwValue =
  3163. params[0].u.dwDefValue = (ULONG_PTR) &pNewPhoneApp->hPhoneApp;
  3164. strcpy (szAppName, szDefAppName);
  3165. if (!LetUserMungeParams (&paramsHeader))
  3166. {
  3167. FreePhoneApp (pNewPhoneApp);
  3168. break;
  3169. }
  3170. initExParams.dwTotalSize = sizeof (PHONEINITIALIZEEXPARAMS);
  3171. initExParams.dwOptions = (DWORD) params[8].dwValue;
  3172. initExParams.Handles.hCompletionPort = ghCompletionPort;
  3173. dwAPIVersion = (DWORD) params[6].dwValue;
  3174. DumpParams (&paramsHeader);
  3175. if (funcIndex == pInitializeEx)
  3176. {
  3177. lResult = phoneInitializeEx(
  3178. (LPHPHONEAPP) params[0].dwValue,
  3179. (HINSTANCE) params[1].dwValue,
  3180. (PHONECALLBACK) params[2].dwValue,
  3181. (LPCSTR) params[3].dwValue,
  3182. (LPDWORD) params[4].dwValue,
  3183. (LPDWORD) params[5].dwValue,
  3184. (LPPHONEINITIALIZEEXPARAMS) params[7].dwValue
  3185. );
  3186. }
  3187. else
  3188. {
  3189. MakeWideString ((LPVOID) params[3].dwValue);
  3190. lResult = phoneInitializeExW(
  3191. (LPHPHONEAPP) params[0].dwValue,
  3192. (HINSTANCE) params[1].dwValue,
  3193. (PHONECALLBACK) params[2].dwValue,
  3194. (LPCWSTR) params[3].dwValue,
  3195. (LPDWORD) params[4].dwValue,
  3196. (LPDWORD) params[5].dwValue,
  3197. (LPPHONEINITIALIZEEXPARAMS) params[7].dwValue
  3198. );
  3199. }
  3200. ShowPhoneFuncResult (aFuncNames[funcIndex], lResult);
  3201. if (lResult == 0)
  3202. {
  3203. ShowStr ("%snum phone devs = %ld", szTab, dwNumDevs);
  3204. if (params[7].dwValue != 0 &&
  3205. (initExParams.dwOptions & 3) ==
  3206. PHONEINITIALIZEEXOPTION_USEEVENT)
  3207. {
  3208. ShowStr(
  3209. "hPhoneApp x%x was created with the\r\n" \
  3210. "USEEVENT option, so you must use\r\n" \
  3211. "phoneGetMessage to retrieve messages.",
  3212. pNewPhoneApp->hPhoneApp
  3213. );
  3214. }
  3215. //SendMessage (ghwndLineApps, LB_SETCURSEL, (WPARAM) i, 0);
  3216. UpdateWidgetList();
  3217. gdwNumPhoneDevs = dwNumDevs;
  3218. SelectWidget ((PMYWIDGET) pNewPhoneApp);
  3219. }
  3220. else
  3221. {
  3222. FreePhoneApp (pNewPhoneApp);
  3223. }
  3224. break;
  3225. }
  3226. #endif
  3227. case pOpen:
  3228. {
  3229. PMYPHONE pNewPhone;
  3230. FUNC_PARAM params[] =
  3231. {
  3232. { "hPhoneApp", PT_DWORD, 0, NULL },
  3233. { szdwDeviceID, PT_DWORD, dwDefPhoneDeviceID, NULL },
  3234. { "lphPhone", PT_POINTER, 0, NULL },
  3235. { szdwAPIVersion, PT_ORDINAL, dwDefPhoneAPIVersion, aAPIVersions },
  3236. { "dwExtVersion", PT_DWORD, dwDefPhoneExtVersion, NULL },
  3237. { "dwCallbackInstance", PT_DWORD, 0, NULL },
  3238. { "dwPrivilege", PT_ORDINAL, dwDefPhonePrivilege, aPhonePrivileges }
  3239. };
  3240. FUNC_PARAM_HEADER paramsHeader =
  3241. { 7, funcIndex, params, (PFN7) phoneOpen };
  3242. CHK_PHONEAPP_SELECTED()
  3243. if (!(pNewPhone = AllocPhone(pPhoneAppSel)))
  3244. {
  3245. ErrorAlert();
  3246. ShowStr ("error creating data structure");
  3247. break;
  3248. }
  3249. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  3250. params[2].dwValue =
  3251. params[2].u.dwDefValue = (ULONG_PTR) &pNewPhone->hPhone;
  3252. if ((lResult = DoFunc(&paramsHeader)) == 0)
  3253. {
  3254. if ((HPHONEAPP) params[0].dwValue != pPhoneAppSel->hPhoneApp)
  3255. {
  3256. //
  3257. // User has switched phone apps on us we need to recreate
  3258. // the phone data structure under a different phone app
  3259. //
  3260. PMYPHONE pNewPhone2 =
  3261. AllocPhone (GetPhoneApp((HPHONEAPP)params[0].dwValue));
  3262. if (pNewPhone2)
  3263. {
  3264. pNewPhone2->hPhone = pNewPhone->hPhone;
  3265. FreePhone (pNewPhone);
  3266. pNewPhone = pNewPhone2;
  3267. }
  3268. else
  3269. {
  3270. // BUGBUG show error: couldn't alloc a new phone struct
  3271. phoneClose (pNewPhone->hPhone);
  3272. FreePhone (pNewPhone);
  3273. break;
  3274. }
  3275. }
  3276. //
  3277. // Save info about this phone that we can display later
  3278. //
  3279. pNewPhone->hPhoneApp = (HPHONEAPP) params[0].dwValue;
  3280. pNewPhone->dwDevID = (DWORD) params[1].dwValue;
  3281. pNewPhone->dwAPIVersion = (DWORD) params[3].dwValue;
  3282. pNewPhone->dwPrivilege = (DWORD) params[6].dwValue;
  3283. UpdateWidgetList();
  3284. SelectWidget ((PMYWIDGET) pNewPhone);
  3285. }
  3286. else
  3287. {
  3288. FreePhone (pNewPhone);
  3289. }
  3290. break;
  3291. }
  3292. case pNegotiateAPIVersion:
  3293. {
  3294. DWORD dwAPIVersion;
  3295. PHONEEXTENSIONID extID;
  3296. FUNC_PARAM params[] =
  3297. {
  3298. { "hPhoneApp", PT_DWORD, (ULONG_PTR) 0, NULL },
  3299. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefPhoneDeviceID, NULL },
  3300. { "dwAPILowVersion", PT_DWORD, (ULONG_PTR) 0x00010000, aAPIVersions },
  3301. { "dwAPIHighVersion", PT_DWORD, (ULONG_PTR) 0x10000000, aAPIVersions },
  3302. { "lpdwAPIVersion", PT_POINTER, (ULONG_PTR) &dwAPIVersion, &dwAPIVersion },
  3303. { "lpExtensionID", PT_POINTER, (ULONG_PTR) &extID, &extID }
  3304. };
  3305. FUNC_PARAM_HEADER paramsHeader =
  3306. { 6, funcIndex, params, (PFN6) phoneNegotiateAPIVersion };
  3307. CHK_PHONEAPP_SELECTED()
  3308. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  3309. if ((lResult = DoFunc (&paramsHeader)) == 0)
  3310. {
  3311. ShowStr ("%s%s=x%lx", szTab, szdwAPIVersion, dwAPIVersion);
  3312. ShowStr(
  3313. "%sextID.ID0=x%lx, .ID1=x%lx, .ID2=x%lx, .ID3=x%lx, ",
  3314. szTab,
  3315. extID.dwExtensionID0,
  3316. extID.dwExtensionID1,
  3317. extID.dwExtensionID2,
  3318. extID.dwExtensionID3
  3319. );
  3320. }
  3321. break;
  3322. }
  3323. case pNegotiateExtVersion:
  3324. {
  3325. DWORD dwExtVersion;
  3326. FUNC_PARAM params[] =
  3327. {
  3328. { szhPhoneApp, PT_DWORD, (ULONG_PTR) 0, NULL },
  3329. { szdwDeviceID, PT_DWORD, (ULONG_PTR) dwDefPhoneDeviceID, NULL },
  3330. { szdwAPIVersion, PT_ORDINAL, (ULONG_PTR) dwDefPhoneAPIVersion, aAPIVersions },
  3331. { "dwExtLowVersion", PT_DWORD, (ULONG_PTR) 0x00000000, NULL },
  3332. { "dwExtHighVersion", PT_DWORD, (ULONG_PTR) 0x80000000, NULL },
  3333. { "lpdwExtVersion", PT_POINTER, (ULONG_PTR) &dwExtVersion, &dwExtVersion }
  3334. };
  3335. FUNC_PARAM_HEADER paramsHeader =
  3336. { 6, funcIndex, params, (PFN6) phoneNegotiateExtVersion };
  3337. CHK_PHONEAPP_SELECTED()
  3338. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  3339. if (DoFunc (&paramsHeader) == 0)
  3340. {
  3341. ShowStr ("%sdwExtVersion=x%lx", szTab, dwExtVersion);
  3342. }
  3343. break;
  3344. }
  3345. case pSetButtonInfo:
  3346. #if TAPI_2_0
  3347. case pSetButtonInfoW:
  3348. #endif
  3349. {
  3350. char szButtonText[MAX_STRING_PARAM_SIZE] = "button text";
  3351. char szDevSpecific[MAX_STRING_PARAM_SIZE] = "dev specific info";
  3352. LPPHONEBUTTONINFO lpButtonInfo = (LPPHONEBUTTONINFO) pBigBuf;
  3353. FUNC_PARAM params[] =
  3354. {
  3355. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  3356. { "dwButtonLampID", PT_DWORD, (ULONG_PTR) 0, NULL },
  3357. { "lpData", PT_POINTER, (ULONG_PTR) lpButtonInfo, lpButtonInfo },
  3358. { " ->dwButtonMode", PT_FLAGS, (ULONG_PTR) PHONEBUTTONMODE_CALL, aButtonModes },
  3359. { " ->dwButtonFunction", PT_DWORD, (ULONG_PTR) 0, NULL },
  3360. // { " ->dwButtonFunction", PT_???, , aButtonFunctions },
  3361. { " ->ButtonText", PT_STRING, (ULONG_PTR) szButtonText, szButtonText },
  3362. { " ->DevSpecific", PT_STRING, (ULONG_PTR) szDevSpecific, szDevSpecific },
  3363. #if TAPI_1_1
  3364. { " ->dwButtonState", PT_FLAGS, (ULONG_PTR) 0, aButtonStates }
  3365. #endif
  3366. };
  3367. FUNC_PARAM_HEADER paramsHeader =
  3368. #if TAPI_1_1
  3369. { 8, funcIndex, params, NULL };
  3370. #else
  3371. { 7, funcIndex, params, NULL };
  3372. #endif
  3373. DWORD dwFixedStructSize = sizeof(PHONEBUTTONINFO), dwLength;
  3374. // BUGBUG need a PT_ type to specify constants (ords?) for ->dwButtonFunction
  3375. CHK_PHONE_SELECTED()
  3376. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3377. //
  3378. // Note: the dwButtonState field in PHONEBUTTONINFO is only valid
  3379. // in 1.4+. It'll be ignored for phones opened w/ ver 1.3.
  3380. //
  3381. if (!LetUserMungeParams (&paramsHeader))
  3382. {
  3383. break;
  3384. }
  3385. memset (lpButtonInfo, 0, (size_t) dwBigBufSize);
  3386. if (dwBigBufSize >= 4)
  3387. {
  3388. lpButtonInfo->dwTotalSize = dwBigBufSize;
  3389. if (dwBigBufSize >= 0x24) // sizeof(PHONEBUTTONINFO) in ver 0x10003
  3390. {
  3391. lpButtonInfo->dwButtonMode = (DWORD) params[3].dwValue;
  3392. lpButtonInfo->dwButtonFunction = (DWORD) params[4].dwValue;
  3393. if ((params[5].dwValue == (ULONG_PTR) szButtonText) &&
  3394. (dwLength = (DWORD) strlen (szButtonText)) &&
  3395. (dwBigBufSize >= (dwFixedStructSize + dwLength + 1)))
  3396. {
  3397. lpButtonInfo->dwButtonTextSize = dwLength + 1;
  3398. lpButtonInfo->dwButtonTextOffset = dwFixedStructSize;
  3399. #if TAPI_2_0
  3400. if (gbWideStringParams)
  3401. {
  3402. lpButtonInfo->dwButtonTextSize *= sizeof (WCHAR);
  3403. MultiByteToWideChar(
  3404. CP_ACP,
  3405. MB_PRECOMPOSED,
  3406. (LPCSTR) szButtonText,
  3407. -1,
  3408. (LPWSTR) (((char far *) lpButtonInfo) +
  3409. dwFixedStructSize),
  3410. MAX_STRING_PARAM_SIZE / 2
  3411. );
  3412. }
  3413. else
  3414. {
  3415. strcpy(
  3416. ((char far *) lpButtonInfo) + dwFixedStructSize,
  3417. szButtonText
  3418. );
  3419. }
  3420. #else
  3421. strcpy(
  3422. ((char far *) lpButtonInfo) + dwFixedStructSize,
  3423. szButtonText
  3424. );
  3425. #endif
  3426. }
  3427. if ((params[6].dwValue == (ULONG_PTR) szDevSpecific) &&
  3428. (dwLength = (DWORD) strlen (szDevSpecific)) &&
  3429. (dwBigBufSize >= (dwFixedStructSize + dwLength + 1 +
  3430. lpButtonInfo->dwButtonTextSize)))
  3431. {
  3432. lpButtonInfo->dwDevSpecificSize = dwLength + 1;
  3433. lpButtonInfo->dwDevSpecificOffset = dwFixedStructSize +
  3434. lpButtonInfo->dwButtonTextSize;
  3435. #if TAPI_2_0
  3436. if (gbWideStringParams)
  3437. {
  3438. lpButtonInfo->dwDevSpecificSize *= sizeof (WCHAR);
  3439. MultiByteToWideChar(
  3440. CP_ACP,
  3441. MB_PRECOMPOSED,
  3442. (LPCSTR) szDevSpecific,
  3443. -1,
  3444. (LPWSTR) (((char far *) lpButtonInfo) +
  3445. lpButtonInfo->dwDevSpecificOffset),
  3446. MAX_STRING_PARAM_SIZE / 2
  3447. );
  3448. }
  3449. else
  3450. {
  3451. strcpy(
  3452. ((char far *) lpButtonInfo) +
  3453. lpButtonInfo->dwDevSpecificOffset,
  3454. szDevSpecific
  3455. );
  3456. }
  3457. #else
  3458. strcpy(
  3459. ((char far *) lpButtonInfo) +
  3460. lpButtonInfo->dwDevSpecificOffset,
  3461. szDevSpecific
  3462. );
  3463. #endif
  3464. }
  3465. #if TAPI_1_1
  3466. if (dwBigBufSize >= dwFixedStructSize)
  3467. {
  3468. lpButtonInfo->dwButtonState = (DWORD) params[7].dwValue;
  3469. }
  3470. #endif
  3471. }
  3472. }
  3473. #if TAPI_2_0
  3474. if (funcIndex == pSetButtonInfo)
  3475. {
  3476. lResult = phoneSetButtonInfo(
  3477. (HPHONE) params[0].dwValue,
  3478. (DWORD) params[1].dwValue,
  3479. (LPPHONEBUTTONINFO) params[2].dwValue
  3480. );
  3481. }
  3482. else
  3483. {
  3484. lResult = phoneSetButtonInfoW(
  3485. (HPHONE) params[0].dwValue,
  3486. (DWORD) params[1].dwValue,
  3487. (LPPHONEBUTTONINFO) params[2].dwValue
  3488. );
  3489. }
  3490. #else
  3491. lResult = phoneSetButtonInfo(
  3492. (HPHONE) params[0].dwValue,
  3493. params[1].dwValue,
  3494. (LPPHONEBUTTONINFO) params[2].dwValue
  3495. );
  3496. #endif
  3497. ShowPhoneFuncResult (aFuncNames[funcIndex], lResult);
  3498. break;
  3499. }
  3500. case pSetData:
  3501. {
  3502. FUNC_PARAM params[] =
  3503. {
  3504. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  3505. { "dwDataID", PT_DWORD, (ULONG_PTR) 0, NULL },
  3506. { "lpData", PT_POINTER, (ULONG_PTR) pBigBuf, pBigBuf },
  3507. { szdwSize, PT_DWORD, (ULONG_PTR) dwBigBufSize, NULL }
  3508. };
  3509. FUNC_PARAM_HEADER paramsHeader =
  3510. { 4, funcIndex, params, (PFN4) phoneSetData };
  3511. CHK_PHONE_SELECTED()
  3512. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3513. DoFunc (&paramsHeader);
  3514. break;
  3515. }
  3516. case pSetDisplay:
  3517. {
  3518. char szDisplay[MAX_STRING_PARAM_SIZE] = "123";
  3519. FUNC_PARAM params[] =
  3520. {
  3521. { szhPhone, PT_DWORD, (ULONG_PTR) 0, NULL },
  3522. { "dwRow", PT_DWORD, (ULONG_PTR) 0, NULL },
  3523. { "dwColumn", PT_DWORD, (ULONG_PTR) 0, NULL },
  3524. { "lpsDisplay", PT_STRING, (ULONG_PTR) szDisplay, szDisplay },
  3525. { szdwSize, PT_DWORD, (ULONG_PTR) 3, NULL }
  3526. };
  3527. FUNC_PARAM_HEADER paramsHeader =
  3528. { 5, funcIndex, params, (PFN5) phoneSetDisplay };
  3529. CHK_PHONE_SELECTED()
  3530. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3531. lResult = DoFunc (&paramsHeader);
  3532. break;
  3533. }
  3534. case pSetGain:
  3535. {
  3536. FUNC_PARAM params[] =
  3537. {
  3538. { szhPhone, PT_DWORD, 0, NULL },
  3539. { "dwHookSwitchDev", PT_ORDINAL, PHONEHOOKSWITCHDEV_HANDSET, aHookSwitchDevs },
  3540. { "dwGain", PT_DWORD, 0, NULL }
  3541. };
  3542. FUNC_PARAM_HEADER paramsHeader =
  3543. { 3, funcIndex, params, (PFN3) phoneSetGain };
  3544. CHK_PHONE_SELECTED()
  3545. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3546. lResult = DoFunc (&paramsHeader);
  3547. break;
  3548. }
  3549. case pSetHookSwitch:
  3550. {
  3551. FUNC_PARAM params[] =
  3552. {
  3553. { szhPhone, PT_DWORD, 0, NULL },
  3554. { "dwHookSwitchDevs", PT_FLAGS, PHONEHOOKSWITCHDEV_HANDSET, aHookSwitchDevs },
  3555. { "dwHookSwitchMode", PT_ORDINAL, PHONEHOOKSWITCHMODE_ONHOOK, aHookSwitchModes }
  3556. };
  3557. FUNC_PARAM_HEADER paramsHeader =
  3558. { 3, funcIndex, params, (PFN3) phoneSetHookSwitch };
  3559. CHK_PHONE_SELECTED()
  3560. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3561. lResult = DoFunc (&paramsHeader);
  3562. break;
  3563. }
  3564. case pSetLamp:
  3565. {
  3566. FUNC_PARAM params[] =
  3567. {
  3568. { szhPhone, PT_DWORD, 0, NULL },
  3569. { "dwButtonLampID", PT_DWORD, 0, NULL },
  3570. { "dwLampMode", PT_ORDINAL, PHONELAMPMODE_OFF, aLampModes }
  3571. };
  3572. FUNC_PARAM_HEADER paramsHeader =
  3573. { 3, funcIndex, params, (PFN3) phoneSetLamp };
  3574. CHK_PHONE_SELECTED()
  3575. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3576. lResult = DoFunc (&paramsHeader);
  3577. break;
  3578. }
  3579. case pSetRing:
  3580. {
  3581. FUNC_PARAM params[] =
  3582. {
  3583. { szhPhone, PT_DWORD, 0, NULL },
  3584. { "dwRingMode", PT_DWORD, 0, NULL },
  3585. { "dwVolume", PT_DWORD, 0, NULL }
  3586. };
  3587. FUNC_PARAM_HEADER paramsHeader =
  3588. { 3, funcIndex, params, (PFN3) phoneSetRing };
  3589. CHK_PHONE_SELECTED()
  3590. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3591. lResult = DoFunc (&paramsHeader);
  3592. break;
  3593. }
  3594. case pSetStatusMessages:
  3595. {
  3596. FUNC_PARAM params[] =
  3597. {
  3598. { szhPhone, PT_DWORD, 0, NULL },
  3599. { "dwPhoneStates", PT_FLAGS, 0, aPhoneStates },
  3600. { "dwButtonModes", PT_FLAGS, 0, aButtonModes },
  3601. { "dwButtonStates", PT_FLAGS, 0, aButtonStates }
  3602. };
  3603. FUNC_PARAM_HEADER paramsHeader =
  3604. { 4, funcIndex, params, (PFN4) phoneSetStatusMessages };
  3605. CHK_PHONE_SELECTED()
  3606. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3607. lResult = DoFunc (&paramsHeader);
  3608. break;
  3609. }
  3610. case pSetVolume:
  3611. {
  3612. FUNC_PARAM params[] =
  3613. {
  3614. { szhPhone, PT_DWORD, 0, NULL },
  3615. { "dwHookSwitchDev", PT_ORDINAL, PHONEHOOKSWITCHDEV_HANDSET, aHookSwitchDevs },
  3616. { "dwVolume", PT_DWORD, 0, NULL }
  3617. };
  3618. FUNC_PARAM_HEADER paramsHeader =
  3619. { 3, funcIndex, params, (PFN3) phoneSetVolume };
  3620. CHK_PHONE_SELECTED()
  3621. params[0].dwValue = (ULONG_PTR) pPhoneSel->hPhone;
  3622. lResult = DoFunc (&paramsHeader);
  3623. break;
  3624. }
  3625. case pShutdown:
  3626. {
  3627. FUNC_PARAM params[] =
  3628. {
  3629. { szhPhoneApp, PT_DWORD, 0, NULL }
  3630. };
  3631. FUNC_PARAM_HEADER paramsHeader =
  3632. { 1, funcIndex, params, (PFN1) phoneShutdown };
  3633. CHK_PHONEAPP_SELECTED()
  3634. params[0].dwValue = (ULONG_PTR) pPhoneAppSel->hPhoneApp;
  3635. if (DoFunc (&paramsHeader) == 0)
  3636. {
  3637. ShowWidgetList (FALSE);
  3638. FreePhoneApp (GetPhoneApp((HPHONEAPP) params[0].dwValue));
  3639. ShowWidgetList (TRUE);
  3640. }
  3641. break;
  3642. }
  3643. case tGetLocationInfo:
  3644. #if TAPI_2_0
  3645. case tGetLocationInfoW:
  3646. #endif
  3647. {
  3648. char szCountryCode[MAX_STRING_PARAM_SIZE] = "";
  3649. char szCityCode[MAX_STRING_PARAM_SIZE] = "";
  3650. FUNC_PARAM params[] =
  3651. {
  3652. { "lpszCountryCode", PT_POINTER, (ULONG_PTR) szCountryCode, szCountryCode },
  3653. { "lpszCityCode", PT_POINTER, (ULONG_PTR) szCityCode, szCityCode }
  3654. };
  3655. #if TAPI_2_0
  3656. FUNC_PARAM_HEADER paramsHeader =
  3657. { 2, funcIndex, params, (funcIndex == tGetLocationInfo ?
  3658. (PFN2) tapiGetLocationInfo : (PFN2) tapiGetLocationInfoW) };
  3659. #else
  3660. FUNC_PARAM_HEADER paramsHeader =
  3661. { 2, funcIndex, params, (PFN2) tapiGetLocationInfo };
  3662. #endif
  3663. if (DoFunc (&paramsHeader) == 0)
  3664. {
  3665. #if TAPI_2_0
  3666. ShowStr(
  3667. (gbWideStringParams ? "%s*lpszCountryCode='%ws'" :
  3668. "%s*lpszCountryCode='%s'"),
  3669. szTab,
  3670. szCountryCode
  3671. );
  3672. ShowStr(
  3673. (gbWideStringParams ? "%s*lpszCityCode='%ws'" :
  3674. "%s*lpszCityCode='%s'"),
  3675. szTab,
  3676. szCityCode
  3677. );
  3678. #else
  3679. ShowStr ("%s*lpszCountryCode='%s'", szTab, szCountryCode);
  3680. ShowStr ("%s*lpszCityCode='%s'", szTab, szCityCode);
  3681. #endif
  3682. }
  3683. break;
  3684. }
  3685. case tRequestDrop:
  3686. {
  3687. FUNC_PARAM params[] =
  3688. {
  3689. { "hWnd", PT_DWORD, (ULONG_PTR) ghwndMain, 0 },
  3690. { "wRequestID", PT_DWORD, (ULONG_PTR) 0, 0 }
  3691. };
  3692. FUNC_PARAM_HEADER paramsHeader =
  3693. { 2, funcIndex, params, (PFN2) tapiRequestDrop };
  3694. #ifdef WIN32
  3695. DoFunc (&paramsHeader);
  3696. #else
  3697. //
  3698. // NOTE: on win16 HWNDSs & WPARAMs are 16 bits, so we've to hard
  3699. // code this
  3700. //
  3701. if (!LetUserMungeParams (&paramsHeader))
  3702. {
  3703. break;
  3704. }
  3705. DumpParams (&paramsHeader);
  3706. lResult = tapiRequestDrop(
  3707. (HWND) params[0].dwValue,
  3708. (WPARAM) params[1].dwValue
  3709. );
  3710. ShowTapiFuncResult (aFuncNames[funcIndex], lResult);
  3711. #endif // WIN32
  3712. break;
  3713. }
  3714. case tRequestMakeCall:
  3715. #if TAPI_2_0
  3716. case tRequestMakeCallW:
  3717. #endif
  3718. {
  3719. char szDestAddress[MAX_STRING_PARAM_SIZE];
  3720. char szAppName[MAX_STRING_PARAM_SIZE];
  3721. char szCalledParty[MAX_STRING_PARAM_SIZE] = "";
  3722. char szComment[MAX_STRING_PARAM_SIZE] = "";
  3723. FUNC_PARAM params[] =
  3724. {
  3725. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress },
  3726. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  3727. { "lpszCalledParty", PT_STRING, (ULONG_PTR) szCalledParty, szCalledParty },
  3728. { "lpszComment", PT_STRING, (ULONG_PTR) szComment, szComment }
  3729. };
  3730. #if TAPI_2_0
  3731. FUNC_PARAM_HEADER paramsHeader =
  3732. { 4, funcIndex, params, (funcIndex == tRequestMakeCall ?
  3733. (PFN4) tapiRequestMakeCall : (PFN4) tapiRequestMakeCallW) };
  3734. #else
  3735. FUNC_PARAM_HEADER paramsHeader =
  3736. { 4, funcIndex, params, (PFN4) tapiRequestMakeCall };
  3737. #endif
  3738. strcpy (szDestAddress, szDefDestAddress);
  3739. strcpy (szAppName, szDefAppName);
  3740. DoFunc (&paramsHeader);
  3741. break;
  3742. }
  3743. case tRequestMediaCall:
  3744. #if TAPI_2_0
  3745. case tRequestMediaCallW:
  3746. #endif
  3747. {
  3748. char szDeviceClass[MAX_STRING_PARAM_SIZE];
  3749. char szDevID[MAX_STRING_PARAM_SIZE] = "0";
  3750. char szDestAddress[MAX_STRING_PARAM_SIZE];
  3751. char szAppName[MAX_STRING_PARAM_SIZE];
  3752. char szCalledParty[MAX_STRING_PARAM_SIZE] = "";
  3753. char szComment[MAX_STRING_PARAM_SIZE] = "";
  3754. FUNC_PARAM params[] =
  3755. {
  3756. { "hWnd", PT_DWORD, (ULONG_PTR) ghwndMain, 0 },
  3757. { "wRequestID", PT_DWORD, (ULONG_PTR) 0, 0 },
  3758. { szlpszDeviceClass, PT_STRING, (ULONG_PTR) szDeviceClass, szDeviceClass },
  3759. { "lpDeviceID", PT_STRING, (ULONG_PTR) szDevID, szDevID },
  3760. { szdwSize, PT_DWORD, (ULONG_PTR) 0, 0 },
  3761. { "dwSecure", PT_DWORD, (ULONG_PTR) 0, 0 },
  3762. { szlpszDestAddress, PT_STRING, (ULONG_PTR) szDestAddress, szDestAddress },
  3763. { szlpszAppName, PT_STRING, (ULONG_PTR) szAppName, szAppName },
  3764. { "lpszCalledParty", PT_STRING, (ULONG_PTR) szCalledParty, szCalledParty },
  3765. { "lpszComment", PT_STRING, (ULONG_PTR) szComment, szComment }
  3766. };
  3767. #if TAPI_2_0
  3768. FUNC_PARAM_HEADER paramsHeader =
  3769. { 10, funcIndex, params, (funcIndex == tRequestMediaCall ?
  3770. (PFN10) tapiRequestMediaCall : (PFN10) tapiRequestMediaCallW) };
  3771. #else
  3772. FUNC_PARAM_HEADER paramsHeader =
  3773. { 10, funcIndex, params, (PFN10) tapiRequestMediaCall };
  3774. #endif
  3775. strcpy (szDeviceClass, szDefLineDeviceClass); // BUGBUG szDefTapiDeviceClass);
  3776. strcpy (szDestAddress, szDefDestAddress);
  3777. strcpy (szAppName, szDefAppName);
  3778. #ifdef WIN32
  3779. DoFunc (&paramsHeader);
  3780. #else
  3781. //
  3782. // NOTE: on win16 HWNDSs & WPARAMs are 16 bits, so we've to hard
  3783. // code this
  3784. //
  3785. if (!LetUserMungeParams (&paramsHeader))
  3786. {
  3787. break;
  3788. }
  3789. DumpParams (&paramsHeader);
  3790. lResult = tapiRequestMediaCall(
  3791. (HWND) params[0].dwValue,
  3792. (WPARAM) params[1].dwValue,
  3793. (LPCSTR) params[2].dwValue,
  3794. (LPCSTR) params[3].dwValue,
  3795. params[4].dwValue,
  3796. params[5].dwValue,
  3797. (LPCSTR) params[6].dwValue,
  3798. (LPCSTR) params[7].dwValue,
  3799. (LPCSTR) params[8].dwValue,
  3800. (LPCSTR) params[9].dwValue
  3801. );
  3802. ShowTapiFuncResult (aFuncNames[funcIndex], lResult);
  3803. #endif // WIN32
  3804. break;
  3805. }
  3806. case OpenAllLines:
  3807. {
  3808. DWORD dwDefLineDeviceIDSav = dwDefLineDeviceID;
  3809. CHK_LINEAPP_SELECTED()
  3810. UpdateResults (TRUE);
  3811. ShowWidgetList (FALSE);
  3812. for(
  3813. dwDefLineDeviceID = 0;
  3814. dwDefLineDeviceID < gdwNumLineDevs;
  3815. dwDefLineDeviceID++
  3816. )
  3817. {
  3818. FuncDriver (lOpen);
  3819. }
  3820. UpdateResults (FALSE);
  3821. ShowWidgetList (TRUE);
  3822. dwDefLineDeviceID = dwDefLineDeviceIDSav;
  3823. break;
  3824. }
  3825. case OpenAllPhones:
  3826. {
  3827. DWORD dwDefPhoneDeviceIDSav = dwDefPhoneDeviceID;
  3828. CHK_PHONEAPP_SELECTED()
  3829. UpdateResults (TRUE);
  3830. ShowWidgetList (FALSE);
  3831. for(
  3832. dwDefPhoneDeviceID = 0;
  3833. dwDefPhoneDeviceID < gdwNumPhoneDevs;
  3834. dwDefPhoneDeviceID++
  3835. )
  3836. {
  3837. FuncDriver (pOpen);
  3838. }
  3839. UpdateResults (FALSE);
  3840. ShowWidgetList (TRUE);
  3841. dwDefPhoneDeviceID = dwDefPhoneDeviceIDSav;
  3842. break;
  3843. }
  3844. case CloseHandl:
  3845. {
  3846. #ifdef WIN32
  3847. FUNC_PARAM params[] =
  3848. {
  3849. { "hObject", PT_DWORD, 0, NULL }
  3850. };
  3851. FUNC_PARAM_HEADER paramsHeader =
  3852. { 1, funcIndex, params, NULL };
  3853. if (!LetUserMungeParams (&paramsHeader))
  3854. {
  3855. break;
  3856. }
  3857. if (CloseHandle ((HANDLE) params[0].dwValue))
  3858. {
  3859. ShowStr ("Handle x%lx closed", params[0].dwValue);
  3860. }
  3861. else
  3862. {
  3863. ShowStr ("CloseHandle failed, err=%lx", GetLastError());
  3864. }
  3865. #else
  3866. FUNC_PARAM params[] =
  3867. {
  3868. { "idCommDev", PT_DWORD, 0, NULL }
  3869. };
  3870. FUNC_PARAM_HEADER paramsHeader =
  3871. { 1, funcIndex, params, NULL };
  3872. if (!LetUserMungeParams (&paramsHeader))
  3873. {
  3874. break;
  3875. }
  3876. if (CloseComm ((int) params[0].dwValue) == 0)
  3877. {
  3878. ShowStr ("Comm dev x%lx closed", params[0].dwValue);
  3879. }
  3880. else
  3881. {
  3882. ShowStr ("CloseComm() failed");
  3883. }
  3884. #endif
  3885. break;
  3886. }
  3887. case DumpBuffer:
  3888. ShowStr ("Buffer contents:");
  3889. ShowBytes(
  3890. (dwBigBufSize > 256 ? 256 : dwBigBufSize),
  3891. pBigBuf,
  3892. 1
  3893. );
  3894. break;
  3895. #if (INTERNAL_VER >= 0x20000)
  3896. case iNewLocationW:
  3897. {
  3898. char szNewLocName[MAX_STRING_PARAM_SIZE] = "NewLocN";
  3899. LINEEXTENSIONID extID;
  3900. FUNC_PARAM params[] =
  3901. {
  3902. { "lpszNewLocName", PT_STRING, (ULONG_PTR) szNewLocName, szNewLocName}
  3903. };
  3904. FUNC_PARAM_HEADER paramsHeader =
  3905. { 1, funcIndex, params, NULL };
  3906. if (!LetUserMungeParams (&paramsHeader))
  3907. {
  3908. break;
  3909. }
  3910. MakeWideString ((LPVOID) szNewLocName);
  3911. lResult = internalNewLocationW(
  3912. (WCHAR *) params[0].dwValue
  3913. );
  3914. break;
  3915. }
  3916. #endif
  3917. default:
  3918. ErrorAlert();
  3919. break;
  3920. }
  3921. }
  3922. #pragma warning (default:4113)