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.

1365 lines
38 KiB

  1. //+---------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 1997.
  5. //
  6. // File: locppg.cpp
  7. //
  8. // Contents: Implements the classes CGeneralPropertyPage,
  9. // CLocationPropertyPage, CSecurityPropertyPage and
  10. // CIdentityPropertyPage which manage the four property
  11. // pages per AppId.
  12. //
  13. // Classes:
  14. //
  15. // Methods: CGeneralPropertyPage::CGeneralPropertyPage
  16. // CGeneralPropertyPage::~CGeneralPropertyPage
  17. // CGeneralPropertyPage::DoDataExchange
  18. // CLocationPropertyPage::CLocationPropertyPage
  19. // CLocationPropertyPage::~CLocationPropertyPage
  20. // CLocationPropertyPage::DoDataExchange
  21. // CLocationPropertyPage::OnBrowse
  22. // CLocationPropertyPage::OnRunRemote
  23. // CLocationPropertyPage::UpdateControls
  24. // CLocationPropertyPage::OnSetActive
  25. // CLocationPropertyPage::OnChange
  26. // CSecurityPropertyPage::CSecurityPropertyPage
  27. // CSecurityPropertyPage::~CSecurityPropertyPage
  28. // CSecurityPropertyPage::DoDataExchange
  29. // CSecurityPropertyPage::OnDefaultAccess
  30. // CSecurityPropertyPage::OnCustomAccess
  31. // CSecurityPropertyPage::OnDefaultLaunch
  32. // CSecurityPropertyPage::OnCustomLaunch
  33. // CSecurityPropertyPage::OnDefaultConfig
  34. // CSecurityPropertyPage::OnCustomConfig
  35. // CSecurityPropertyPage::OnEditAccess
  36. // CSecurityPropertyPage::OnEditLaunch
  37. // CSecurityPropertyPage::OnEditConfig
  38. // CIdentityPropertyPage::CIdentityPropertyPage
  39. // CIdentityPropertyPage::~CIdentityPropertyPage
  40. // CIdentityPropertyPage::DoDataExchange
  41. // CIdentityPropertyPage::OnBrowse
  42. // CIdentityPropertyPage::OnChange
  43. //
  44. // History: 23-Apr-96 BruceMa Created.
  45. // ??-Oct-97 ronans General fixes and cleanup
  46. //
  47. //----------------------------------------------------------------------
  48. #include "stdafx.h"
  49. #include "afxtempl.h"
  50. #include "assert.h"
  51. #include "resource.h"
  52. #include "types.h"
  53. #include "LocPPg.h"
  54. #include "clspsht.h"
  55. #include "datapkt.h"
  56. #if !defined(STANDALONE_BUILD)
  57. extern "C"
  58. {
  59. #include <getuser.h>
  60. }
  61. #endif
  62. #include "util.h"
  63. #include "virtreg.h"
  64. #if !defined(STANDALONE_BUILD)
  65. #include "ntlsa.h"
  66. #endif
  67. #ifdef _DEBUG
  68. #define new DEBUG_NEW
  69. #undef THIS_FILE
  70. static char BASED_CODE THIS_FILE[] = __FILE__;
  71. #endif
  72. IMPLEMENT_DYNCREATE(CGeneralPropertyPage, CPropertyPage)
  73. IMPLEMENT_DYNCREATE(CLocationPropertyPage, CPropertyPage)
  74. IMPLEMENT_DYNCREATE(CSecurityPropertyPage, CPropertyPage)
  75. IMPLEMENT_DYNCREATE(CIdentityPropertyPage, CPropertyPage)
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CGeneralPropertyPage property page
  78. CGeneralPropertyPage::CGeneralPropertyPage() : CPropertyPage(CGeneralPropertyPage::IDD)
  79. {
  80. //{{AFX_DATA_INIT(CGeneralPropertyPage)
  81. m_szServerName = _T("");
  82. m_szServerPath = _T("");
  83. m_szServerType = _T("");
  84. m_szPathTitle = _T("");
  85. m_szComputerName = _T("");
  86. //}}AFX_DATA_INIT
  87. m_authLevel = Defaultx;
  88. m_authLevelIndex = -1;
  89. m_bChanged = FALSE;
  90. }
  91. CGeneralPropertyPage::~CGeneralPropertyPage()
  92. {
  93. CancelChanges();
  94. }
  95. void CGeneralPropertyPage::DoDataExchange(CDataExchange* pDX)
  96. {
  97. CPropertyPage::DoDataExchange(pDX);
  98. switch (m_iServerType)
  99. {
  100. case INPROC:
  101. m_szPathTitle.LoadString(IDS_PATH);
  102. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  103. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_HIDE);
  104. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  105. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_HIDE);
  106. m_szServerType.LoadString(IDS_SERVERTYPE_INPROC);
  107. break;
  108. case LOCALEXE:
  109. m_szPathTitle.LoadString(IDS_PATH);
  110. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  111. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_HIDE);
  112. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  113. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_HIDE);
  114. m_szServerType.LoadString(IDS_SERVERTYPE_LOCALEXE);
  115. break;
  116. case SERVICE:
  117. m_szPathTitle.LoadString(IDS_SERVICENAME);
  118. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  119. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_HIDE);
  120. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  121. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_HIDE);
  122. m_szServerType.LoadString(IDS_SERVERTYPE_SERVICE);
  123. break;
  124. case PURE_REMOTE:
  125. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_HIDE);
  126. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_SHOW);
  127. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_HIDE);
  128. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_SHOW);
  129. m_szServerType.LoadString(IDS_SERVERTYPE_PURE_REMOTE);
  130. break;
  131. case REMOTE_LOCALEXE:
  132. m_szPathTitle.LoadString(IDS_PATH);
  133. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  134. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_SHOW);
  135. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  136. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_SHOW);
  137. m_szServerType.LoadString(IDS_SERVERTYPE_REMOTE_LOCALEXE);
  138. break;
  139. case REMOTE_SERVICE:
  140. m_szPathTitle.LoadString(IDS_SERVICENAME);
  141. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  142. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_SHOW);
  143. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  144. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_SHOW);
  145. m_szServerType.LoadString(IDS_SERVERTYPE_REMOTE_SERVICE);
  146. break;
  147. case SURROGATE:
  148. m_szPathTitle.LoadString(IDS_PATH);
  149. GetDlgItem(IDC_PATHTITLE)->ShowWindow(SW_SHOW);
  150. GetDlgItem(IDC_MACHINETITLE)->ShowWindow(SW_HIDE);
  151. GetDlgItem(IDC_SERVERPATH)->ShowWindow(SW_SHOW);
  152. GetDlgItem(IDC_MACHINE)->ShowWindow(SW_HIDE);
  153. m_szServerType.LoadString(IDS_SERVERTYPE_SURROGATE);
  154. break;
  155. default:
  156. m_szServerType.LoadString(IDS_SERVERTYPE_UNKNOWN);
  157. break;
  158. }
  159. //{{AFX_DATA_MAP(CGeneralPropertyPage)
  160. DDX_Control(pDX, IDC_COMBO1, m_authLevelCBox);
  161. DDX_Text(pDX, IDC_SERVERNAME, m_szServerName);
  162. DDX_Text(pDX, IDC_SERVERPATH, m_szServerPath);
  163. DDX_Text(pDX, IDC_SERVERTYPE, m_szServerType);
  164. DDX_Text(pDX, IDC_PATHTITLE, m_szPathTitle);
  165. DDX_Text(pDX, IDC_MACHINE, m_szComputerName);
  166. //}}AFX_DATA_MAP
  167. }
  168. void CGeneralPropertyPage::OnEditchangeCombo1()
  169. {
  170. // TODO: Add your control notification handler code here
  171. }
  172. void CGeneralPropertyPage::OnSelchangeCombo1()
  173. {
  174. int iSel;
  175. // Get the new selection
  176. iSel = m_authLevelCBox.GetCurSel();
  177. m_authLevel = (AUTHENTICATIONLEVEL) m_authLevelCBox.GetItemData(iSel);
  178. // Virtually write it to the registry
  179. if (m_authLevelIndex == -1)
  180. {
  181. g_virtreg.NewRegDwordNamedValue(g_hAppid,
  182. NULL,
  183. TEXT("AuthenticationLevel"),
  184. m_authLevel,
  185. &m_authLevelIndex);
  186. }
  187. else
  188. {
  189. g_virtreg.ChgRegDwordNamedValue(m_authLevelIndex,
  190. m_authLevel);
  191. }
  192. // This is a reboot event
  193. g_fReboot = TRUE;
  194. // Enable the Apply button
  195. SetModified(m_bChanged = TRUE);
  196. }
  197. BOOL CGeneralPropertyPage::OnInitDialog()
  198. {
  199. int iIndex;
  200. int err;
  201. CPropertyPage::OnInitDialog();
  202. // Populate the authentication combo boxe
  203. CString sTemp;
  204. m_authLevelCBox.ResetContent();
  205. // Associate values with entries
  206. sTemp.LoadString(IDS_DEFAULT);
  207. iIndex = m_authLevelCBox.AddString(sTemp);
  208. m_authLevelCBox.SetItemData(iIndex, Defaultx);
  209. sTemp.LoadString(IDS_NONE);
  210. iIndex = m_authLevelCBox.AddString(sTemp);
  211. m_authLevelCBox.SetItemData(iIndex, None);
  212. sTemp.LoadString(IDS_CONNECT);
  213. iIndex = m_authLevelCBox.AddString(sTemp);
  214. m_authLevelCBox.SetItemData(iIndex, Connect);
  215. sTemp.LoadString(IDS_CALL);
  216. iIndex = m_authLevelCBox.AddString(sTemp);
  217. m_authLevelCBox.SetItemData(iIndex, Call);
  218. sTemp.LoadString(IDS_PACKET);
  219. iIndex = m_authLevelCBox.AddString(sTemp);
  220. m_authLevelCBox.SetItemData(iIndex, Packet);
  221. sTemp.LoadString(IDS_PACKETINTEGRITY);
  222. iIndex = m_authLevelCBox.AddString(sTemp);
  223. m_authLevelCBox.SetItemData(iIndex, PacketIntegrity);
  224. sTemp.LoadString(IDS_PACKETPRIVACY);
  225. iIndex = m_authLevelCBox.AddString(sTemp);
  226. m_authLevelCBox.SetItemData(iIndex, PacketPrivacy);
  227. m_authLevelCBox.SetCurSel(Defaultx);
  228. // Attempt to read HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLE.
  229. // LegacyAuthenticationLevel
  230. err = g_virtreg.ReadRegDwordNamedValue(g_hAppid,
  231. NULL,
  232. TEXT("AuthenticationLevel"),
  233. &m_authLevelIndex);
  234. if (err == ERROR_SUCCESS)
  235. {
  236. CDataPacket * pCdp = g_virtreg.GetAt(m_authLevelIndex);
  237. m_authLevel = (AUTHENTICATIONLEVEL) pCdp->GetDwordValue();
  238. }
  239. else if (err != ERROR_ACCESS_DENIED && err != ERROR_FILE_NOT_FOUND)
  240. {
  241. g_util.PostErrorMessage();
  242. }
  243. else
  244. m_authLevel = Defaultx;
  245. // AuthenticationLevel
  246. for (int k = 0; k < m_authLevelCBox.GetCount(); k++)
  247. {
  248. if (((AUTHENTICATIONLEVEL) m_authLevelCBox.GetItemData(k)) == m_authLevel)
  249. {
  250. m_authLevelCBox.SetCurSel(k);
  251. break;
  252. }
  253. }
  254. SetModified(m_bChanged = FALSE);
  255. return TRUE; // return TRUE unless you set the focus to a control
  256. // EXCEPTION: OCX Property Pages should return FALSE
  257. }
  258. //+-------------------------------------------------------------------------
  259. //
  260. // Member: CGeneralPropertyPage::ValidateChanges
  261. //
  262. // Synopsis: Called to validate the changes before updating
  263. //
  264. // Arguments: None
  265. //
  266. // Returns: BOOL success flag
  267. //
  268. // Algorithm: N/A
  269. //
  270. // History: 27-Oct-97 Ronans Created
  271. //
  272. //--------------------------------------------------------------------------
  273. BOOL CGeneralPropertyPage::ValidateChanges()
  274. {
  275. UpdateData(TRUE);
  276. return TRUE;
  277. }
  278. //+-------------------------------------------------------------------------
  279. //
  280. // Member: CGeneralPropertyPage::UpdateChanges
  281. //
  282. // Synopsis: Called to update the changes to registry
  283. //
  284. // Arguments: hkAppID - HKEY for AppID
  285. //
  286. // Returns: BOOL success flag
  287. //
  288. // Algorithm: N/A
  289. //
  290. // History: 27-Oct-97 Ronans Created
  291. //
  292. //--------------------------------------------------------------------------
  293. BOOL CGeneralPropertyPage::UpdateChanges(HKEY hkAppID)
  294. {
  295. if (m_authLevelIndex >= 0)
  296. {
  297. if (m_bChanged)
  298. {
  299. // delete key if its the default
  300. if (m_authLevel == Defaultx)
  301. g_virtreg.MarkForDeletion(m_authLevelIndex);
  302. g_virtreg.Apply(m_authLevelIndex);
  303. }
  304. g_virtreg.Remove(m_authLevelIndex);
  305. m_authLevelIndex = -1;
  306. }
  307. m_bChanged = FALSE;
  308. return TRUE;
  309. }
  310. //+-------------------------------------------------------------------------
  311. //
  312. // Member: CGeneralPropertyPage::CancelChanges
  313. //
  314. // Synopsis: Called to cancel the changes to registry
  315. //
  316. // Arguments: None
  317. //
  318. // Returns: BOOL success flag
  319. //
  320. // Algorithm: N/A
  321. //
  322. // History: 27-Oct-97 Ronans Created
  323. //
  324. //--------------------------------------------------------------------------
  325. BOOL CGeneralPropertyPage::CancelChanges()
  326. {
  327. if (m_authLevelIndex >= 0)
  328. {
  329. g_virtreg.Remove(m_authLevelIndex);
  330. m_authLevelIndex = -1;
  331. }
  332. return TRUE;
  333. }
  334. BOOL CGeneralPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  335. {
  336. if(-1 != pHelpInfo->iCtrlId)
  337. {
  338. WORD hiWord = 0x8000 | CGeneralPropertyPage::IDD;
  339. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  340. DWORD dwLong = MAKELONG(loWord,hiWord);
  341. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  342. return TRUE;
  343. }
  344. else
  345. return CPropertyPage::OnHelpInfo(pHelpInfo);
  346. }
  347. BEGIN_MESSAGE_MAP(CGeneralPropertyPage, CPropertyPage)
  348. //{{AFX_MSG_MAP(CGeneralPropertyPage)
  349. ON_WM_HELPINFO()
  350. ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
  351. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  352. //}}AFX_MSG_MAP
  353. END_MESSAGE_MAP()
  354. /////////////////////////////////////////////////////////////////////////////
  355. // CLocationPropertyPage property page
  356. CLocationPropertyPage::CLocationPropertyPage() : CPropertyPage(CLocationPropertyPage::IDD)
  357. {
  358. //{{AFX_DATA_INIT(CLocationPropertyPage)
  359. m_szComputerName = _T("");
  360. m_fAtStorage = FALSE;
  361. m_fLocal = FALSE;
  362. m_fRemote = FALSE;
  363. m_iInitial = 2;
  364. //}}AFX_DATA_INIT
  365. m_bChanged = FALSE;
  366. }
  367. CLocationPropertyPage::~CLocationPropertyPage()
  368. {
  369. }
  370. void CLocationPropertyPage::DoDataExchange(CDataExchange* pDX)
  371. {
  372. CPropertyPage::DoDataExchange(pDX);
  373. //{{AFX_DATA_MAP(CLocationPropertyPage)
  374. DDX_Text(pDX, IDC_EDIT1, m_szComputerName);
  375. DDV_MaxChars(pDX, m_szComputerName, 256);
  376. DDX_Check(pDX, IDC_CHECK1, m_fAtStorage);
  377. DDX_Check(pDX, IDC_CHECK2, m_fLocal);
  378. DDX_Check(pDX, IDC_CHECK3, m_fRemote);
  379. //}}AFX_DATA_MAP
  380. if (m_fRemote)
  381. {
  382. pDX->PrepareEditCtrl(IDC_EDIT1);
  383. if (m_szComputerName.GetLength() == 0 && m_iInitial == 0)
  384. {
  385. CString szTemp;
  386. szTemp.LoadString(IDS_INVALIDSERVER);
  387. MessageBox(szTemp);
  388. pDX->Fail();
  389. }
  390. }
  391. if (m_fAtStorage)
  392. {
  393. m_pPage1->m_szComputerName.LoadString(IDS_ATSTORAGE);
  394. }
  395. else
  396. m_pPage1->m_szComputerName = m_szComputerName;
  397. switch(m_pPage1->m_iServerType)
  398. {
  399. case LOCALEXE:
  400. case SERVICE:
  401. if (m_fAtStorage || m_fRemote)
  402. m_pPage1->m_iServerType += 3;
  403. break;
  404. case REMOTE_LOCALEXE:
  405. case REMOTE_SERVICE:
  406. if (!(m_fAtStorage || m_fRemote))
  407. m_pPage1->m_iServerType -= 3;
  408. break;
  409. }
  410. if (m_iInitial)
  411. m_iInitial--;
  412. }
  413. BEGIN_MESSAGE_MAP(CLocationPropertyPage, CPropertyPage)
  414. //{{AFX_MSG_MAP(CLocationPropertyPage)
  415. ON_BN_CLICKED(IDC_BUTTON1, OnBrowse)
  416. ON_BN_CLICKED(IDC_CHECK3, OnRunRemote)
  417. ON_EN_CHANGE(IDC_EDIT1, OnChange)
  418. ON_BN_CLICKED(IDC_CHECK1, OnChange)
  419. ON_BN_CLICKED(IDC_CHECK2, OnChange)
  420. ON_WM_HELPINFO()
  421. //}}AFX_MSG_MAP
  422. END_MESSAGE_MAP()
  423. void CLocationPropertyPage::OnBrowse()
  424. {
  425. TCHAR szMachine[MAX_PATH];
  426. if (g_util.InvokeMachineBrowser(szMachine))
  427. {
  428. // Strip off "\\" - if present
  429. int nIndex = 0;
  430. while(szMachine[nIndex] == TEXT('\\'))
  431. nIndex++;
  432. GetDlgItem(IDC_EDIT1)->SetWindowText(&szMachine[nIndex]);
  433. SetModified(m_bChanged = TRUE);
  434. }
  435. }
  436. void CLocationPropertyPage::OnRunRemote()
  437. {
  438. SetModified(m_bChanged = TRUE);
  439. UpdateControls();
  440. }
  441. void CLocationPropertyPage::UpdateControls()
  442. {
  443. BOOL fChecked = IsDlgButtonChecked(IDC_CHECK3);
  444. GetDlgItem(IDC_EDIT1)->EnableWindow(fChecked);
  445. // Leave this browse button disabled until after SUR Beta 2
  446. GetDlgItem(IDC_BUTTON1)->EnableWindow(fChecked);
  447. }
  448. BOOL CLocationPropertyPage::OnSetActive()
  449. {
  450. if (!m_fCanBeLocal)
  451. GetDlgItem(IDC_CHECK2)->EnableWindow(FALSE);
  452. UpdateControls();
  453. return CPropertyPage::OnSetActive();
  454. }
  455. void CLocationPropertyPage::OnChange()
  456. {
  457. SetModified(m_bChanged = TRUE);
  458. }
  459. //+-------------------------------------------------------------------------
  460. //
  461. // Member: CLocationPropertyPage::ValidateChanges
  462. //
  463. // Synopsis: Called to validate the changes before updating
  464. //
  465. // Arguments: None
  466. //
  467. // Returns: BOOL success flag
  468. //
  469. // Algorithm: N/A
  470. //
  471. // History: 27-Oct-97 Ronans Created
  472. //
  473. //--------------------------------------------------------------------------
  474. BOOL CLocationPropertyPage::ValidateChanges()
  475. {
  476. UpdateData(TRUE);
  477. // Check that remote servers are valid connectable machines
  478. if (m_fRemote)
  479. {
  480. if (!g_util.VerifyRemoteMachine((TCHAR *) LPCTSTR(m_szComputerName)))
  481. return FALSE;
  482. }
  483. return TRUE;
  484. }
  485. //+-------------------------------------------------------------------------
  486. //
  487. // Member: CLocationPropertyPage::UpdateChanges
  488. //
  489. // Synopsis: Called to update the changes to registry
  490. //
  491. // Arguments: hkAppID - HKEY for AppID
  492. //
  493. // Returns: BOOL success flag
  494. //
  495. // Algorithm: N/A
  496. //
  497. // History: 27-Oct-97 Ronans Created
  498. //
  499. //--------------------------------------------------------------------------
  500. BOOL CLocationPropertyPage::UpdateChanges(HKEY hkAppID)
  501. {
  502. long lErr;
  503. ////////////////////////////////////////////////////////////////////
  504. // Persist Location property page data
  505. if (m_fAtStorage)
  506. lErr = RegSetValueEx(
  507. hkAppID,
  508. TEXT("ActivateAtStorage"),
  509. 0,
  510. REG_SZ,
  511. (BYTE *)TEXT("Y"),
  512. sizeof(TCHAR) * 2);
  513. else
  514. lErr = RegDeleteValue(hkAppID, TEXT("ActivateAtStorage"));
  515. if (m_fRemote)
  516. lErr = RegSetValueEx(
  517. hkAppID,
  518. TEXT("RemoteServerName"),
  519. 0,
  520. REG_SZ,
  521. (BYTE *)(LPCTSTR)m_szComputerName,
  522. (1 + m_szComputerName.GetLength()) * sizeof(TCHAR));
  523. else
  524. lErr = RegDeleteValue(hkAppID, TEXT("RemoteServerName"));
  525. return TRUE;
  526. }
  527. //+-------------------------------------------------------------------------
  528. //
  529. // Member: CLocationPropertyPage::CancelChanges
  530. //
  531. // Synopsis: Called to cancel the changes to registry
  532. //
  533. // Arguments: None
  534. //
  535. // Returns: BOOL success flag
  536. //
  537. // Algorithm: N/A
  538. //
  539. // History: 27-Oct-97 Ronans Created
  540. //
  541. //--------------------------------------------------------------------------
  542. BOOL CLocationPropertyPage::CancelChanges()
  543. {
  544. return TRUE;
  545. }
  546. /////////////////////////////////////////////////////////////////////////////
  547. // CSecurityPropertyPage property page
  548. CSecurityPropertyPage::CSecurityPropertyPage() : CPropertyPage(CSecurityPropertyPage::IDD)
  549. {
  550. //{{AFX_DATA_INIT(CSecurityPropertyPage)
  551. m_iAccess = -1;
  552. m_iLaunch = -1;
  553. m_iConfig = -1;
  554. m_iAccessIndex = -1;
  555. m_iLaunchIndex = -1;
  556. m_iConfigurationIndex = -1;
  557. //}}AFX_DATA_INIT
  558. }
  559. CSecurityPropertyPage::~CSecurityPropertyPage()
  560. {
  561. }
  562. void CSecurityPropertyPage::DoDataExchange(CDataExchange* pDX)
  563. {
  564. CPropertyPage::DoDataExchange(pDX);
  565. //{{AFX_DATA_MAP(CSecurityPropertyPage)
  566. DDX_Radio(pDX, IDC_RADIO1, m_iAccess);
  567. DDX_Radio(pDX, IDC_RADIO3, m_iLaunch);
  568. DDX_Radio(pDX, IDC_RADIO5, m_iConfig);
  569. //}}AFX_DATA_MAP
  570. GetDlgItem(IDC_BUTTON1)->EnableWindow(1 == m_iAccess);
  571. GetDlgItem(IDC_BUTTON2)->EnableWindow(1 == m_iLaunch);
  572. GetDlgItem(IDC_BUTTON3)->EnableWindow(1 == m_iConfig);
  573. }
  574. BEGIN_MESSAGE_MAP(CSecurityPropertyPage, CPropertyPage)
  575. //{{AFX_MSG_MAP(CSecurityPropertyPage)
  576. ON_BN_CLICKED(IDC_RADIO1, OnDefaultAccess)
  577. ON_BN_CLICKED(IDC_RADIO2, OnCustomAccess)
  578. ON_BN_CLICKED(IDC_RADIO3, OnDefaultLaunch)
  579. ON_BN_CLICKED(IDC_RADIO4, OnCustomLaunch)
  580. ON_BN_CLICKED(IDC_RADIO5, OnDefaultConfig)
  581. ON_BN_CLICKED(IDC_RADIO6, OnCustomConfig)
  582. ON_BN_CLICKED(IDC_BUTTON1, OnEditAccess)
  583. ON_BN_CLICKED(IDC_BUTTON2, OnEditLaunch)
  584. ON_BN_CLICKED(IDC_BUTTON3, OnEditConfig)
  585. ON_WM_HELPINFO()
  586. //}}AFX_MSG_MAP
  587. END_MESSAGE_MAP()
  588. void CSecurityPropertyPage::OnDefaultAccess()
  589. {
  590. // Disable the edit access permissions window
  591. UpdateData(TRUE);
  592. // If there is an SD here then mark it for delete
  593. if (m_iAccessIndex != -1)
  594. {
  595. CDataPacket * pCdp = g_virtreg.GetAt(m_iAccessIndex);
  596. pCdp->MarkForDeletion(TRUE);
  597. SetModified(TRUE);
  598. }
  599. }
  600. void CSecurityPropertyPage::OnCustomAccess()
  601. {
  602. UpdateData(TRUE);
  603. // If there is an SD here then unmark it for delete
  604. if (m_iAccessIndex != -1)
  605. {
  606. CDataPacket * pCdp = g_virtreg.GetAt(m_iAccessIndex);
  607. pCdp->MarkForDeletion(FALSE);
  608. SetModified(TRUE);
  609. }
  610. }
  611. void CSecurityPropertyPage::OnDefaultLaunch()
  612. {
  613. UpdateData(TRUE);
  614. // If there is an SD here then mark it for delete
  615. if (m_iLaunchIndex != -1)
  616. {
  617. CDataPacket * pCdp = g_virtreg.GetAt(m_iLaunchIndex);
  618. pCdp->MarkForDeletion(TRUE);
  619. SetModified(TRUE);
  620. }
  621. }
  622. void CSecurityPropertyPage::OnCustomLaunch()
  623. {
  624. UpdateData(TRUE);
  625. // If there is an SD here then unmark it for delete
  626. if (m_iLaunchIndex != -1)
  627. {
  628. CDataPacket *pCdp = g_virtreg.GetAt(m_iLaunchIndex);
  629. pCdp->MarkForDeletion(FALSE);
  630. }
  631. }
  632. void CSecurityPropertyPage::OnDefaultConfig()
  633. {
  634. int err;
  635. ULONG ulSize = 1;
  636. BYTE *pbValue = NULL;
  637. // Read the security descriptor for HKEY_CLASSES_ROOT
  638. // Note: We always expect to get ERROR_INSUFFICIENT_BUFFER
  639. err = RegGetKeySecurity(HKEY_CLASSES_ROOT,
  640. OWNER_SECURITY_INFORMATION |
  641. GROUP_SECURITY_INFORMATION |
  642. DACL_SECURITY_INFORMATION,
  643. pbValue,
  644. &ulSize);
  645. if (err == ERROR_INSUFFICIENT_BUFFER)
  646. {
  647. pbValue = new BYTE[ulSize];
  648. if (pbValue == NULL)
  649. {
  650. return;
  651. }
  652. err = RegGetKeySecurity(HKEY_CLASSES_ROOT,
  653. OWNER_SECURITY_INFORMATION |
  654. GROUP_SECURITY_INFORMATION |
  655. DACL_SECURITY_INFORMATION,
  656. pbValue,
  657. &ulSize);
  658. }
  659. // Change the custom security back to the default, if there is a custom
  660. // security descriptor, but just in the virtual registry -
  661. // in case the user cancels
  662. if (m_iConfigurationIndex != -1)
  663. {
  664. CDataPacket * pCdb = g_virtreg.GetAt(m_iConfigurationIndex);
  665. pCdb->ChgACL((SECURITY_DESCRIPTOR *) pbValue, TRUE);
  666. pCdb->SetModified(TRUE);
  667. }
  668. delete pbValue;
  669. UpdateData(TRUE);
  670. SetModified(TRUE);
  671. }
  672. void CSecurityPropertyPage::OnCustomConfig()
  673. {
  674. // If a security descriptor already exists, then the user was here
  675. // before, then selected default configuration. So just copy the
  676. // original as the extant custom configuration
  677. if (m_iConfigurationIndex != -1)
  678. {
  679. CDataPacket *pCdb = g_virtreg.GetAt(m_iConfigurationIndex);
  680. pCdb->ChgACL(pCdb->pkt.racl.pSecOrig, TRUE);
  681. pCdb-> SetModified(TRUE);
  682. }
  683. UpdateData(TRUE);
  684. SetModified(TRUE);
  685. }
  686. void CSecurityPropertyPage::OnEditAccess()
  687. {
  688. int err;
  689. // Invoke the ACL editor
  690. err = g_util.ACLEditor(m_hWnd,
  691. g_hAppid,
  692. NULL,
  693. TEXT("AccessPermission"),
  694. &m_iAccessIndex,
  695. SingleACL,
  696. dcomAclAccess);
  697. // Enable the Apply button
  698. if (err == ERROR_SUCCESS)
  699. SetModified(TRUE);
  700. }
  701. void CSecurityPropertyPage::OnEditLaunch()
  702. {
  703. int err;
  704. // Invoke the ACL editor
  705. err = g_util.ACLEditor(m_hWnd,
  706. g_hAppid,
  707. NULL,
  708. TEXT("LaunchPermission"),
  709. &m_iLaunchIndex,
  710. SingleACL,
  711. dcomAclLaunch);
  712. // Enable the Apply button
  713. if (err == ERROR_SUCCESS)
  714. SetModified(TRUE);
  715. }
  716. void CSecurityPropertyPage::OnEditConfig()
  717. {
  718. int err = ERROR_SUCCESS;
  719. // Invoke the ACL editor
  720. err = g_util.ACLEditor2(m_hWnd,
  721. g_hAppid,
  722. g_rghkCLSID,
  723. g_cCLSIDs,
  724. g_szAppTitle,
  725. &m_iConfigurationIndex,
  726. RegKeyACL);
  727. // Enable the Apply button
  728. if (err == ERROR_SUCCESS)
  729. SetModified(TRUE);
  730. else if (err == ERROR_ACCESS_DENIED)
  731. g_util.CkForAccessDenied(ERROR_ACCESS_DENIED);
  732. else if (err != IDCANCEL)
  733. g_util.PostErrorMessage();
  734. }
  735. //+-------------------------------------------------------------------------
  736. //
  737. // Member: CSecurityPropertyPage::ValidateChanges
  738. //
  739. // Synopsis: Called to validate the changes before updating
  740. //
  741. // Arguments: None
  742. //
  743. // Returns: BOOL success flag
  744. //
  745. // Algorithm: N/A
  746. //
  747. // History: 27-Oct-97 Ronans Created
  748. //
  749. //--------------------------------------------------------------------------
  750. BOOL CSecurityPropertyPage::ValidateChanges()
  751. {
  752. UpdateData(TRUE);
  753. return TRUE;
  754. }
  755. //+-------------------------------------------------------------------------
  756. //
  757. // Member: CSecurityPropertyPage::UpdateChanges
  758. //
  759. // Synopsis: Called to update the changes to registry
  760. //
  761. // Arguments: hkAppID - HKEY for AppID
  762. //
  763. // Returns: BOOL success flag
  764. //
  765. // Algorithm: N/A
  766. //
  767. // History: 27-Oct-97 Ronans Created
  768. //
  769. //--------------------------------------------------------------------------
  770. BOOL CSecurityPropertyPage::UpdateChanges(HKEY hkAppID)
  771. {
  772. ////////////////////////////////////////////////////////////////////
  773. // Persist Security property page data
  774. // Access permissions
  775. // Use default access permissions
  776. if (m_iAccess == 0)
  777. {
  778. // Delete the local AccessPermission named value to force this
  779. // AppID to use the default global named value DefaultAccessPermission
  780. long lErr = RegDeleteValue(hkAppID, TEXT("AccessPermission"));
  781. }
  782. // Use per AppID access permissions
  783. else
  784. {
  785. // If the user edited security, then persist that now
  786. if (m_iAccessIndex >= 0)
  787. {
  788. long lErr = g_virtreg.Apply(m_iAccessIndex);
  789. g_virtreg.Remove(m_iAccessIndex);
  790. m_iAccessIndex = -1;
  791. }
  792. }
  793. // Launch permissions
  794. // Use default Launch permissions
  795. if (m_iLaunch == 0)
  796. {
  797. // Delete the local LaunchPermission named value to force this
  798. // AppID to use the default global named value DefaultLaunchPermission
  799. long lErr = RegDeleteValue(hkAppID, TEXT("LaunchPermission"));
  800. }
  801. // Use per AppID Launch permissions
  802. else
  803. {
  804. // If the user edited security, then persist that now
  805. if (m_iLaunchIndex >= 0)
  806. {
  807. long lErr = g_virtreg.Apply(m_iLaunchIndex);
  808. g_virtreg.Remove(m_iLaunchIndex);
  809. m_iLaunchIndex = -1;
  810. }
  811. }
  812. // Configuration permissions
  813. // Only meaningful on a per AppID basis
  814. // If the user edited configuration security, then persist that now
  815. if (m_iConfigurationIndex >= 0)
  816. {
  817. long lErr = g_virtreg.Apply(m_iConfigurationIndex);
  818. g_virtreg.Remove(m_iConfigurationIndex);
  819. m_iConfigurationIndex = -1;
  820. }
  821. return TRUE;
  822. }
  823. //+-------------------------------------------------------------------------
  824. //
  825. // Member: CSecurityPropertyPage::CancelChanges
  826. //
  827. // Synopsis: Called to cancel the changes to registry
  828. //
  829. // Arguments: None
  830. //
  831. // Returns: BOOL success flag
  832. //
  833. // Algorithm: N/A
  834. //
  835. // History: 27-Oct-97 Ronans Created
  836. //
  837. //--------------------------------------------------------------------------
  838. BOOL CSecurityPropertyPage::CancelChanges()
  839. {
  840. return TRUE;
  841. }
  842. /////////////////////////////////////////////////////////////////////////////
  843. // CIdentityPropertyPage property page
  844. CIdentityPropertyPage::CIdentityPropertyPage() : CPropertyPage(CIdentityPropertyPage::IDD)
  845. {
  846. //{{AFX_DATA_INIT(CIdentityPropertyPage)
  847. m_szUserName = _T("");
  848. m_szPassword = _T("");
  849. m_szConfirmPassword = _T("");
  850. m_iIdentity = -1;
  851. //}}AFX_DATA_INIT
  852. }
  853. CIdentityPropertyPage::~CIdentityPropertyPage()
  854. {
  855. }
  856. void CIdentityPropertyPage::DoDataExchange(CDataExchange* pDX)
  857. {
  858. // If server is not a service, disable IDC_RADIO4 on page4.
  859. if (m_fService)
  860. {
  861. GetDlgItem(IDC_RADIO1)->EnableWindow(FALSE);
  862. GetDlgItem(IDC_RADIO2)->EnableWindow(FALSE);
  863. }
  864. else
  865. {
  866. GetDlgItem(IDC_RADIO4)->EnableWindow(FALSE);
  867. }
  868. CPropertyPage::DoDataExchange(pDX);
  869. //{{AFX_DATA_MAP(CIdentityPropertyPage)
  870. DDX_Text(pDX, IDC_EDIT1, m_szUserName);
  871. DDV_MaxChars(pDX, m_szUserName, 128);
  872. DDX_Text(pDX, IDC_EDIT2, m_szPassword);
  873. DDV_MaxChars(pDX, m_szPassword, 128);
  874. DDX_Text(pDX, IDC_EDIT3, m_szConfirmPassword);
  875. DDV_MaxChars(pDX, m_szConfirmPassword, 128);
  876. DDX_Radio(pDX, IDC_RADIO1, m_iIdentity);
  877. //}}AFX_DATA_MAP
  878. GetDlgItem(IDC_EDIT1)->EnableWindow(2 == m_iIdentity);
  879. GetDlgItem(IDC_STATIC1)->EnableWindow(2 == m_iIdentity);
  880. GetDlgItem(IDC_EDIT2)->EnableWindow(2 == m_iIdentity);
  881. GetDlgItem(IDC_STATIC2)->EnableWindow(2 == m_iIdentity);
  882. GetDlgItem(IDC_EDIT3)->EnableWindow(2 == m_iIdentity);
  883. GetDlgItem(IDC_STATIC3)->EnableWindow(2 == m_iIdentity);
  884. GetDlgItem(IDC_BUTTON1)->EnableWindow(2 == m_iIdentity);
  885. }
  886. BEGIN_MESSAGE_MAP(CIdentityPropertyPage, CPropertyPage)
  887. //{{AFX_MSG_MAP(CIdentityPropertyPage)
  888. ON_EN_CHANGE(IDC_EDIT1, OnChange)
  889. ON_BN_CLICKED(IDC_BUTTON1, OnBrowse)
  890. ON_WM_HELPINFO()
  891. ON_EN_CHANGE(IDC_EDIT2, OnChange)
  892. ON_EN_CHANGE(IDC_EDIT3, OnChange)
  893. ON_BN_CLICKED(IDC_RADIO1, OnChange)
  894. ON_BN_CLICKED(IDC_RADIO2, OnChange)
  895. ON_BN_CLICKED(IDC_RADIO4, OnChange)
  896. ON_BN_CLICKED(IDC_RADIO3, OnChangeToUser)
  897. //}}AFX_MSG_MAP
  898. END_MESSAGE_MAP()
  899. void CIdentityPropertyPage::OnBrowse()
  900. {
  901. TCHAR szUser[128];
  902. if (g_util.InvokeUserBrowser(m_hWnd, szUser))
  903. {
  904. GetDlgItem(IDC_EDIT1)->SetWindowText(szUser);
  905. UpdateData(TRUE);
  906. SetModified(TRUE);
  907. }
  908. }
  909. void CIdentityPropertyPage::OnChange()
  910. {
  911. UpdateData(TRUE);
  912. SetModified(TRUE);
  913. }
  914. void CIdentityPropertyPage::OnChangeToUser()
  915. {
  916. if (g_util.IsBackupDC())
  917. {
  918. CString sTmp((LPCTSTR)IDS_BDCCONFIRM);
  919. int reply = AfxMessageBox(sTmp, MB_YESNO);
  920. if (reply == IDYES ) {
  921. UpdateData(TRUE);
  922. SetModified(TRUE);
  923. }
  924. else
  925. {
  926. UpdateData(FALSE);
  927. // set focus to old button
  928. switch (m_iIdentity)
  929. {
  930. case 0:
  931. GetDlgItem(IDC_RADIO1)->SetFocus();
  932. break;
  933. case 1:
  934. GetDlgItem(IDC_RADIO2)->SetFocus();
  935. break;
  936. case 2:
  937. GetDlgItem(IDC_RADIO3)->SetFocus();
  938. break;
  939. case 3:
  940. GetDlgItem(IDC_RADIO4)->SetFocus();
  941. break;
  942. }
  943. }
  944. }
  945. else
  946. {
  947. // get old identity value
  948. UpdateData(TRUE);
  949. SetModified(TRUE);
  950. }
  951. }
  952. //+-------------------------------------------------------------------------
  953. //
  954. // Member: CIdentityPropertyPage::ValidateChanges
  955. //
  956. // Synopsis: Called to validate the changes before updating
  957. //
  958. // Arguments: None
  959. //
  960. // Returns: BOOL success flag
  961. //
  962. // Algorithm: N/A
  963. //
  964. // History: 27-Oct-97 Ronans Created
  965. //
  966. //--------------------------------------------------------------------------
  967. BOOL CIdentityPropertyPage::ValidateChanges()
  968. {
  969. CString szUserName;
  970. UpdateData(TRUE);
  971. if (m_iIdentity == 2)
  972. {
  973. // Check that the username is not blank
  974. if (_tcslen(m_szUserName) == 0)
  975. {
  976. CString szTemp((LPCTSTR)IDS_BLANKUSERNAME);
  977. MessageBox(szTemp);
  978. return FALSE;
  979. }
  980. /*
  981. // Check that the password is not blank
  982. if (_tcslen(m_szPassword) == 0)
  983. {
  984. CString szTemp((LPCTSTR)IDS_BLANKPASSWORD);
  985. MessageBox(szTemp);
  986. return FALSE;
  987. }
  988. */
  989. // Check that the password has been confirmed
  990. if (m_szPassword != m_szConfirmPassword)
  991. {
  992. CString szTemp((LPCTSTR)IDS_NOMATCH);
  993. MessageBox(szTemp);
  994. return FALSE;
  995. }
  996. int iSplitPoint = m_szUserName.ReverseFind('\\');
  997. if (iSplitPoint < 0)
  998. {
  999. DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
  1000. // user didn't specify a domain
  1001. if (!GetComputerName(m_szDomain.GetBuffer(dwSize), &dwSize))
  1002. {
  1003. m_szDomain.ReleaseBuffer();
  1004. g_util.PostErrorMessage();
  1005. return FALSE;
  1006. }
  1007. m_szDomain.ReleaseBuffer();
  1008. szUserName = m_szUserName;
  1009. m_szUserName = m_szDomain + "\\" + m_szUserName;
  1010. }
  1011. else
  1012. {
  1013. // user did specify a domain
  1014. m_szDomain = m_szUserName.Left(iSplitPoint);
  1015. szUserName = m_szUserName.Mid(iSplitPoint + 1);
  1016. }
  1017. // Validate the domain and user name
  1018. BOOL fOk = FALSE;
  1019. BYTE sid[256];
  1020. DWORD cbSid = 256;
  1021. TCHAR szAcctDomain[MAX_PATH];
  1022. DWORD cbAcctDomain = MAX_PATH * sizeof(TCHAR);
  1023. SID_NAME_USE acctType;
  1024. CString sFullUserName = m_szDomain + "\\" + m_szUserName;
  1025. fOk = LookupAccountName(NULL,
  1026. (TCHAR *) ((LPCTSTR) m_szUserName),
  1027. sid,
  1028. &cbSid,
  1029. szAcctDomain,
  1030. &cbAcctDomain,
  1031. &acctType);
  1032. // if successful, then validate domain name and account type
  1033. if (fOk)
  1034. {
  1035. fOk = ((_tcsicmp((TCHAR *) ((LPCTSTR) m_szDomain), szAcctDomain) == 0)
  1036. &&
  1037. (acctType == SidTypeUser));
  1038. // If still unsuccessful, then try to match the domain against
  1039. // this computer's name
  1040. if (!fOk)
  1041. {
  1042. TCHAR szThisComputer[MAX_COMPUTERNAME_LENGTH + 1];
  1043. DWORD dwSize;
  1044. if (GetComputerName(szThisComputer, &dwSize))
  1045. {
  1046. fOk = (_tcsicmp((TCHAR *) ((LPCTSTR) szThisComputer),
  1047. szAcctDomain) == 0
  1048. &&
  1049. acctType == SidTypeDomain);
  1050. }
  1051. }
  1052. }
  1053. if (!fOk)
  1054. {
  1055. CString szTemp((LPCTSTR)IDS_NOACCOUNT);
  1056. MessageBox(szTemp);
  1057. return FALSE;
  1058. }
  1059. }
  1060. return TRUE;
  1061. }
  1062. //+-------------------------------------------------------------------------
  1063. //
  1064. // Member: CIdentityPropertyPage::UpdateChanges
  1065. //
  1066. // Synopsis: Called to update the changes to registry
  1067. //
  1068. // Arguments: hkAppID - HKEY for AppID
  1069. //
  1070. // Returns: BOOL success flag
  1071. //
  1072. // Algorithm: N/A
  1073. //
  1074. // History: 27-Oct-97 Ronans Created
  1075. //
  1076. //--------------------------------------------------------------------------
  1077. BOOL CIdentityPropertyPage::UpdateChanges(HKEY hkAppID)
  1078. {
  1079. long lErr;
  1080. #if !defined(STANDALONE_BUILD)
  1081. // Write the RunAs password to the Lsa private database
  1082. // (Note: We do this even if it's a service since QueryServiceConfig
  1083. // doesn't return the password, though we can use ChangeServiceConfig
  1084. // to set the password in the service database.)
  1085. if (m_iIdentity == 2)
  1086. {
  1087. if (!g_util.StoreUserPassword(g_szAppid, m_szPassword))
  1088. g_util.PostErrorMessage();
  1089. // Add rights to this user's account for "SeBatchLogonRight"
  1090. int err;
  1091. CString szUserName = m_szUserName;
  1092. // ronans - do not display errors when trying to set account rights on backup domain controllers
  1093. if ((err = g_util.SetAccountRights((LPCTSTR) szUserName, m_fService ? SE_SERVICE_LOGON_NAME : SE_BATCH_LOGON_NAME ) != ERROR_SUCCESS)
  1094. && !g_util.IsBackupDC())
  1095. g_util.PostErrorMessage(err);
  1096. }
  1097. #endif
  1098. switch (m_iIdentity)
  1099. {
  1100. case 0:
  1101. {
  1102. CString szTemp(TEXT("Interactive User"));
  1103. lErr = RegSetValueEx(
  1104. hkAppID,
  1105. TEXT("RunAs"),
  1106. 0,
  1107. REG_SZ,
  1108. (BYTE *)(LPCTSTR)szTemp,
  1109. (1 + szTemp.GetLength()) * sizeof(TCHAR));
  1110. break;
  1111. }
  1112. case 1:
  1113. case 3:
  1114. lErr = RegDeleteValue(hkAppID,
  1115. TEXT("RunAs"));
  1116. break;
  1117. case 2:
  1118. lErr = RegSetValueEx(hkAppID,
  1119. TEXT("RunAs"),
  1120. 0,
  1121. REG_SZ,
  1122. (BYTE *)(LPCTSTR)m_szUserName,
  1123. (1 + m_szUserName.GetLength()) *
  1124. sizeof(TCHAR));
  1125. break;
  1126. }
  1127. return TRUE;
  1128. }
  1129. //+-------------------------------------------------------------------------
  1130. //
  1131. // Member: CIdentityPropertyPage::CancelChanges
  1132. //
  1133. // Synopsis: Called to cancel the changes to registry
  1134. //
  1135. // Arguments: None
  1136. //
  1137. // Returns: BOOL success flag
  1138. //
  1139. // Algorithm: N/A
  1140. //
  1141. // History: 27-Oct-97 Ronans Created
  1142. //
  1143. //--------------------------------------------------------------------------
  1144. BOOL CIdentityPropertyPage::CancelChanges()
  1145. {
  1146. return TRUE;
  1147. }
  1148. BOOL CLocationPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1149. {
  1150. if(-1 != pHelpInfo->iCtrlId)
  1151. {
  1152. WORD hiWord = 0x8000 | CLocationPropertyPage::IDD;
  1153. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1154. DWORD dwLong = MAKELONG(loWord,hiWord);
  1155. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1156. return TRUE;
  1157. }
  1158. else
  1159. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1160. }
  1161. BOOL CSecurityPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1162. {
  1163. if(-1 != pHelpInfo->iCtrlId)
  1164. {
  1165. WORD hiWord = 0x8000 | CSecurityPropertyPage::IDD;
  1166. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1167. DWORD dwLong = MAKELONG(loWord,hiWord);
  1168. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1169. return TRUE;
  1170. }
  1171. else
  1172. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1173. }
  1174. BOOL CIdentityPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1175. {
  1176. if(-1 != pHelpInfo->iCtrlId)
  1177. {
  1178. WORD hiWord = 0x8000 | CIdentityPropertyPage::IDD;
  1179. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1180. DWORD dwLong = MAKELONG(loWord,hiWord);
  1181. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1182. return TRUE;
  1183. }
  1184. else
  1185. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1186. }