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.

1370 lines
39 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. if (err != ERROR_SUCCESS)
  659. return;
  660. }
  661. else
  662. return;
  663. // Change the custom security back to the default, if there is a custom
  664. // security descriptor, but just in the virtual registry -
  665. // in case the user cancels
  666. if (m_iConfigurationIndex != -1)
  667. {
  668. CDataPacket * pCdb = g_virtreg.GetAt(m_iConfigurationIndex);
  669. pCdb->ChgACL((SECURITY_DESCRIPTOR *) pbValue, TRUE);
  670. pCdb->SetModified(TRUE);
  671. }
  672. delete pbValue;
  673. UpdateData(TRUE);
  674. SetModified(TRUE);
  675. }
  676. void CSecurityPropertyPage::OnCustomConfig()
  677. {
  678. // If a security descriptor already exists, then the user was here
  679. // before, then selected default configuration. So just copy the
  680. // original as the extant custom configuration
  681. if (m_iConfigurationIndex != -1)
  682. {
  683. CDataPacket *pCdb = g_virtreg.GetAt(m_iConfigurationIndex);
  684. pCdb->ChgACL(pCdb->pkt.racl.pSecOrig, TRUE);
  685. pCdb-> SetModified(TRUE);
  686. }
  687. UpdateData(TRUE);
  688. SetModified(TRUE);
  689. }
  690. void CSecurityPropertyPage::OnEditAccess()
  691. {
  692. int err;
  693. // Invoke the ACL editor
  694. err = g_util.ACLEditor(m_hWnd,
  695. g_hAppid,
  696. NULL,
  697. TEXT("AccessPermission"),
  698. &m_iAccessIndex,
  699. SingleACL,
  700. dcomAclAccess);
  701. // Enable the Apply button
  702. if (err == ERROR_SUCCESS)
  703. SetModified(TRUE);
  704. }
  705. void CSecurityPropertyPage::OnEditLaunch()
  706. {
  707. int err;
  708. // Invoke the ACL editor
  709. err = g_util.ACLEditor(m_hWnd,
  710. g_hAppid,
  711. NULL,
  712. TEXT("LaunchPermission"),
  713. &m_iLaunchIndex,
  714. SingleACL,
  715. dcomAclLaunch);
  716. // Enable the Apply button
  717. if (err == ERROR_SUCCESS)
  718. SetModified(TRUE);
  719. }
  720. void CSecurityPropertyPage::OnEditConfig()
  721. {
  722. int err = ERROR_SUCCESS;
  723. // Invoke the ACL editor
  724. err = g_util.ACLEditor2(m_hWnd,
  725. g_hAppid,
  726. g_rghkCLSID,
  727. g_cCLSIDs,
  728. g_szAppTitle,
  729. &m_iConfigurationIndex,
  730. RegKeyACL);
  731. // Enable the Apply button
  732. if (err == ERROR_SUCCESS)
  733. SetModified(TRUE);
  734. else if (err == ERROR_ACCESS_DENIED)
  735. g_util.CkForAccessDenied(ERROR_ACCESS_DENIED);
  736. else if (err != IDCANCEL)
  737. g_util.PostErrorMessage();
  738. }
  739. //+-------------------------------------------------------------------------
  740. //
  741. // Member: CSecurityPropertyPage::ValidateChanges
  742. //
  743. // Synopsis: Called to validate the changes before updating
  744. //
  745. // Arguments: None
  746. //
  747. // Returns: BOOL success flag
  748. //
  749. // Algorithm: N/A
  750. //
  751. // History: 27-Oct-97 Ronans Created
  752. //
  753. //--------------------------------------------------------------------------
  754. BOOL CSecurityPropertyPage::ValidateChanges()
  755. {
  756. UpdateData(TRUE);
  757. return TRUE;
  758. }
  759. //+-------------------------------------------------------------------------
  760. //
  761. // Member: CSecurityPropertyPage::UpdateChanges
  762. //
  763. // Synopsis: Called to update the changes to registry
  764. //
  765. // Arguments: hkAppID - HKEY for AppID
  766. //
  767. // Returns: BOOL success flag
  768. //
  769. // Algorithm: N/A
  770. //
  771. // History: 27-Oct-97 Ronans Created
  772. //
  773. //--------------------------------------------------------------------------
  774. BOOL CSecurityPropertyPage::UpdateChanges(HKEY hkAppID)
  775. {
  776. ////////////////////////////////////////////////////////////////////
  777. // Persist Security property page data
  778. // Access permissions
  779. // Use default access permissions
  780. if (m_iAccess == 0)
  781. {
  782. // Delete the local AccessPermission named value to force this
  783. // AppID to use the default global named value DefaultAccessPermission
  784. long lErr = RegDeleteValue(hkAppID, TEXT("AccessPermission"));
  785. }
  786. // Use per AppID access permissions
  787. else
  788. {
  789. // If the user edited security, then persist that now
  790. if (m_iAccessIndex >= 0)
  791. {
  792. long lErr = g_virtreg.Apply(m_iAccessIndex);
  793. g_virtreg.Remove(m_iAccessIndex);
  794. m_iAccessIndex = -1;
  795. }
  796. }
  797. // Launch permissions
  798. // Use default Launch permissions
  799. if (m_iLaunch == 0)
  800. {
  801. // Delete the local LaunchPermission named value to force this
  802. // AppID to use the default global named value DefaultLaunchPermission
  803. long lErr = RegDeleteValue(hkAppID, TEXT("LaunchPermission"));
  804. }
  805. // Use per AppID Launch permissions
  806. else
  807. {
  808. // If the user edited security, then persist that now
  809. if (m_iLaunchIndex >= 0)
  810. {
  811. long lErr = g_virtreg.Apply(m_iLaunchIndex);
  812. g_virtreg.Remove(m_iLaunchIndex);
  813. m_iLaunchIndex = -1;
  814. }
  815. }
  816. // Configuration permissions
  817. // Only meaningful on a per AppID basis
  818. // If the user edited configuration security, then persist that now
  819. if (m_iConfigurationIndex >= 0)
  820. {
  821. long lErr = g_virtreg.Apply(m_iConfigurationIndex);
  822. g_virtreg.Remove(m_iConfigurationIndex);
  823. m_iConfigurationIndex = -1;
  824. }
  825. return TRUE;
  826. }
  827. //+-------------------------------------------------------------------------
  828. //
  829. // Member: CSecurityPropertyPage::CancelChanges
  830. //
  831. // Synopsis: Called to cancel the changes to registry
  832. //
  833. // Arguments: None
  834. //
  835. // Returns: BOOL success flag
  836. //
  837. // Algorithm: N/A
  838. //
  839. // History: 27-Oct-97 Ronans Created
  840. //
  841. //--------------------------------------------------------------------------
  842. BOOL CSecurityPropertyPage::CancelChanges()
  843. {
  844. return TRUE;
  845. }
  846. /////////////////////////////////////////////////////////////////////////////
  847. // CIdentityPropertyPage property page
  848. CIdentityPropertyPage::CIdentityPropertyPage() : CPropertyPage(CIdentityPropertyPage::IDD)
  849. {
  850. //{{AFX_DATA_INIT(CIdentityPropertyPage)
  851. m_szUserName = _T("");
  852. m_szPassword = _T("");
  853. m_szConfirmPassword = _T("");
  854. m_iIdentity = -1;
  855. //}}AFX_DATA_INIT
  856. }
  857. CIdentityPropertyPage::~CIdentityPropertyPage()
  858. {
  859. }
  860. void CIdentityPropertyPage::DoDataExchange(CDataExchange* pDX)
  861. {
  862. // If server is not a service, disable IDC_RADIO4 on page4.
  863. if (m_fService)
  864. {
  865. GetDlgItem(IDC_RADIO1)->EnableWindow(FALSE);
  866. GetDlgItem(IDC_RADIO2)->EnableWindow(FALSE);
  867. }
  868. else
  869. {
  870. GetDlgItem(IDC_RADIO4)->EnableWindow(FALSE);
  871. }
  872. CPropertyPage::DoDataExchange(pDX);
  873. //{{AFX_DATA_MAP(CIdentityPropertyPage)
  874. DDX_Text(pDX, IDC_EDIT1, m_szUserName);
  875. DDV_MaxChars(pDX, m_szUserName, 128);
  876. DDX_Text(pDX, IDC_EDIT2, m_szPassword);
  877. DDV_MaxChars(pDX, m_szPassword, 128);
  878. DDX_Text(pDX, IDC_EDIT3, m_szConfirmPassword);
  879. DDV_MaxChars(pDX, m_szConfirmPassword, 128);
  880. DDX_Radio(pDX, IDC_RADIO1, m_iIdentity);
  881. //}}AFX_DATA_MAP
  882. GetDlgItem(IDC_EDIT1)->EnableWindow(2 == m_iIdentity);
  883. GetDlgItem(IDC_STATIC1)->EnableWindow(2 == m_iIdentity);
  884. GetDlgItem(IDC_EDIT2)->EnableWindow(2 == m_iIdentity);
  885. GetDlgItem(IDC_STATIC2)->EnableWindow(2 == m_iIdentity);
  886. GetDlgItem(IDC_EDIT3)->EnableWindow(2 == m_iIdentity);
  887. GetDlgItem(IDC_STATIC3)->EnableWindow(2 == m_iIdentity);
  888. GetDlgItem(IDC_BUTTON1)->EnableWindow(2 == m_iIdentity);
  889. }
  890. BEGIN_MESSAGE_MAP(CIdentityPropertyPage, CPropertyPage)
  891. //{{AFX_MSG_MAP(CIdentityPropertyPage)
  892. ON_EN_CHANGE(IDC_EDIT1, OnChange)
  893. ON_BN_CLICKED(IDC_BUTTON1, OnBrowse)
  894. ON_WM_HELPINFO()
  895. ON_EN_CHANGE(IDC_EDIT2, OnChange)
  896. ON_EN_CHANGE(IDC_EDIT3, OnChange)
  897. ON_BN_CLICKED(IDC_RADIO1, OnChange)
  898. ON_BN_CLICKED(IDC_RADIO2, OnChange)
  899. ON_BN_CLICKED(IDC_RADIO4, OnChange)
  900. ON_BN_CLICKED(IDC_RADIO3, OnChangeToUser)
  901. //}}AFX_MSG_MAP
  902. END_MESSAGE_MAP()
  903. void CIdentityPropertyPage::OnBrowse()
  904. {
  905. TCHAR szUser[128];
  906. if (g_util.InvokeUserBrowser(m_hWnd, szUser))
  907. {
  908. GetDlgItem(IDC_EDIT1)->SetWindowText(szUser);
  909. UpdateData(TRUE);
  910. SetModified(TRUE);
  911. }
  912. }
  913. void CIdentityPropertyPage::OnChange()
  914. {
  915. UpdateData(TRUE);
  916. SetModified(TRUE);
  917. }
  918. void CIdentityPropertyPage::OnChangeToUser()
  919. {
  920. if (g_util.IsBackupDC())
  921. {
  922. CString sTmp((LPCTSTR)IDS_BDCCONFIRM);
  923. int reply = AfxMessageBox(sTmp, MB_YESNO);
  924. if (reply == IDYES ) {
  925. UpdateData(TRUE);
  926. SetModified(TRUE);
  927. }
  928. else
  929. {
  930. UpdateData(FALSE);
  931. // set focus to old button
  932. switch (m_iIdentity)
  933. {
  934. case 0:
  935. GetDlgItem(IDC_RADIO1)->SetFocus();
  936. break;
  937. case 1:
  938. GetDlgItem(IDC_RADIO2)->SetFocus();
  939. break;
  940. case 2:
  941. GetDlgItem(IDC_RADIO3)->SetFocus();
  942. break;
  943. case 3:
  944. GetDlgItem(IDC_RADIO4)->SetFocus();
  945. break;
  946. }
  947. }
  948. }
  949. else
  950. {
  951. // get old identity value
  952. UpdateData(TRUE);
  953. SetModified(TRUE);
  954. }
  955. }
  956. //+-------------------------------------------------------------------------
  957. //
  958. // Member: CIdentityPropertyPage::ValidateChanges
  959. //
  960. // Synopsis: Called to validate the changes before updating
  961. //
  962. // Arguments: None
  963. //
  964. // Returns: BOOL success flag
  965. //
  966. // Algorithm: N/A
  967. //
  968. // History: 27-Oct-97 Ronans Created
  969. //
  970. //--------------------------------------------------------------------------
  971. BOOL CIdentityPropertyPage::ValidateChanges()
  972. {
  973. CString szUserName;
  974. UpdateData(TRUE);
  975. if (m_iIdentity == 2)
  976. {
  977. // Check that the username is not blank
  978. if (_tcslen(m_szUserName) == 0)
  979. {
  980. CString szTemp((LPCTSTR)IDS_BLANKUSERNAME);
  981. MessageBox(szTemp);
  982. return FALSE;
  983. }
  984. /*
  985. // Check that the password is not blank
  986. if (_tcslen(m_szPassword) == 0)
  987. {
  988. CString szTemp((LPCTSTR)IDS_BLANKPASSWORD);
  989. MessageBox(szTemp);
  990. return FALSE;
  991. }
  992. */
  993. // Check that the password has been confirmed
  994. if (m_szPassword != m_szConfirmPassword)
  995. {
  996. CString szTemp((LPCTSTR)IDS_NOMATCH);
  997. MessageBox(szTemp);
  998. return FALSE;
  999. }
  1000. int iSplitPoint = m_szUserName.ReverseFind('\\');
  1001. if (iSplitPoint < 0)
  1002. {
  1003. DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
  1004. // user didn't specify a domain
  1005. if (!GetComputerName(m_szDomain.GetBuffer(dwSize), &dwSize))
  1006. {
  1007. m_szDomain.ReleaseBuffer();
  1008. g_util.PostErrorMessage();
  1009. return FALSE;
  1010. }
  1011. m_szDomain.ReleaseBuffer();
  1012. szUserName = m_szUserName;
  1013. m_szUserName = m_szDomain + "\\" + m_szUserName;
  1014. }
  1015. else
  1016. {
  1017. // user did specify a domain
  1018. m_szDomain = m_szUserName.Left(iSplitPoint);
  1019. szUserName = m_szUserName.Mid(iSplitPoint + 1);
  1020. }
  1021. // Validate the domain and user name
  1022. BOOL fOk = FALSE;
  1023. BYTE sid[256];
  1024. DWORD cbSid = 256;
  1025. TCHAR szAcctDomain[MAX_PATH];
  1026. DWORD cbAcctDomain = MAX_PATH * sizeof(TCHAR);
  1027. SID_NAME_USE acctType;
  1028. CString sFullUserName = m_szDomain + "\\" + m_szUserName;
  1029. fOk = LookupAccountName(NULL,
  1030. (TCHAR *) ((LPCTSTR) m_szUserName),
  1031. sid,
  1032. &cbSid,
  1033. szAcctDomain,
  1034. &cbAcctDomain,
  1035. &acctType);
  1036. // if successful, then validate domain name and account type
  1037. if (fOk)
  1038. {
  1039. fOk = ((_tcsicmp((TCHAR *) ((LPCTSTR) m_szDomain), szAcctDomain) == 0)
  1040. &&
  1041. (acctType == SidTypeUser));
  1042. // If still unsuccessful, then try to match the domain against
  1043. // this computer's name
  1044. if (!fOk)
  1045. {
  1046. TCHAR szThisComputer[MAX_COMPUTERNAME_LENGTH + 1];
  1047. DWORD dwSize;
  1048. if (GetComputerName(szThisComputer, &dwSize))
  1049. {
  1050. fOk = (_tcsicmp((TCHAR *) ((LPCTSTR) szThisComputer),
  1051. szAcctDomain) == 0
  1052. &&
  1053. acctType == SidTypeDomain);
  1054. }
  1055. }
  1056. }
  1057. if (!fOk)
  1058. {
  1059. CString szTemp((LPCTSTR)IDS_NOACCOUNT);
  1060. MessageBox(szTemp);
  1061. return FALSE;
  1062. }
  1063. }
  1064. return TRUE;
  1065. }
  1066. //+-------------------------------------------------------------------------
  1067. //
  1068. // Member: CIdentityPropertyPage::UpdateChanges
  1069. //
  1070. // Synopsis: Called to update the changes to registry
  1071. //
  1072. // Arguments: hkAppID - HKEY for AppID
  1073. //
  1074. // Returns: BOOL success flag
  1075. //
  1076. // Algorithm: N/A
  1077. //
  1078. // History: 27-Oct-97 Ronans Created
  1079. //
  1080. //--------------------------------------------------------------------------
  1081. BOOL CIdentityPropertyPage::UpdateChanges(HKEY hkAppID)
  1082. {
  1083. long lErr;
  1084. #if !defined(STANDALONE_BUILD)
  1085. // Write the RunAs password to the Lsa private database
  1086. // (Note: We do this even if it's a service since QueryServiceConfig
  1087. // doesn't return the password, though we can use ChangeServiceConfig
  1088. // to set the password in the service database.)
  1089. if (m_iIdentity == 2)
  1090. {
  1091. if (!g_util.StoreUserPassword(g_szAppid, m_szPassword))
  1092. g_util.PostErrorMessage();
  1093. // Add rights to this user's account for "SeBatchLogonRight"
  1094. int err;
  1095. CString szUserName = m_szUserName;
  1096. // ronans - do not display errors when trying to set account rights on backup domain controllers
  1097. if ((err = g_util.SetAccountRights((LPCTSTR) szUserName, m_fService ? SE_SERVICE_LOGON_NAME : SE_BATCH_LOGON_NAME ) != ERROR_SUCCESS)
  1098. && !g_util.IsBackupDC())
  1099. g_util.PostErrorMessage(err);
  1100. }
  1101. #endif
  1102. switch (m_iIdentity)
  1103. {
  1104. case 0:
  1105. {
  1106. CString szTemp(TEXT("Interactive User"));
  1107. lErr = RegSetValueEx(
  1108. hkAppID,
  1109. TEXT("RunAs"),
  1110. 0,
  1111. REG_SZ,
  1112. (BYTE *)(LPCTSTR)szTemp,
  1113. (1 + szTemp.GetLength()) * sizeof(TCHAR));
  1114. break;
  1115. }
  1116. case 1:
  1117. case 3:
  1118. lErr = RegDeleteValue(hkAppID,
  1119. TEXT("RunAs"));
  1120. break;
  1121. case 2:
  1122. lErr = RegSetValueEx(hkAppID,
  1123. TEXT("RunAs"),
  1124. 0,
  1125. REG_SZ,
  1126. (BYTE *)(LPCTSTR)m_szUserName,
  1127. (1 + m_szUserName.GetLength()) *
  1128. sizeof(TCHAR));
  1129. break;
  1130. }
  1131. return TRUE;
  1132. }
  1133. //+-------------------------------------------------------------------------
  1134. //
  1135. // Member: CIdentityPropertyPage::CancelChanges
  1136. //
  1137. // Synopsis: Called to cancel the changes to registry
  1138. //
  1139. // Arguments: None
  1140. //
  1141. // Returns: BOOL success flag
  1142. //
  1143. // Algorithm: N/A
  1144. //
  1145. // History: 27-Oct-97 Ronans Created
  1146. //
  1147. //--------------------------------------------------------------------------
  1148. BOOL CIdentityPropertyPage::CancelChanges()
  1149. {
  1150. return TRUE;
  1151. }
  1152. BOOL CLocationPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1153. {
  1154. if(-1 != pHelpInfo->iCtrlId)
  1155. {
  1156. WORD hiWord = 0x8000 | CLocationPropertyPage::IDD;
  1157. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1158. DWORD dwLong = MAKELONG(loWord,hiWord);
  1159. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1160. return TRUE;
  1161. }
  1162. else
  1163. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1164. }
  1165. BOOL CSecurityPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1166. {
  1167. if(-1 != pHelpInfo->iCtrlId)
  1168. {
  1169. WORD hiWord = 0x8000 | CSecurityPropertyPage::IDD;
  1170. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1171. DWORD dwLong = MAKELONG(loWord,hiWord);
  1172. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1173. return TRUE;
  1174. }
  1175. else
  1176. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1177. }
  1178. BOOL CIdentityPropertyPage::OnHelpInfo(HELPINFO* pHelpInfo)
  1179. {
  1180. if(-1 != pHelpInfo->iCtrlId)
  1181. {
  1182. WORD hiWord = 0x8000 | CIdentityPropertyPage::IDD;
  1183. WORD loWord = (WORD) pHelpInfo->iCtrlId;
  1184. DWORD dwLong = MAKELONG(loWord,hiWord);
  1185. WinHelp(dwLong, HELP_CONTEXTPOPUP);
  1186. return TRUE;
  1187. }
  1188. else
  1189. return CPropertyPage::OnHelpInfo(pHelpInfo);
  1190. }