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.

1669 lines
52 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. config.cpp
  5. Abstract:
  6. TAPI Service Provider functions related to tsp config.
  7. TSPI_providerConfig
  8. TUISPI_providerConfig
  9. Author:
  10. Nikhil Bobde (NikhilB)
  11. Revision History:
  12. --*/
  13. //
  14. // Include files
  15. //
  16. #include "globals.h"
  17. #include "line.h"
  18. #include "config.h"
  19. #include "ras.h"
  20. #include "q931obj.h"
  21. extern RAS_CLIENT g_RasClient;
  22. extern Q931_LISTENER Q931Listener;
  23. TUISPIDLLCALLBACK g_pfnUIDLLCallback = NULL;
  24. typedef struct _H323_DIALOG_DATA
  25. {
  26. DWORD dwRegState;
  27. WORD wListenPort;
  28. } H323_DIALOG_DATA, *PH323_DIALOG_DATA;
  29. //
  30. // Public procedures
  31. //
  32. INT_PTR
  33. CALLBACK
  34. ProviderConfigDlgProc(
  35. HWND hDlg,
  36. UINT uMsg,
  37. WPARAM wParam,
  38. LPARAM lParam
  39. )
  40. {
  41. HKEY hKey;
  42. LONG lStatus;
  43. DWORD dwValue;
  44. DWORD dwValueSize;
  45. DWORD dwValueType;
  46. DWORD dwGKEnabled;
  47. LPTSTR pszValue;
  48. TCHAR szAddr[H323_MAXPATHNAMELEN+1];
  49. char szValue[H323_MAXPATHNAMELEN+1];
  50. TCHAR szErrorMsg[H323_MAXPATHNAMELEN];
  51. H323_DIALOG_DATA DialogData;
  52. DWORD dwTimeoutValue;
  53. DWORD dwPortValue;
  54. static const DWORD IDD_GATEWAY_HelpIDs[]=
  55. {
  56. IDC_GATEWAY_GROUP, IDH_H323SP_USE_GATEWAY, // group
  57. IDC_USEGATEWAY, IDH_H323SP_USE_GATEWAY, // checkbox
  58. IDC_H323_GATEWAY, IDH_H323SP_USE_GATEWAY_COMPUTER, // edit box
  59. IDC_PROXY_GROUP, IDH_H323SP_USE_PROXY, // group
  60. IDC_USEPROXY, IDH_H323SP_USE_PROXY, // checkbox
  61. IDC_H323_PROXY, IDH_H323SP_USE_PROXY_COMPUTER, // edit box
  62. IDC_GK_GROUP, IDH_H323SP_GK_GROUP,
  63. IDC_H323_GK, IDH_H323SP_GK,
  64. IDC_H323_GK_PHONE, IDH_H323SP_GK_PHONE,
  65. IDC_H323_GK_ACCT, IDH_H323SP_GK_ACCT,
  66. IDC_USEGK, IDH_H323SP_USEGK,
  67. IDC_USEGK_PHONE, IDH_H323SP_USEGK_PHONE,
  68. IDC_USEGK_ACCT, IDH_H323SP_USEGK_ACCT,
  69. IDC_REGSTATE, IDH_H323SP_REGSTATE,
  70. IDUPDATE, IDH_H323SP_UPDATE_REGISTRATION_STATE,
  71. IDC_CC_GROUP, IDH_H323SP_CC_GROUP,
  72. IDC_H323_CALL_TIMEOUT, IDH_H323SP_CALL_TIMEOUT,
  73. IDC_STATIC1, IDH_H323SP_CALL_TIMEOUT,
  74. IDC_H323_CALL_PORT, IDH_H323SP_CALL_PORT,
  75. IDC_STATIC2, IDH_H323SP_CALL_PORT,
  76. IDC_LISTENPORT, IDH_H323SP_CURRENT_LISTENPORT,
  77. IDC_STATIC3, IDH_H323SP_CURRENT_LISTENPORT,
  78. IDUPDATE_PORT, IDH_H323SP_UPDATE_PORT,
  79. IDC_STATIC, IDH_NOHELP, // graphic(s)
  80. 0, 0
  81. };
  82. // decode
  83. switch (uMsg)
  84. {
  85. case WM_HELP:
  86. // F1 key or the "?" button is pressed
  87. (void) WinHelp(
  88. (HWND)(((LPHELPINFO) lParam)->hItemHandle),
  89. H323SP_HELP_FILE,
  90. HELP_WM_HELP,
  91. (DWORD_PTR) (LPVOID)IDD_GATEWAY_HelpIDs
  92. );
  93. break;
  94. case WM_CONTEXTMENU:
  95. // Right-mouse click on a dialog control
  96. (void) WinHelp(
  97. (HWND) wParam,
  98. H323SP_HELP_FILE,
  99. HELP_CONTEXTMENU,
  100. (DWORD_PTR) (LPVOID) IDD_GATEWAY_HelpIDs
  101. );
  102. break;
  103. case WM_INITDIALOG:
  104. lStatus = (*g_pfnUIDLLCallback)(
  105. g_dwPermanentProviderID,
  106. TUISPIDLL_OBJECT_PROVIDERID,
  107. (LPVOID)&DialogData,
  108. sizeof(DialogData) );
  109. // validate status
  110. if( lStatus == NOERROR )
  111. {
  112. if( DialogData.dwRegState == RAS_REGISTER_STATE_REGISTERED )
  113. {
  114. // load status string
  115. LoadString(g_hInstance,
  116. IDS_REGISTERED,
  117. szErrorMsg,
  118. H323_MAXPATHNAMELEN
  119. );
  120. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  121. }
  122. else if( DialogData.dwRegState == RAS_REGISTER_STATE_RRQSENT )
  123. {
  124. // load status string
  125. LoadString(g_hInstance,
  126. IDS_REGISTRATION_INPROGRESS,
  127. szErrorMsg,
  128. H323_MAXPATHNAMELEN
  129. );
  130. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  131. }
  132. else
  133. {
  134. // load status string
  135. LoadString(g_hInstance,
  136. IDS_NOT_REGISTERED,
  137. szErrorMsg,
  138. H323_MAXPATHNAMELEN
  139. );
  140. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  141. }
  142. if( DialogData.wListenPort != 0 )
  143. {
  144. SetDlgItemInt( hDlg, IDC_LISTENPORT, DialogData.wListenPort,
  145. FALSE );
  146. }
  147. else
  148. {
  149. // load status string
  150. LoadString( g_hInstance,
  151. IDS_NONE,
  152. szErrorMsg,
  153. H323_MAXPATHNAMELEN
  154. );
  155. SetDlgItemText( hDlg, IDC_LISTENPORT, szErrorMsg );
  156. }
  157. }
  158. else
  159. {
  160. H323DBG(( DEBUG_LEVEL_ERROR,
  161. "error 0x%08lx reading dialog data.\n", lStatus ));
  162. // load status string
  163. LoadString( g_hInstance,
  164. IDS_NOT_REGISTERED,
  165. szErrorMsg,
  166. H323_MAXPATHNAMELEN
  167. );
  168. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  169. // load status string
  170. LoadString( g_hInstance,
  171. IDS_NONE,
  172. szErrorMsg,
  173. H323_MAXPATHNAMELEN
  174. );
  175. SetDlgItemText( hDlg, IDC_LISTENPORT, szErrorMsg );
  176. }
  177. // open registry subkey
  178. lStatus = RegOpenKeyEx(
  179. HKEY_LOCAL_MACHINE,
  180. H323_REGKEY_ROOT,
  181. 0,
  182. KEY_READ,
  183. &hKey
  184. );
  185. // validate return code
  186. if (lStatus != ERROR_SUCCESS)
  187. {
  188. H323DBG(( DEBUG_LEVEL_WARNING,
  189. "error 0x%08lx opening tsp registry key.", lStatus ));
  190. // load error string
  191. LoadString(g_hInstance,
  192. IDS_REGOPENKEY,
  193. szErrorMsg,
  194. H323_MAXPATHNAMELEN
  195. );
  196. // pop up error dialog
  197. MessageBox(hDlg,szErrorMsg,NULL,MB_OK);
  198. // stop dialog
  199. EndDialog(hDlg, 0);
  200. break;
  201. }
  202. // initialize value name
  203. pszValue = H323_REGVAL_Q931ALERTINGTIMEOUT;
  204. // initialize type
  205. dwValueType = REG_DWORD;
  206. dwValueSize = sizeof(DWORD);
  207. // query for registry value
  208. lStatus = RegQueryValueEx(
  209. hKey,
  210. pszValue,
  211. NULL,
  212. &dwValueType,
  213. (LPBYTE)&dwValue,
  214. &dwValueSize
  215. );
  216. // validate return code
  217. if( lStatus == ERROR_SUCCESS )
  218. {
  219. if( (dwValue >= 30000) && (dwValue <= CALL_ALERTING_TIMEOUT) )
  220. {
  221. SetDlgItemInt( hDlg, IDC_H323_CALL_TIMEOUT, dwValue, FALSE );
  222. }
  223. }
  224. else
  225. {
  226. SetDlgItemInt( hDlg, IDC_H323_CALL_TIMEOUT, CALL_ALERTING_TIMEOUT,
  227. FALSE );
  228. }
  229. // initialize value name
  230. pszValue = H323_REGVAL_Q931LISTENPORT;
  231. // initialize type
  232. dwValueType = REG_DWORD;
  233. dwValueSize = sizeof(DWORD);
  234. // query for registry value
  235. lStatus = RegQueryValueEx(
  236. hKey,
  237. pszValue,
  238. NULL,
  239. &dwValueType,
  240. (LPBYTE)&dwValue,
  241. &dwValueSize
  242. );
  243. // validate return code
  244. if( lStatus == ERROR_SUCCESS )
  245. {
  246. if( (dwValue >= 1000) && (dwValue <= 32000) )
  247. {
  248. SetDlgItemInt( hDlg, IDC_H323_CALL_PORT, dwValue, FALSE );
  249. }
  250. }
  251. else
  252. {
  253. SetDlgItemInt( hDlg, IDC_H323_CALL_PORT, Q931_CALL_PORT, FALSE );
  254. }
  255. // initialize value name
  256. pszValue = H323_REGVAL_GATEWAYADDR;
  257. // initialize type
  258. dwValueType = REG_SZ;
  259. dwValueSize = sizeof(szAddr);
  260. // query for registry value
  261. lStatus = RegQueryValueEx(
  262. hKey,
  263. pszValue,
  264. NULL,
  265. &dwValueType,
  266. (LPBYTE)szAddr,
  267. &dwValueSize
  268. );
  269. // validate return code
  270. if( lStatus == ERROR_SUCCESS )
  271. {
  272. // display gateway address
  273. SetDlgItemText(hDlg,IDC_H323_GATEWAY,szAddr);
  274. }
  275. // initialize value name
  276. pszValue = H323_REGVAL_GATEWAYENABLED;
  277. // initialize type
  278. dwValueType = REG_DWORD;
  279. dwValueSize = sizeof(DWORD);
  280. // query for registry value
  281. lStatus = RegQueryValueEx(
  282. hKey,
  283. pszValue,
  284. NULL,
  285. &dwValueType,
  286. (LPBYTE)&dwValue,
  287. &dwValueSize
  288. );
  289. // validate return code
  290. if (lStatus != ERROR_SUCCESS)
  291. {
  292. // default
  293. dwValue = 0;
  294. }
  295. // enable check box
  296. SendDlgItemMessage(
  297. hDlg,
  298. IDC_USEGATEWAY,
  299. BM_SETCHECK,
  300. (dwValue != 0),
  301. 0
  302. );
  303. // display string
  304. EnableWindow( GetDlgItem(hDlg,IDC_H323_GATEWAY), (dwValue != 0) );
  305. // initialize value name
  306. pszValue = H323_REGVAL_PROXYADDR;
  307. // initialize type
  308. dwValueType = REG_SZ;
  309. dwValueSize = sizeof(szAddr);
  310. // query for registry value
  311. lStatus = RegQueryValueEx(
  312. hKey,
  313. pszValue,
  314. NULL,
  315. &dwValueType,
  316. (LPBYTE)szAddr,
  317. &dwValueSize
  318. );
  319. // validate return code
  320. if (lStatus == ERROR_SUCCESS)
  321. {
  322. // display gateway address
  323. SetDlgItemText(hDlg,IDC_H323_PROXY,szAddr);
  324. }
  325. // initialize value name
  326. pszValue = H323_REGVAL_PROXYENABLED;
  327. // initialize type
  328. dwValueType = REG_DWORD;
  329. dwValueSize = sizeof(DWORD);
  330. // query for registry value
  331. lStatus = RegQueryValueEx(
  332. hKey,
  333. pszValue,
  334. NULL,
  335. &dwValueType,
  336. (LPBYTE)&dwValue,
  337. &dwValueSize
  338. );
  339. // validate return code
  340. if (lStatus != ERROR_SUCCESS)
  341. {
  342. // default
  343. dwValue = 0;
  344. }
  345. // enable check box
  346. SendDlgItemMessage(
  347. hDlg,
  348. IDC_USEPROXY,
  349. BM_SETCHECK,
  350. (dwValue != 0),
  351. 0
  352. );
  353. // display string
  354. EnableWindow(
  355. GetDlgItem(hDlg,IDC_H323_PROXY),
  356. (dwValue != 0) );
  357. /////////////////////////////////////////////////////////////////////
  358. //GK log on phone number
  359. /////////////////////////////////////////////////////////////////////
  360. // initialize value name
  361. pszValue = H323_REGVAL_GKLOGON_PHONE;
  362. // initialize type
  363. dwValueType = REG_SZ;
  364. dwValueSize = sizeof(szAddr);
  365. // query for registry value
  366. lStatus = RegQueryValueEx(
  367. hKey,
  368. pszValue,
  369. NULL,
  370. &dwValueType,
  371. (LPBYTE)szAddr,
  372. &dwValueSize );
  373. // validate return code
  374. if (lStatus == ERROR_SUCCESS)
  375. {
  376. // display gateway address
  377. SetDlgItemText(hDlg,IDC_H323_GK_PHONE,szAddr);
  378. }
  379. // initialize value name
  380. pszValue = H323_REGVAL_GKLOGON_PHONEENABLED;
  381. // initialize type
  382. dwValueType = REG_DWORD;
  383. dwValueSize = sizeof(DWORD);
  384. // query for registry value
  385. lStatus = RegQueryValueEx(
  386. hKey,
  387. pszValue,
  388. NULL,
  389. &dwValueType,
  390. (LPBYTE)&dwValue,
  391. &dwValueSize );
  392. // validate return code
  393. if( lStatus != ERROR_SUCCESS )
  394. {
  395. // default
  396. dwValue = 0;
  397. }
  398. // enable check box
  399. SendDlgItemMessage(
  400. hDlg,
  401. IDC_USEGK_PHONE,
  402. BM_SETCHECK,
  403. (dwValue != 0),
  404. 0 );
  405. // display string
  406. EnableWindow( GetDlgItem(hDlg,IDC_H323_GK_PHONE), (dwValue != 0) );
  407. /////////////////////////////////////////////////////////////////////
  408. //GK log on account name
  409. /////////////////////////////////////////////////////////////////////
  410. // initialize value name
  411. pszValue = H323_REGVAL_GKLOGON_ACCOUNT;
  412. // initialize type
  413. dwValueType = REG_SZ;
  414. dwValueSize = sizeof(szAddr);
  415. // query for registry value
  416. lStatus = RegQueryValueEx(
  417. hKey,
  418. pszValue,
  419. NULL,
  420. &dwValueType,
  421. (LPBYTE)szAddr,
  422. &dwValueSize );
  423. // validate return code
  424. if (lStatus == ERROR_SUCCESS)
  425. {
  426. // display gateway address
  427. SetDlgItemText(hDlg,IDC_H323_GK_ACCT,szAddr);
  428. }
  429. // initialize value name
  430. pszValue = H323_REGVAL_GKLOGON_ACCOUNTENABLED;
  431. // initialize type
  432. dwValueType = REG_DWORD;
  433. dwValueSize = sizeof(DWORD);
  434. // query for registry value
  435. lStatus = RegQueryValueEx(
  436. hKey,
  437. pszValue,
  438. NULL,
  439. &dwValueType,
  440. (LPBYTE)&dwValue,
  441. &dwValueSize
  442. );
  443. // validate return code
  444. if (lStatus != ERROR_SUCCESS)
  445. {
  446. // default
  447. dwValue = 0;
  448. }
  449. // enable check box
  450. SendDlgItemMessage(
  451. hDlg,
  452. IDC_USEGK_ACCT,
  453. BM_SETCHECK,
  454. (dwValue != 0),
  455. 0
  456. );
  457. // display string
  458. EnableWindow(
  459. GetDlgItem(hDlg,IDC_H323_GK_ACCT),
  460. (dwValue != 0)
  461. );
  462. /////////////////////////////////////////////////////////////////////
  463. //GK address
  464. /////////////////////////////////////////////////////////////////////
  465. // initialize value name
  466. pszValue = H323_REGVAL_GKADDR;
  467. // initialize type
  468. dwValueType = REG_SZ;
  469. dwValueSize = sizeof(szAddr);
  470. // query for registry value
  471. lStatus = RegQueryValueEx(
  472. hKey,
  473. pszValue,
  474. NULL,
  475. &dwValueType,
  476. (LPBYTE)szAddr,
  477. &dwValueSize
  478. );
  479. // validate return code
  480. if (lStatus == ERROR_SUCCESS)
  481. {
  482. // display gateway address
  483. SetDlgItemText(hDlg,IDC_H323_GK,szAddr);
  484. }
  485. // initialize value name
  486. pszValue = H323_REGVAL_GKENABLED;
  487. // initialize type
  488. dwValueType = REG_DWORD;
  489. dwValueSize = sizeof(DWORD);
  490. // query for registry value
  491. lStatus = RegQueryValueEx(
  492. hKey,
  493. pszValue,
  494. NULL,
  495. &dwValueType,
  496. (LPBYTE)&dwValue,
  497. &dwValueSize
  498. );
  499. // validate return code
  500. if (lStatus != ERROR_SUCCESS)
  501. {
  502. // default
  503. dwValue = 0;
  504. }
  505. // enable check box
  506. SendDlgItemMessage(
  507. hDlg,
  508. IDC_USEGK,
  509. BM_SETCHECK,
  510. (dwValue != 0),
  511. 0
  512. );
  513. // display string if check box enabled
  514. EnableWindow(GetDlgItem(hDlg,IDC_H323_GK), (dwValue != 0) );
  515. // display log on info
  516. EnableWindow( GetDlgItem(hDlg,IDC_GK_LOGONGROUP), (dwValue != 0) );
  517. EnableWindow( GetDlgItem(hDlg,IDC_H323_GK_PHONE),
  518. (dwValue != 0) && SendDlgItemMessage(hDlg,
  519. IDC_USEGK_PHONE,
  520. BM_GETCHECK,
  521. (WPARAM)0,
  522. (LPARAM)0 ) );
  523. EnableWindow( GetDlgItem(hDlg,IDC_H323_GK_ACCT),
  524. (dwValue != 0) && SendDlgItemMessage(hDlg,
  525. IDC_USEGK_ACCT,
  526. BM_GETCHECK,
  527. (WPARAM)0,
  528. (LPARAM)0 ) );
  529. EnableWindow( GetDlgItem(hDlg,IDC_USEGK_PHONE), (dwValue != 0) );
  530. EnableWindow( GetDlgItem(hDlg,IDC_USEGK_ACCT), (dwValue != 0) );
  531. //disable the GW if GK enabled and vice versa
  532. EnableWindow( GetDlgItem(hDlg,IDC_PROXY_GROUP), (dwValue == 0) );
  533. EnableWindow( GetDlgItem(hDlg,IDC_USEPROXY), (dwValue == 0) );
  534. EnableWindow( GetDlgItem(hDlg,IDC_H323_PROXY),
  535. (dwValue == 0) && SendDlgItemMessage(hDlg,
  536. IDC_USEPROXY,
  537. BM_GETCHECK,
  538. (WPARAM)0,
  539. (LPARAM)0 ) );
  540. //disable the proxy if GK enabled and vice versa
  541. EnableWindow( GetDlgItem(hDlg,IDC_GATEWAY_GROUP), (dwValue == 0) );
  542. EnableWindow( GetDlgItem(hDlg,IDC_USEGATEWAY), (dwValue == 0) );
  543. EnableWindow( GetDlgItem(hDlg,IDC_H323_GATEWAY),
  544. (dwValue == 0) && SendDlgItemMessage(hDlg,
  545. IDC_USEGATEWAY,
  546. BM_GETCHECK,
  547. (WPARAM)0,
  548. (LPARAM)0 ) );
  549. // close registry
  550. RegCloseKey(hKey);
  551. break;
  552. case WM_COMMAND:
  553. // decode command
  554. switch (LOWORD(wParam))
  555. {
  556. case IDAPPLY:
  557. case IDOK:
  558. //if GK is enabled at least one of the log on options should be enabled
  559. dwGKEnabled = !!SendDlgItemMessage(
  560. hDlg,
  561. IDC_USEGK,
  562. BM_GETCHECK,
  563. (WPARAM)0,
  564. (LPARAM)0 );
  565. if( dwGKEnabled != 0 )
  566. {
  567. if(
  568. !SendDlgItemMessage(hDlg, IDC_USEGK_PHONE, BM_GETCHECK, (WPARAM)0, (LPARAM)0 ) &&
  569. !SendDlgItemMessage(hDlg, IDC_USEGK_ACCT, BM_GETCHECK, (WPARAM)0, (LPARAM)0 )
  570. )
  571. {
  572. //load error string
  573. LoadString(g_hInstance,
  574. IDS_GKLOGON_ERROR,
  575. szErrorMsg,
  576. H323_MAXPATHNAMELEN );
  577. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  578. //return failure
  579. return TRUE;
  580. }
  581. }
  582. dwTimeoutValue = GetDlgItemInt( hDlg,
  583. IDC_H323_CALL_TIMEOUT,
  584. NULL,
  585. FALSE );
  586. if( (dwTimeoutValue < 30000) || (dwTimeoutValue > CALL_ALERTING_TIMEOUT) )
  587. {
  588. //load error string
  589. LoadString(g_hInstance,
  590. IDS_ALERTTIMEOUT_ERROR,
  591. szErrorMsg,
  592. H323_MAXPATHNAMELEN );
  593. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  594. //return failure
  595. return TRUE;
  596. }
  597. dwPortValue = GetDlgItemInt( hDlg,
  598. IDC_H323_CALL_PORT,
  599. NULL,
  600. FALSE );
  601. if( (dwPortValue < 1000) || (dwPortValue > 32000) )
  602. {
  603. //load error string
  604. LoadString(g_hInstance,
  605. IDS_LISTENPORT_ERROR,
  606. szErrorMsg,
  607. H323_MAXPATHNAMELEN );
  608. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  609. //return failure
  610. return TRUE;
  611. }
  612. // open registry subkey
  613. lStatus = RegOpenKeyEx(
  614. HKEY_LOCAL_MACHINE,
  615. H323_REGKEY_ROOT,
  616. 0,
  617. KEY_WRITE,
  618. &hKey
  619. );
  620. // validate return code
  621. if (lStatus != ERROR_SUCCESS)
  622. {
  623. H323DBG((
  624. DEBUG_LEVEL_WARNING,
  625. "error 0x%08lx opening tsp registry key.",
  626. lStatus ));
  627. // load error string
  628. LoadString(g_hInstance,
  629. IDS_REGOPENKEY,
  630. szErrorMsg,
  631. H323_MAXPATHNAMELEN
  632. );
  633. // pop up error dialog
  634. MessageBox(hDlg,szErrorMsg,NULL,MB_OK);
  635. // stop dialog
  636. EndDialog(hDlg, 0);
  637. break;
  638. }
  639. // initialize value name
  640. pszValue = H323_REGVAL_Q931ALERTINGTIMEOUT;
  641. // initialize type
  642. dwValueType = REG_DWORD;
  643. dwValueSize = sizeof(DWORD);
  644. // query for registry value
  645. lStatus = RegSetValueEx(
  646. hKey,
  647. pszValue,
  648. 0,
  649. dwValueType,
  650. (LPBYTE)&dwTimeoutValue,
  651. dwValueSize
  652. );
  653. // validate return code
  654. if (lStatus != ERROR_SUCCESS)
  655. {
  656. H323DBG(( DEBUG_LEVEL_ERROR,
  657. "error 0x%08lx writing alerting timeout.",
  658. lStatus ));
  659. }
  660. // initialize value name
  661. pszValue = H323_REGVAL_Q931LISTENPORT;
  662. // initialize type
  663. dwValueType = REG_DWORD;
  664. dwValueSize = sizeof(DWORD);
  665. // query for registry value
  666. lStatus = RegSetValueEx(
  667. hKey,
  668. pszValue,
  669. 0,
  670. dwValueType,
  671. (LPBYTE)&dwPortValue,
  672. dwValueSize
  673. );
  674. // validate return code
  675. if (lStatus != ERROR_SUCCESS)
  676. {
  677. H323DBG(( DEBUG_LEVEL_ERROR,
  678. "error 0x%08lx writing alerting timeout.",
  679. lStatus ));
  680. }
  681. // initialize value name
  682. pszValue = H323_REGVAL_GATEWAYADDR;
  683. // retrieve gateway address from dialog
  684. GetDlgItemText(hDlg,IDC_H323_GATEWAY,szAddr, H323_MAXDESTNAMELEN );
  685. // initialize type
  686. dwValueType = REG_SZ;
  687. dwValueSize = (wcslen(szAddr) + 1) * sizeof(WCHAR);
  688. // query for registry value
  689. lStatus = RegSetValueEx(
  690. hKey,
  691. pszValue,
  692. 0,
  693. dwValueType,
  694. (LPBYTE)szAddr,
  695. dwValueSize
  696. );
  697. // validate return code
  698. if (lStatus != ERROR_SUCCESS)
  699. {
  700. H323DBG((
  701. DEBUG_LEVEL_ERROR,
  702. "error 0x%08lx writing gateway address.",
  703. lStatus
  704. ));
  705. }
  706. // initialize value name
  707. pszValue = H323_REGVAL_GATEWAYENABLED;
  708. // initialize type
  709. dwValueType = REG_DWORD;
  710. dwValueSize = sizeof(DWORD);
  711. // examine check box
  712. dwValue = SendDlgItemMessage(
  713. hDlg,
  714. IDC_USEGATEWAY,
  715. BM_GETCHECK,
  716. 0,
  717. 0
  718. ) ? 1 : 0;
  719. if( (dwValue!=0) && (wcslen(szAddr)==0) &&
  720. !SendDlgItemMessage(hDlg,IDC_USEGK,BM_GETCHECK,0,0) )
  721. {
  722. // load error string
  723. LoadString(g_hInstance,
  724. IDS_GWALIAS_ERROR,
  725. szErrorMsg,
  726. H323_MAXPATHNAMELEN
  727. );
  728. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  729. //return failure
  730. return TRUE;
  731. }
  732. // query for registry value
  733. lStatus = RegSetValueEx(
  734. hKey,
  735. pszValue,
  736. 0,
  737. dwValueType,
  738. (LPBYTE)&dwValue,
  739. dwValueSize
  740. );
  741. // validate return code
  742. if (lStatus != ERROR_SUCCESS)
  743. {
  744. H323DBG((
  745. DEBUG_LEVEL_ERROR,
  746. "error 0x%08lx writing gateway flag.",
  747. lStatus
  748. ));
  749. }
  750. // initialize value name
  751. pszValue = H323_REGVAL_PROXYADDR;
  752. // retrieve gateway address from dialog
  753. GetDlgItemText(hDlg,IDC_H323_PROXY,szAddr, H323_MAXDESTNAMELEN );
  754. // initialize type
  755. dwValueType = REG_SZ;
  756. dwValueSize = (wcslen(szAddr) + 1) * sizeof(WCHAR);
  757. // query for registry value
  758. lStatus = RegSetValueEx(
  759. hKey,
  760. pszValue,
  761. 0,
  762. dwValueType,
  763. (LPBYTE)szAddr,
  764. dwValueSize
  765. );
  766. // validate return code
  767. if (lStatus != ERROR_SUCCESS)
  768. {
  769. H323DBG((
  770. DEBUG_LEVEL_ERROR,
  771. "error 0x%08lx writing proxy address.",
  772. lStatus
  773. ));
  774. }
  775. // initialize value name
  776. pszValue = H323_REGVAL_PROXYENABLED;
  777. // initialize type
  778. dwValueType = REG_DWORD;
  779. dwValueSize = sizeof(DWORD);
  780. // examine check box
  781. dwValue = SendDlgItemMessage(
  782. hDlg,
  783. IDC_USEPROXY,
  784. BM_GETCHECK,
  785. 0,
  786. 0
  787. ) ? 1 : 0;
  788. if( (dwValue!=0) && (wcslen(szAddr)==0) &&
  789. !SendDlgItemMessage(hDlg,IDC_USEGK,BM_GETCHECK,0,0) )
  790. {
  791. // load error string
  792. LoadString(g_hInstance,
  793. IDS_PROXYALIAS_ERROR,
  794. szErrorMsg,
  795. H323_MAXPATHNAMELEN
  796. );
  797. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  798. //return failure
  799. return TRUE;
  800. }
  801. // query for registry value
  802. lStatus = RegSetValueEx(
  803. hKey,
  804. pszValue,
  805. 0,
  806. dwValueType,
  807. (LPBYTE)&dwValue,
  808. dwValueSize
  809. );
  810. // validate return code
  811. if (lStatus != ERROR_SUCCESS)
  812. {
  813. H323DBG((
  814. DEBUG_LEVEL_ERROR,
  815. "error 0x%08lx writing proxy flag.",
  816. lStatus
  817. ));
  818. }
  819. /////////////////////////////////////////////////////////////////////
  820. //GK address
  821. /////////////////////////////////////////////////////////////////////
  822. // initialize value name
  823. pszValue = H323_REGVAL_GKADDR;
  824. // retrieve gateway address from dialog
  825. GetDlgItemText(hDlg,IDC_H323_GK,szAddr, H323_MAXDESTNAMELEN);
  826. // initialize type
  827. dwValueType = REG_SZ;
  828. dwValueSize = (wcslen(szAddr) + 1) * sizeof(WCHAR);
  829. // query for registry value
  830. lStatus = RegSetValueEx(
  831. hKey,
  832. pszValue,
  833. 0,
  834. dwValueType,
  835. (LPBYTE)szAddr,
  836. dwValueSize
  837. );
  838. // validate return code
  839. if (lStatus != ERROR_SUCCESS)
  840. {
  841. H323DBG((
  842. DEBUG_LEVEL_ERROR,
  843. "error 0x%08lx writing gatekeeper address.",
  844. lStatus
  845. ));
  846. }
  847. // initialize value name
  848. pszValue = H323_REGVAL_GKENABLED;
  849. // initialize type
  850. dwValueType = REG_DWORD;
  851. dwValueSize = sizeof(DWORD);
  852. if( dwGKEnabled && (wcslen(szAddr)==0) )
  853. {
  854. // load error string
  855. LoadString(g_hInstance,
  856. IDS_GKALIAS_ERROR,
  857. szErrorMsg,
  858. H323_MAXPATHNAMELEN
  859. );
  860. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  861. //return failure
  862. return TRUE;
  863. }
  864. // query for registry value
  865. lStatus = RegSetValueEx(
  866. hKey,
  867. pszValue,
  868. 0,
  869. dwValueType,
  870. (LPBYTE)&dwGKEnabled,
  871. dwValueSize
  872. );
  873. // validate return code
  874. if (lStatus != ERROR_SUCCESS)
  875. {
  876. H323DBG((
  877. DEBUG_LEVEL_ERROR,
  878. "error 0x%08lx writing gatekeeper flag.",
  879. lStatus
  880. ));
  881. }
  882. /////////////////////////////////////////////////////////////////////
  883. //GK log on phone
  884. /////////////////////////////////////////////////////////////////////
  885. // initialize value name
  886. pszValue = H323_REGVAL_GKLOGON_PHONEENABLED;
  887. // initialize type
  888. dwValueType = REG_DWORD;
  889. dwValueSize = sizeof(DWORD);
  890. // examine check box
  891. dwValue = SendDlgItemMessage(
  892. hDlg,
  893. IDC_USEGK_PHONE,
  894. BM_GETCHECK,
  895. 0,
  896. 0
  897. ) ? 1 : 0;
  898. // query for registry value
  899. lStatus = RegSetValueEx(
  900. hKey,
  901. pszValue,
  902. 0,
  903. dwValueType,
  904. (LPBYTE)&dwValue,
  905. dwValueSize
  906. );
  907. // validate return code
  908. if (lStatus != ERROR_SUCCESS)
  909. {
  910. H323DBG((
  911. DEBUG_LEVEL_ERROR,
  912. "error 0x%08lx writing gatekeeper flag.",
  913. lStatus
  914. ));
  915. }
  916. // initialize value name
  917. pszValue = H323_REGVAL_GKLOGON_PHONE;
  918. // retrieve gateway address from dialog
  919. GetDlgItemText(hDlg,IDC_H323_GK_PHONE,szAddr, H323_MAXDESTNAMELEN);
  920. // initialize type
  921. dwValueType = REG_SZ;
  922. dwValueSize = (wcslen(szAddr) + 1) * sizeof(WCHAR);
  923. //check if logon-phone option is enabled and logon-phone alias is empty
  924. if( dwGKEnabled && dwValue && (dwValueSize == sizeof(WCHAR)) )
  925. {
  926. // load error string
  927. LoadString(g_hInstance,
  928. IDS_GKLOGON_PHONEALIAS_ERROR,
  929. szErrorMsg,
  930. H323_MAXPATHNAMELEN
  931. );
  932. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  933. //return failure
  934. return TRUE;
  935. }
  936. //validate e164
  937. if( IsValidE164String(szAddr) == FALSE )
  938. {
  939. // load error string
  940. LoadString(g_hInstance,
  941. IDS_PHONEALIAS_ERROR,
  942. szErrorMsg,
  943. H323_MAXPATHNAMELEN
  944. );
  945. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  946. //return failure
  947. return TRUE;
  948. }
  949. // query for registry value
  950. lStatus = RegSetValueEx(
  951. hKey,
  952. pszValue,
  953. 0,
  954. dwValueType,
  955. (LPBYTE)szAddr,
  956. dwValueSize
  957. );
  958. // validate return code
  959. if (lStatus != ERROR_SUCCESS)
  960. {
  961. H323DBG((
  962. DEBUG_LEVEL_ERROR,
  963. "error 0x%08lx writing gatekeeper address.",
  964. lStatus
  965. ));
  966. }
  967. /////////////////////////////////////////////////////////////////////
  968. //GK log on account
  969. /////////////////////////////////////////////////////////////////////
  970. // initialize value name
  971. pszValue = H323_REGVAL_GKLOGON_ACCOUNTENABLED;
  972. // initialize type
  973. dwValueType = REG_DWORD;
  974. dwValueSize = sizeof(DWORD);
  975. // examine check box
  976. dwValue = SendDlgItemMessage(
  977. hDlg,
  978. IDC_USEGK_ACCT,
  979. BM_GETCHECK,
  980. 0,
  981. 0
  982. ) ? 1 : 0;
  983. // query for registry value
  984. lStatus = RegSetValueEx(
  985. hKey,
  986. pszValue,
  987. 0,
  988. dwValueType,
  989. (LPBYTE)&dwValue,
  990. dwValueSize
  991. );
  992. // validate return code
  993. if (lStatus != ERROR_SUCCESS)
  994. {
  995. H323DBG((
  996. DEBUG_LEVEL_ERROR,
  997. "error 0x%08lx writing gatekeeper flag.",
  998. lStatus
  999. ));
  1000. }
  1001. // initialize value name
  1002. pszValue = H323_REGVAL_GKLOGON_ACCOUNT;
  1003. // retrieve gateway address from dialog
  1004. GetDlgItemText(hDlg,IDC_H323_GK_ACCT,szAddr, H323_MAXDESTNAMELEN );
  1005. // initialize type
  1006. dwValueType = REG_SZ;
  1007. dwValueSize = (wcslen(szAddr) + 1) * sizeof(WCHAR);
  1008. //check if logon-acct option is enabled and logon-acct alias in empty
  1009. if( dwGKEnabled && dwValue && (dwValueSize==sizeof(WCHAR)) )
  1010. {
  1011. // load error string
  1012. LoadString(g_hInstance,
  1013. IDS_GKLOGON_ACCTALIAS_ERROR,
  1014. szErrorMsg,
  1015. H323_MAXPATHNAMELEN
  1016. );
  1017. MessageBox( hDlg, szErrorMsg, NULL, MB_OK );
  1018. //return failure
  1019. return TRUE;
  1020. }
  1021. // query for registry value
  1022. lStatus = RegSetValueEx(
  1023. hKey,
  1024. pszValue,
  1025. 0,
  1026. dwValueType,
  1027. (LPBYTE)szAddr,
  1028. dwValueSize
  1029. );
  1030. // validate return code
  1031. if (lStatus != ERROR_SUCCESS)
  1032. {
  1033. H323DBG((
  1034. DEBUG_LEVEL_ERROR,
  1035. "error 0x%08lx writing gatekeeper address.",
  1036. lStatus
  1037. ));
  1038. }
  1039. // close registry
  1040. RegCloseKey(hKey);
  1041. if( LOWORD(wParam) == IDOK )
  1042. {
  1043. // close dialog
  1044. EndDialog(hDlg, 0);
  1045. }
  1046. break;
  1047. case IDCANCEL:
  1048. // close dialog
  1049. EndDialog(hDlg, 0);
  1050. break;
  1051. case IDUPDATE:
  1052. lStatus = (*g_pfnUIDLLCallback)(
  1053. g_dwPermanentProviderID,
  1054. TUISPIDLL_OBJECT_PROVIDERID,
  1055. (LPVOID)&DialogData,
  1056. sizeof(DialogData) );
  1057. // validate status
  1058. if( lStatus == NOERROR )
  1059. {
  1060. if( DialogData.dwRegState == RAS_REGISTER_STATE_REGISTERED )
  1061. {
  1062. LoadString( g_hInstance,
  1063. IDS_REGISTERED,
  1064. szErrorMsg,
  1065. H323_MAXPATHNAMELEN
  1066. );
  1067. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  1068. }
  1069. else if( DialogData.dwRegState == RAS_REGISTER_STATE_RRQSENT )
  1070. {
  1071. LoadString( g_hInstance,
  1072. IDS_REGISTRATION_INPROGRESS,
  1073. szErrorMsg,
  1074. H323_MAXPATHNAMELEN
  1075. );
  1076. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  1077. }
  1078. else
  1079. {
  1080. LoadString( g_hInstance,
  1081. IDS_NOT_REGISTERED,
  1082. szErrorMsg,
  1083. H323_MAXPATHNAMELEN
  1084. );
  1085. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  1086. }
  1087. }
  1088. else
  1089. {
  1090. H323DBG(( DEBUG_LEVEL_ERROR,
  1091. "error 0x%08lx reading dialog data.\n", lStatus ));
  1092. LoadString( g_hInstance,
  1093. IDS_NOT_REGISTERED,
  1094. szErrorMsg,
  1095. H323_MAXPATHNAMELEN
  1096. );
  1097. SetDlgItemText( hDlg, IDC_REGSTATE, szErrorMsg );
  1098. }
  1099. break;
  1100. case IDUPDATE_PORT:
  1101. lStatus = (*g_pfnUIDLLCallback)(
  1102. g_dwPermanentProviderID,
  1103. TUISPIDLL_OBJECT_PROVIDERID,
  1104. (LPVOID)&DialogData,
  1105. sizeof(DialogData) );
  1106. // validate status
  1107. if( (lStatus == NOERROR) && (DialogData.wListenPort != 0) )
  1108. {
  1109. SetDlgItemInt( hDlg, IDC_LISTENPORT, DialogData.wListenPort,
  1110. FALSE );
  1111. }
  1112. else
  1113. {
  1114. H323DBG(( DEBUG_LEVEL_FORCE,
  1115. "error 0x%08lx reading dialog data.\n", lStatus ));
  1116. LoadString( g_hInstance,
  1117. IDS_NONE,
  1118. szErrorMsg,
  1119. H323_MAXPATHNAMELEN
  1120. );
  1121. SetDlgItemText( hDlg, IDC_LISTENPORT, szErrorMsg );
  1122. }
  1123. break;
  1124. case IDC_USEGATEWAY:
  1125. // display string if check box enabled
  1126. EnableWindow(GetDlgItem(hDlg,IDC_H323_GATEWAY),
  1127. (BOOL)SendDlgItemMessage(
  1128. hDlg,
  1129. IDC_USEGATEWAY,
  1130. BM_GETCHECK,
  1131. (WPARAM)0,
  1132. (LPARAM)0
  1133. ));
  1134. break;
  1135. case IDC_USEPROXY:
  1136. // display string if check box enabled
  1137. EnableWindow(GetDlgItem(hDlg,IDC_H323_PROXY),
  1138. (BOOL)SendDlgItemMessage(
  1139. hDlg,
  1140. IDC_USEPROXY,
  1141. BM_GETCHECK,
  1142. (WPARAM)0,
  1143. (LPARAM)0
  1144. ));
  1145. break;
  1146. case IDC_USEGK:
  1147. dwValue= !!SendDlgItemMessage(
  1148. hDlg,
  1149. IDC_USEGK,
  1150. BM_GETCHECK,
  1151. (WPARAM)0,
  1152. (LPARAM)0 );
  1153. // display string if check box enabled
  1154. EnableWindow( GetDlgItem( hDlg, IDC_H323_GK ), (dwValue != 0) );
  1155. // display log on info
  1156. EnableWindow( GetDlgItem(hDlg,IDC_GK_LOGONGROUP), (dwValue != 0) );
  1157. EnableWindow( GetDlgItem(hDlg,IDC_H323_GK_PHONE),
  1158. (dwValue != 0) && SendDlgItemMessage(hDlg,
  1159. IDC_USEGK_PHONE,
  1160. BM_GETCHECK,
  1161. (WPARAM)0,
  1162. (LPARAM)0 ) );
  1163. EnableWindow( GetDlgItem(hDlg,IDC_H323_GK_ACCT),
  1164. (dwValue != 0) && SendDlgItemMessage(hDlg,
  1165. IDC_USEGK_ACCT,
  1166. BM_GETCHECK,
  1167. (WPARAM)0,
  1168. (LPARAM)0 ) );
  1169. EnableWindow( GetDlgItem(hDlg,IDC_USEGK_PHONE), (dwValue != 0) );
  1170. EnableWindow( GetDlgItem(hDlg,IDC_USEGK_ACCT), (dwValue != 0) );
  1171. //disable the GW if GK enabled and vice versa
  1172. EnableWindow( GetDlgItem(hDlg,IDC_PROXY_GROUP), (dwValue == 0) );
  1173. EnableWindow( GetDlgItem(hDlg,IDC_USEPROXY), (dwValue == 0) );
  1174. EnableWindow( GetDlgItem(hDlg,IDC_H323_PROXY),
  1175. (dwValue == 0) && SendDlgItemMessage(hDlg,
  1176. IDC_USEPROXY,
  1177. BM_GETCHECK,
  1178. (WPARAM)0,
  1179. (LPARAM)0 ) );
  1180. //disable the proxy if GK enabled and vice versa
  1181. EnableWindow( GetDlgItem(hDlg,IDC_GATEWAY_GROUP), (dwValue == 0) );
  1182. EnableWindow( GetDlgItem(hDlg,IDC_USEGATEWAY), (dwValue == 0) );
  1183. EnableWindow( GetDlgItem(hDlg,IDC_H323_GATEWAY),
  1184. (dwValue == 0) && SendDlgItemMessage(hDlg,
  1185. IDC_USEGATEWAY,
  1186. BM_GETCHECK,
  1187. (WPARAM)0,
  1188. (LPARAM)0 ) );
  1189. break;
  1190. case IDC_USEGK_PHONE:
  1191. // display string if check box enabled
  1192. EnableWindow(GetDlgItem(hDlg,IDC_H323_GK_PHONE),
  1193. (BOOL)SendDlgItemMessage(
  1194. hDlg,
  1195. IDC_USEGK_PHONE,
  1196. BM_GETCHECK,
  1197. (WPARAM)0,
  1198. (LPARAM)0
  1199. ));
  1200. break;
  1201. case IDC_USEGK_ACCT:
  1202. // display string if check box enabled
  1203. EnableWindow(GetDlgItem(hDlg,IDC_H323_GK_ACCT),
  1204. (BOOL)SendDlgItemMessage(
  1205. hDlg,
  1206. IDC_USEGK_ACCT,
  1207. BM_GETCHECK,
  1208. (WPARAM)0,
  1209. (LPARAM)0
  1210. ));
  1211. break;
  1212. }
  1213. break;
  1214. }
  1215. // success
  1216. return FALSE;
  1217. }
  1218. // //
  1219. // TSPI procedures //
  1220. // //
  1221. LONG
  1222. TSPIAPI
  1223. TSPI_providerConfig(
  1224. HWND hwndOwner,
  1225. DWORD dwPermanentProviderID
  1226. )
  1227. /*++
  1228. Routine Description:
  1229. The original TSPI UI-generating functions (TSPI_lineConfigDialog,
  1230. TSPI_lineConfigDialogEdit, TSPI_phoneConfigDialog, TSPI_providerConfig,
  1231. TSPI_providerInstall, and TSPI_providerRemove) are obsolete and will
  1232. never be called by TAPISRV.EXE. However, if the service provider desires
  1233. to be listed as one that can be added by the Telephony control panel,
  1234. it must export TSPI_providerInstall; if it wants to have the Remove
  1235. button enabled in the Telephony CPL when it is selected, it must export
  1236. TSPI_providerRemove, and it if wants the Setup button to be enabled
  1237. in the Telephony CPL when it is selected, it must export
  1238. TSPI_providerConfig.
  1239. The Telephony CPL checks for the presence of these functions in the
  1240. service provider TSP file in order to adjust its user interface to
  1241. reflect which operations can be performed.
  1242. See TUISPI_lineConfigDialog for dialog code.
  1243. Arguments:
  1244. hwndOwner - Specifies the handle of the parent window in which the function
  1245. may create any dialog windows required during the configuration.
  1246. dwPermanentProviderID - Specifies the permanent ID, unique within the
  1247. service providers on this system, of the service provider being
  1248. configured.
  1249. Return Values:
  1250. Returns zero if the request is successful or a negative error number if
  1251. an error has occurred. Possible return values are:
  1252. LINEERR_NOMEM - Unable to allocate or lock memory.
  1253. LINEERR_OPERATIONFAILED - The specified operation failed for unknown
  1254. reasons.
  1255. --*/
  1256. {
  1257. UNREFERENCED_PARAMETER(hwndOwner); // no dialog here
  1258. UNREFERENCED_PARAMETER(dwPermanentProviderID); // not needed anymore
  1259. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_lineProviderConfig - Entered." ));
  1260. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_lineProviderConfig - Exited." ));
  1261. // success
  1262. return NOERROR;
  1263. }
  1264. LONG
  1265. TSPIAPI
  1266. TUISPI_providerConfig(
  1267. TUISPIDLLCALLBACK pfnUIDLLCallback,
  1268. HWND hwndOwner,
  1269. DWORD dwPermanentProviderID
  1270. )
  1271. {
  1272. INT_PTR nResult;
  1273. g_pfnUIDLLCallback = pfnUIDLLCallback;
  1274. g_dwPermanentProviderID = dwPermanentProviderID;
  1275. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_providerConfig - Entered." ));
  1276. // invoke dialog box
  1277. nResult = DialogBoxW(
  1278. g_hInstance,
  1279. MAKEINTRESOURCE(IDD_TSPCONFIG),
  1280. hwndOwner,
  1281. ProviderConfigDlgProc
  1282. );
  1283. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_providerConfig - Exited." ));
  1284. // status based on whether dialog executed properly
  1285. return ((DWORD)nResult == 0) ? NOERROR : LINEERR_OPERATIONFAILED;
  1286. }
  1287. /*++
  1288. Routine Description:
  1289. The TSPI_providerGenericDialogData function delivers to the service
  1290. provider data that was sent from the UI DLL running in an application
  1291. context through the TUISPIDLLCALLBACK function. The contents of the
  1292. memory block pointed to by lpParams is defined by the service provider
  1293. and UI DLL. The service provider can modify the contents of the
  1294. parameter block; when this function returns, TAPI copies the modified
  1295. data back into the original UI DLL parameter block.
  1296. Implementation is mandatory if the UI DLL associated with the service
  1297. provider calls TUISPIDLLCALLBACK.
  1298. Arguments:
  1299. dwObjectID - An object identifer of the type specified by dwObjectType
  1300. dwObjectType - One of the TUISPIDLL_OBJECT_ constants, specifying the
  1301. type of object identified by dwObjectID
  1302. TUISPIDLL_OBJECT_LINEID - dwObjectID is a line device identifier
  1303. (dwDeviceID).
  1304. TUISPIDLL_OBJECT_PHONEID - dwObjectID is a phone device identifier
  1305. (dwDeviceID)
  1306. TUISPIDLL_OBJECT_PROVIDERID - dwObjectID is a permament provider
  1307. identifier.
  1308. TUISPIDLL_OBJECT_DIALOGINSTANCE - dwObjectID is an HDRVDIALOGINSTANCE,
  1309. as returned to the service provider when it sent a
  1310. LINE_CREATEDIALOGINSTANCE message.
  1311. lpParams - Pointer to a memory area used to hold a parameter block. The
  1312. contents of this parameter block are specific to the service provider
  1313. and its associated UI DLL.
  1314. dwSize - The size in bytes of the parameter block.
  1315. Return Values:
  1316. Returns zero if successful, or one of these negative error values:
  1317. LINEERR_INVALPARAM, LINEERR_NOMEM, LINEERR_OPERATIONFAILED
  1318. --*/
  1319. LONG
  1320. TSPIAPI
  1321. TSPI_providerGenericDialogData(
  1322. DWORD_PTR dwObjectID,
  1323. DWORD dwObjectType,
  1324. LPVOID lpParams,
  1325. DWORD dwSize
  1326. )
  1327. {
  1328. PH323_DIALOG_DATA pDialogData = (PH323_DIALOG_DATA)lpParams;
  1329. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_providerGenericDialogData Entered" ));
  1330. if( (dwObjectType != TUISPIDLL_OBJECT_PROVIDERID) ||
  1331. (dwSize != sizeof(H323_DIALOG_DATA))
  1332. )
  1333. {
  1334. H323DBG(( DEBUG_LEVEL_ERROR,
  1335. "Invalid message from dwObjectID 0x%08lx\n", dwObjectID ));
  1336. // failure
  1337. return LINEERR_INVALPARAM;
  1338. }
  1339. //
  1340. // NOTE: if we want to make sure this message is from our UI DLL
  1341. // then we cannot rely on the provider ID since this function may
  1342. // be called before TSPI_providerInit.
  1343. //
  1344. // process command
  1345. pDialogData->dwRegState = g_RasClient.GetRegState();
  1346. pDialogData->wListenPort = Q931Listener.GetListenPort();
  1347. H323DBG(( DEBUG_LEVEL_TRACE, "TSPI_providerGenericDialogData Exited: reg state:%d, listen port:%d",
  1348. pDialogData->dwRegState,
  1349. pDialogData->wListenPort ));
  1350. // success
  1351. return NOERROR;
  1352. }