Source code of Windows XP (NT5)
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.

762 lines
19 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "ncnetcon.h"
  4. #include "ncperms.h"
  5. #include "ncui.h"
  6. #include "lanui.h"
  7. #include "lanhelp.h"
  8. #include <raseapif.h>
  9. #include "eapolui.h"
  10. #include "eapolpage.h"
  11. #include "wzcpage.h"
  12. #include "wzcui.h"
  13. extern const WCHAR c_szNetCfgHelpFile[];
  14. //
  15. // CWLANAuthenticationPage
  16. //
  17. CWLANAuthenticationPage::CWLANAuthenticationPage(
  18. IUnknown* punk,
  19. INetCfg* pnc,
  20. INetConnection* pconn,
  21. const DWORD * adwHelpIDs)
  22. {
  23. TraceFileFunc(ttidLanUi);
  24. m_pconn = pconn;
  25. m_pnc = pnc;
  26. m_fNetcfgInUse = FALSE;
  27. m_adwHelpIDs = adwHelpIDs;
  28. m_pEapolConfig = NULL;
  29. m_pWzcPage = NULL;
  30. }
  31. //+---------------------------------------------------------------------------
  32. //
  33. // Member: CWLANAuthenticationPage::~CWLANAuthenticationPage
  34. //
  35. // Purpose: Destroys the CWLANAuthenticationPage object
  36. //
  37. // Arguments:
  38. // (none)
  39. //
  40. // Returns: Nothing
  41. //
  42. // Author: sachins
  43. //
  44. // Notes:
  45. //
  46. CWLANAuthenticationPage::~CWLANAuthenticationPage()
  47. {
  48. TraceFileFunc(ttidLanUi);
  49. }
  50. //+---------------------------------------------------------------------------
  51. //
  52. // Member: CWLANAuthenticationPage::UploadEapolConfig
  53. //
  54. // Purpose: Initializes latest data stored with Wireless Configuration
  55. //
  56. // Arguments:
  57. // (none)
  58. //
  59. // Returns: Nothing
  60. //
  61. // Author: sachins
  62. //
  63. // Notes:
  64. //
  65. LRESULT CWLANAuthenticationPage::UploadEapolConfig(CEapolConfig *pEapolConfig,
  66. CWZCConfigPage *pWzcPage)
  67. {
  68. m_pEapolConfig = pEapolConfig;
  69. m_pWzcPage = pWzcPage;
  70. return LresFromHr(S_OK);
  71. }
  72. //+---------------------------------------------------------------------------
  73. //
  74. // Member: CWLANAuthenticationPage::OnInitDialog
  75. //
  76. // Purpose: Handles the WM_INITDIALOG message
  77. //
  78. // Arguments:
  79. // uMsg []
  80. // wParam []
  81. // lParam []
  82. // bHandled []
  83. //
  84. // Returns: error code
  85. //
  86. // Author: sachins
  87. //
  88. // Notes:
  89. //
  90. LRESULT CWLANAuthenticationPage::OnInitDialog(UINT uMsg, WPARAM wParam,
  91. LPARAM lParam, BOOL& bHandled)
  92. {
  93. TraceFileFunc(ttidLanUi);
  94. DTLNODE* pOriginalEapcfgNode = NULL;
  95. DTLLIST * pListEapcfgs = NULL;
  96. HRESULT hr = S_OK;
  97. SetClassLongPtr(m_hWnd, GCLP_HCURSOR, NULL);
  98. SetClassLongPtr(GetParent(), GCLP_HCURSOR, NULL);
  99. ::SetWindowText(GetDlgItem(IDC_TXT_EAP_LABEL),
  100. SzLoadString(WZCGetSPResModule(), IDS_EAPOL_PAGE_LABEL));
  101. ::SendMessage(GetDlgItem(IDC_EAP_ICO_WARN),
  102. STM_SETICON, (WPARAM)LoadIcon(NULL, IDI_WARNING), (LPARAM)0);
  103. // Initialize EAP package list
  104. // Read the EAPCFG information from the registry and find the node
  105. // selected in the entry, or the default, if none.
  106. do
  107. {
  108. DTLNODE* pNode = NULL;
  109. if (m_pEapolConfig != NULL)
  110. {
  111. // the state of CID_CA_RB_Eap is being set in RefreshControls()
  112. Button_SetCheck(GetDlgItem(CID_CA_RB_MachineAuth),
  113. IS_MACHINE_AUTH_ENABLED(m_pEapolConfig->m_EapolIntfParams.dwEapFlags));
  114. Button_SetCheck(GetDlgItem(CID_CA_RB_GuestAuth),
  115. IS_GUEST_AUTH_ENABLED(m_pEapolConfig->m_EapolIntfParams.dwEapFlags));
  116. // Read the EAPCFG information from the registry and find the node
  117. // selected in the entry, or the default, if none.
  118. pListEapcfgs = m_pEapolConfig->m_pListEapcfgs;
  119. }
  120. if (pListEapcfgs)
  121. {
  122. DTLNODE* pNodeEap;
  123. DWORD dwkey = 0;
  124. // Choose the EAP name that will appear in the combo box
  125. pNode = EapcfgNodeFromKey(
  126. pListEapcfgs,
  127. m_pEapolConfig->m_EapolIntfParams.dwEapType );
  128. pOriginalEapcfgNode = pNode;
  129. // Fill the EAP packages listbox and select the previously identified
  130. // selection. The Properties button is disabled by default, but may
  131. // be enabled when the EAP list selection is set.
  132. //::EnableWindow(GetDlgItem(CID_CA_PB_Properties), FALSE);
  133. for (pNode = DtlGetFirstNode( pListEapcfgs );
  134. pNode;
  135. pNode = DtlGetNextNode( pNode ))
  136. {
  137. EAPCFG* pEapcfg = NULL;
  138. INT i;
  139. TCHAR* pszBuf = NULL;
  140. pEapcfg = (EAPCFG* )DtlGetData( pNode );
  141. ASSERT( pEapcfg );
  142. ASSERT( pEapcfg->pszFriendlyName );
  143. pszBuf = (LPTSTR)MALLOC (sizeof(TCHAR) * (lstrlen(pEapcfg->pszFriendlyName) + 1));
  144. if (!pszBuf)
  145. {
  146. continue;
  147. }
  148. lstrcpy( pszBuf, pEapcfg->pszFriendlyName );
  149. i = ComboBox_AddItem( GetDlgItem(CID_CA_LB_EapPackages),
  150. pszBuf, pNode );
  151. if (pNode == pOriginalEapcfgNode)
  152. {
  153. // Select the EAP name that will appear in the
  154. // combo box
  155. ComboBox_SetCurSelNotify( GetDlgItem(CID_CA_LB_EapPackages), i );
  156. }
  157. FREE ( pszBuf );
  158. }
  159. }
  160. ComboBox_AutoSizeDroppedWidth( GetDlgItem(CID_CA_LB_EapPackages) );
  161. // refresh the state for all the controls
  162. RefreshControls();
  163. } while (FALSE);
  164. return LresFromHr(hr);
  165. }
  166. //+---------------------------------------------------------------------------
  167. //
  168. // Member: CWLANAuthenticationPage::OnContextMenu
  169. //
  170. // Purpose: When right click a control, bring up help
  171. //
  172. // Arguments: Standard command parameters
  173. //
  174. // Returns:
  175. //
  176. // Author: sachins
  177. //
  178. LRESULT
  179. CWLANAuthenticationPage::OnContextMenu(UINT uMsg,
  180. WPARAM wParam,
  181. LPARAM lParam,
  182. BOOL& fHandled)
  183. {
  184. TraceFileFunc(ttidLanUi);
  185. if (m_adwHelpIDs != NULL)
  186. {
  187. ::WinHelp(m_hWnd,
  188. c_szNetCfgHelpFile,
  189. HELP_CONTEXTMENU,
  190. (ULONG_PTR)m_adwHelpIDs);
  191. }
  192. return 0;
  193. }
  194. //+---------------------------------------------------------------------------
  195. //
  196. // Member: CWLANAuthenticationPage::OnHelp
  197. //
  198. // Purpose: When drag context help icon over a control, bring up help
  199. //
  200. // Arguments: Standard command parameters
  201. //
  202. // Returns:
  203. //
  204. // Author: sachins
  205. //
  206. LRESULT
  207. CWLANAuthenticationPage::OnHelp( UINT uMsg,
  208. WPARAM wParam,
  209. LPARAM lParam,
  210. BOOL& fHandled)
  211. {
  212. TraceFileFunc(ttidLanUi);
  213. LPHELPINFO lphi = reinterpret_cast<LPHELPINFO>(lParam);
  214. Assert(lphi);
  215. if ((m_adwHelpIDs != NULL) && (HELPINFO_WINDOW == lphi->iContextType))
  216. {
  217. ::WinHelp(static_cast<HWND>(lphi->hItemHandle),
  218. c_szNetCfgHelpFile,
  219. HELP_WM_HELP,
  220. (ULONG_PTR)m_adwHelpIDs);
  221. }
  222. return 0;
  223. }
  224. //+---------------------------------------------------------------------------
  225. //
  226. // Member: CWLANAuthenticationPage::OnDestroy
  227. //
  228. // Purpose: Called when the dialog page is destroyed
  229. //
  230. // Arguments:
  231. // uMsg []
  232. // wParam []
  233. // lParam []
  234. // bHandled []
  235. //
  236. // Returns:
  237. //
  238. // Author: sachins
  239. //
  240. // Notes:
  241. //
  242. LRESULT CWLANAuthenticationPage::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam,
  243. BOOL& bHandled)
  244. {
  245. return 0;
  246. }
  247. //+---------------------------------------------------------------------------
  248. //
  249. // Member: CWLANAuthenticationPage::OnProperties
  250. //
  251. // Purpose: Handles the clicking of the Properties button
  252. //
  253. // Arguments:
  254. // wNotifyCode []
  255. // wID []
  256. // hWndCtl []
  257. // bHandled []
  258. //
  259. // Returns: error code
  260. //
  261. // Author: sachins
  262. //
  263. // Notes:
  264. //
  265. LRESULT CWLANAuthenticationPage::OnProperties(WORD wNotifyCode, WORD wID,
  266. HWND hWndCtl, BOOL& bHandled)
  267. {
  268. TraceFileFunc(ttidLanUi);
  269. DWORD dwErr = 0;
  270. DTLNODE* pNode = NULL;
  271. EAPCFG* pEapcfg = NULL;
  272. RASEAPINVOKECONFIGUI pInvokeConfigUi;
  273. RASEAPFREE pFreeConfigUIData;
  274. HINSTANCE h;
  275. BYTE* pConnectionData = NULL;
  276. DWORD cbConnectionData = 0;
  277. HRESULT hr = S_OK;
  278. // Look up the selected package configuration and load the associated
  279. // configuration DLL.
  280. pNode = (DTLNODE* )ComboBox_GetItemDataPtr(
  281. GetDlgItem(CID_CA_LB_EapPackages),
  282. ComboBox_GetCurSel( GetDlgItem(CID_CA_LB_EapPackages) ) );
  283. ASSERT( pNode );
  284. if (!pNode)
  285. {
  286. return E_UNEXPECTED;
  287. }
  288. pEapcfg = (EAPCFG* )DtlGetData( pNode );
  289. ASSERT( pEapcfg );
  290. h = NULL;
  291. if (!(h = LoadLibrary( pEapcfg->pszConfigDll ))
  292. || !(pInvokeConfigUi =
  293. (RASEAPINVOKECONFIGUI )GetProcAddress(
  294. h, "RasEapInvokeConfigUI" ))
  295. || !(pFreeConfigUIData =
  296. (RASEAPFREE) GetProcAddress(
  297. h, "RasEapFreeMemory" )))
  298. {
  299. // Cannot load configuration DLL
  300. if (h)
  301. {
  302. FreeLibrary( h );
  303. }
  304. return E_FAIL;
  305. }
  306. // Call the configuration DLL to popup it's custom configuration UI.
  307. pConnectionData = NULL;
  308. cbConnectionData = 0;
  309. dwErr = pInvokeConfigUi(
  310. pEapcfg->dwKey,
  311. GetParent(),
  312. RAS_EAP_FLAG_8021X_AUTH,
  313. pEapcfg->pData,
  314. pEapcfg->cbData,
  315. &pConnectionData,
  316. &cbConnectionData
  317. );
  318. if (dwErr != 0)
  319. {
  320. FreeLibrary( h );
  321. return E_FAIL;
  322. }
  323. // Store the configuration information returned in the package descriptor.
  324. FREE ( pEapcfg->pData );
  325. pEapcfg->pData = NULL;
  326. pEapcfg->cbData = 0;
  327. if (pConnectionData)
  328. {
  329. if (cbConnectionData > 0)
  330. {
  331. // Copy it into the eap node
  332. pEapcfg->pData = (LPBYTE)MALLOC (sizeof(UCHAR) * cbConnectionData);
  333. if (pEapcfg->pData)
  334. {
  335. CopyMemory( pEapcfg->pData, pConnectionData, cbConnectionData );
  336. pEapcfg->cbData = cbConnectionData;
  337. }
  338. }
  339. }
  340. pFreeConfigUIData( pConnectionData );
  341. // Note any "force user to configure" requirement on the package has been
  342. // satisfied.
  343. pEapcfg->fConfigDllCalled = TRUE;
  344. FreeLibrary( h );
  345. TraceError("CWLANAuthenticationPage::OnProperties", hr);
  346. return LresFromHr(hr);
  347. }
  348. //+---------------------------------------------------------------------------
  349. //
  350. // Member: CWLANAuthenticationPage::OnEapSelection
  351. //
  352. // Purpose: Handles the clicking of the EAP checkbox
  353. //
  354. // Arguments:
  355. // wNotifyCode []
  356. // wID []
  357. // hWndCtl []
  358. // bHandled []
  359. //
  360. // Returns:
  361. //
  362. // Author: sachins
  363. //
  364. // Notes:
  365. //
  366. LRESULT CWLANAuthenticationPage::OnEapSelection(WORD wNotifyCode, WORD wID,
  367. HWND hWndCtl, BOOL& bHandled)
  368. {
  369. TraceFileFunc(ttidLanUi);
  370. HRESULT hr = S_OK;
  371. EAPCFG* pEapcfg = NULL;
  372. INT iSel = 0;
  373. // Toggle buttons based on selection
  374. if (BST_CHECKED == IsDlgButtonChecked(CID_CA_RB_Eap))
  375. {
  376. ::EnableWindow(GetDlgItem(CID_CA_LB_EapPackages), TRUE);
  377. ::EnableWindow(GetDlgItem(IDC_TXT_EAP_TYPE), TRUE);
  378. // Get the EAPCFG information for the currently selected EAP package.
  379. iSel = ComboBox_GetCurSel(GetDlgItem(CID_CA_LB_EapPackages));
  380. // iSel is the index in the displayed list as well as the
  381. // index of the dll that are loaded.
  382. // Get the cfgnode corresponding to this index
  383. if (iSel >= 0)
  384. {
  385. DTLNODE* pNode;
  386. pNode =
  387. (DTLNODE* )ComboBox_GetItemDataPtr(
  388. GetDlgItem(CID_CA_LB_EapPackages), iSel );
  389. if (pNode)
  390. {
  391. pEapcfg = (EAPCFG* )DtlGetData( pNode );
  392. }
  393. }
  394. // Enable the Properties button if the selected package has a
  395. // configuration entrypoint
  396. // if (FIsUserAdmin())
  397. {
  398. ::EnableWindow ( GetDlgItem(CID_CA_PB_Properties),
  399. (pEapcfg && !!(pEapcfg->pszConfigDll)) );
  400. }
  401. ::EnableWindow(GetDlgItem(CID_CA_RB_MachineAuth), TRUE);
  402. ::EnableWindow(GetDlgItem(CID_CA_RB_GuestAuth), TRUE);
  403. m_pEapolConfig->m_EapolIntfParams.dwEapFlags |= EAPOL_ENABLED;
  404. }
  405. else
  406. {
  407. ::EnableWindow(GetDlgItem (IDC_TXT_EAP_TYPE), FALSE);
  408. ::EnableWindow(GetDlgItem (CID_CA_LB_EapPackages), FALSE);
  409. ::EnableWindow(GetDlgItem (CID_CA_PB_Properties), FALSE);
  410. ::EnableWindow(GetDlgItem(CID_CA_RB_MachineAuth), FALSE);
  411. ::EnableWindow(GetDlgItem(CID_CA_RB_GuestAuth), FALSE);
  412. m_pEapolConfig->m_EapolIntfParams.dwEapFlags &= ~EAPOL_ENABLED;
  413. }
  414. TraceError("CWLANAuthenticationPage::OnEapSelection", hr);
  415. return LresFromHr(hr);
  416. }
  417. //+---------------------------------------------------------------------------
  418. //
  419. // Member: CWLANAuthenticationPage::OnEapPackages
  420. //
  421. // Purpose: Handles the clicking of the EAP packages combo box
  422. //
  423. // Arguments:
  424. // wNotifyCode []
  425. // wID []
  426. // hWndCtl []
  427. // bHandled []
  428. //
  429. // Returns:
  430. //
  431. // Author: sachins
  432. //
  433. // Notes:
  434. //
  435. LRESULT CWLANAuthenticationPage::OnEapPackages(WORD wNotifyCode, WORD wID,
  436. HWND hWndCtl, BOOL& bHandled)
  437. {
  438. TraceFileFunc(ttidLanUi);
  439. HRESULT hr = S_OK;
  440. EAPCFG* pEapcfg = NULL;
  441. INT iSel = 0;
  442. // Get the EAPCFG information for the selected EAP package.
  443. iSel = ComboBox_GetCurSel(GetDlgItem(CID_CA_LB_EapPackages));
  444. // iSel is the index in the displayed list as well as the
  445. // index of the dll that are loaded.
  446. // Get the cfgnode corresponding to this index
  447. if (iSel >= 0)
  448. {
  449. DTLNODE* pNode = NULL;
  450. pNode =
  451. (DTLNODE* )ComboBox_GetItemDataPtr(
  452. GetDlgItem(CID_CA_LB_EapPackages), iSel );
  453. if (pNode)
  454. {
  455. pEapcfg = (EAPCFG* )DtlGetData( pNode );
  456. }
  457. }
  458. // Enable the Properties button if the selected package has a
  459. // configuration entrypoint
  460. if (BST_CHECKED == IsDlgButtonChecked(CID_CA_RB_Eap))
  461. {
  462. ::EnableWindow ( GetDlgItem(CID_CA_PB_Properties),
  463. (pEapcfg && !!(pEapcfg->pszConfigDll)) );
  464. }
  465. TraceError("CWLANAuthenticationPage::OnEapPackages", hr);
  466. return LresFromHr(hr);
  467. }
  468. //+---------------------------------------------------------------------------
  469. //
  470. // Member: CWLANAuthenticationPage::OnKillActive
  471. //
  472. // Purpose: Called to check warning conditions before the security
  473. // page is going away
  474. //
  475. // Arguments:
  476. // idCtrl []
  477. // pnmh []
  478. // bHandled []
  479. //
  480. // Returns:
  481. //
  482. // Author: sachins
  483. //
  484. // Notes:
  485. //
  486. LRESULT CWLANAuthenticationPage::OnKillActive(int idCtrl, LPNMHDR pnmh,
  487. BOOL& bHandled)
  488. {
  489. TraceFileFunc(ttidLanUi);
  490. BOOL fError;
  491. fError = m_fNetcfgInUse;
  492. ::SetWindowLongPtr(m_hWnd, DWLP_MSGRESULT, fError);
  493. return fError;
  494. }
  495. //+---------------------------------------------------------------------------
  496. //
  497. // Member: CWLANAuthenticationPage::OnKillActive
  498. //
  499. // Purpose: Called to check warning conditions when the security
  500. // page is showing up
  501. //
  502. // Arguments:
  503. // idCtrl []
  504. // pnmh []
  505. // bHandled []
  506. //
  507. // Returns:
  508. //
  509. // Author: sachins
  510. //
  511. // Notes:
  512. //
  513. LRESULT CWLANAuthenticationPage::OnSetActive(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  514. {
  515. RefreshControls();
  516. return S_OK;
  517. }
  518. //+---------------------------------------------------------------------------
  519. //
  520. // Member: CWLANAuthenticationPage::OnApply
  521. //
  522. // Purpose: Called when the Networking page is applied
  523. //
  524. // Arguments:
  525. // idCtrl []
  526. // pnmh []
  527. // bHandled []
  528. //
  529. // Returns:
  530. //
  531. // Author: sachins
  532. //
  533. // Notes:
  534. //
  535. LRESULT CWLANAuthenticationPage::OnApply(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  536. {
  537. TraceFileFunc(ttidLanUi);
  538. DWORD dwEapFlags = 0;
  539. DWORD dwDefaultEapType = 0;
  540. EAPOL_INTF_PARAMS EapolIntfParams;
  541. NETCON_PROPERTIES* pProps = NULL;
  542. HRESULT hrOverall = S_OK;
  543. DTLLIST * pListEapcfgs;
  544. HRESULT hr = S_OK;
  545. // Retain data for all EAP packages
  546. pListEapcfgs = m_pEapolConfig->m_pListEapcfgs;
  547. if (pListEapcfgs == NULL)
  548. {
  549. return LresFromHr(S_OK);
  550. }
  551. DTLNODE* pNode = NULL;
  552. EAPCFG* pEapcfg = NULL;
  553. pNode = (DTLNODE* )ComboBox_GetItemDataPtr(
  554. GetDlgItem (CID_CA_LB_EapPackages),
  555. ComboBox_GetCurSel( GetDlgItem (CID_CA_LB_EapPackages) ) );
  556. if (pNode == NULL)
  557. {
  558. return LresFromHr (E_FAIL);
  559. }
  560. pEapcfg = (EAPCFG* )DtlGetData( pNode );
  561. if (pEapcfg == NULL)
  562. {
  563. return LresFromHr (E_FAIL);
  564. }
  565. dwDefaultEapType = pEapcfg->dwKey;
  566. // If CID_CA_RB_Eap is checked, EAPOL is enabled on the interface
  567. // the memory image of CID_CA_RB_Eap is updated with each click on the control so
  568. // update this bit from the in-memory flag.
  569. dwEapFlags |= m_pEapolConfig->m_EapolIntfParams.dwEapFlags & EAPOL_ENABLED;
  570. if (Button_GetCheck( GetDlgItem(CID_CA_RB_MachineAuth )))
  571. dwEapFlags |= EAPOL_MACHINE_AUTH_ENABLED;
  572. if (Button_GetCheck( GetDlgItem(CID_CA_RB_GuestAuth )))
  573. dwEapFlags |= EAPOL_GUEST_AUTH_ENABLED;
  574. // Save the params for this interface in registry
  575. EapolIntfParams.dwEapType = dwDefaultEapType;
  576. EapolIntfParams.dwEapFlags = dwEapFlags;
  577. memcpy (&m_pEapolConfig->m_EapolIntfParams, &EapolIntfParams,
  578. sizeof(EAPOL_INTF_PARAMS));
  579. return LresFromHr(hr);
  580. }
  581. //+---------------------------------------------------------------------------
  582. //
  583. // Member: CWLANAuthenticationPage::OnCancel
  584. //
  585. // Purpose: Called when the Networking page is cancelled.
  586. //
  587. // Arguments:
  588. // idCtrl []
  589. // pnmh []
  590. // bHandled []
  591. //
  592. // Returns:
  593. //
  594. // Author: sachins
  595. //
  596. //
  597. LRESULT CWLANAuthenticationPage::OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  598. {
  599. return LresFromHr(S_OK);
  600. }
  601. //+---------------------------------------------------------------------------
  602. //
  603. // Member: CWLANAuthenticationPage::OnCancel
  604. //
  605. // Purpose: Called to update the state of all the controls.
  606. //
  607. // Arguments:
  608. // idCtrl []
  609. // pnmh []
  610. // bHandled []
  611. //
  612. // Returns:
  613. //
  614. LRESULT CWLANAuthenticationPage::RefreshControls()
  615. {
  616. BOOL bLocked;
  617. BOOL bEnabled;
  618. bEnabled = IS_EAPOL_ENABLED(m_pEapolConfig->m_EapolIntfParams.dwEapFlags);
  619. bLocked = (m_pEapolConfig->m_dwCtlFlags & EAPOL_CTL_LOCKED);
  620. Button_SetCheck(GetDlgItem(CID_CA_RB_Eap), !bLocked && bEnabled);
  621. ::ShowWindow(GetDlgItem(IDC_EAP_ICO_WARN), bLocked? SW_SHOW : SW_HIDE);
  622. ::ShowWindow(GetDlgItem(IDC_EAP_LBL_WARN), bLocked? SW_SHOW : SW_HIDE);
  623. // now set all the controls state
  624. ::EnableWindow(GetDlgItem(IDC_TXT_EAP_LABEL), !bLocked);
  625. ::EnableWindow(GetDlgItem(CID_CA_RB_Eap), !bLocked);
  626. ::EnableWindow(GetDlgItem(IDC_TXT_EAP_TYPE), !bLocked && bEnabled);
  627. ::EnableWindow(GetDlgItem(CID_CA_LB_EapPackages), !bLocked && bEnabled);
  628. ::EnableWindow(GetDlgItem(CID_CA_PB_Properties), !bLocked && bEnabled);
  629. ::EnableWindow(GetDlgItem(CID_CA_RB_MachineAuth), !bLocked && bEnabled);
  630. ::EnableWindow(GetDlgItem(CID_CA_RB_GuestAuth), !bLocked && bEnabled);
  631. return LresFromHr(S_OK);
  632. }