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.

546 lines
17 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // svcprop2.cpp : implementation file
  3. //
  4. // This file is used to display the 'log on information' and the
  5. // 'hardware profiles' of a given service.
  6. //
  7. // HISTORY
  8. // 10-Oct-96 t-danmo Creation.
  9. //
  10. #include "stdafx.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. // These strings are not localized
  17. // JonN 4/11/00 17756: Changed behavior so that empty string is displayed in
  18. // account name field when last logon name was LocalSystem
  19. const TCHAR szLocalSystemAccount[] = _T("LocalSystem");
  20. const TCHAR szPasswordNull[] = _T(" "); // Empty password
  21. // Array of control Ids to prevent user to change account selection
  22. const UINT rgzidDisableAccountSelection[] =
  23. {
  24. IDC_RADIO_LOGONAS_SYSTEMACCOUNT,
  25. IDC_RADIO_LOGONAS_THIS_ACCOUNT,
  26. IDC_EDIT_ACCOUNTNAME,
  27. IDC_BUTTON_CHOOSE_USER,
  28. IDC_STATIC_PASSWORD,
  29. IDC_EDIT_PASSWORD,
  30. IDC_STATIC_PASSWORD_CONFIRM,
  31. IDC_EDIT_PASSWORD_CONFIRM,
  32. 0
  33. };
  34. // Array of control Ids to indicate user to not type a password
  35. const UINT rgzidDisablePassword[] =
  36. {
  37. IDC_EDIT_ACCOUNTNAME,
  38. IDC_BUTTON_CHOOSE_USER,
  39. IDC_STATIC_PASSWORD,
  40. IDC_EDIT_PASSWORD,
  41. IDC_STATIC_PASSWORD_CONFIRM,
  42. IDC_EDIT_PASSWORD_CONFIRM,
  43. 0
  44. };
  45. // Array of control Ids to hide hardware profile listbox and releated buttons
  46. const UINT rgzidHwProfileHide[] =
  47. {
  48. IDC_LIST_HARDWARE_PROFILES,
  49. IDC_BUTTON_ENABLE,
  50. IDC_BUTTON_DISABLE,
  51. 0
  52. };
  53. // Column headers for the hardware profiles
  54. const TColumnHeaderItem rgzHardwareProfileHeader[] =
  55. {
  56. { IDS_SVC_HARDWARE_PROFILE, 75 },
  57. { IDS_SVC_STATUS, 24 },
  58. { 0, 0 },
  59. };
  60. const TColumnHeaderItem rgzHardwareProfileHeaderInst[] =
  61. {
  62. { IDS_SVC_HARDWARE_PROFILE, 55 },
  63. { IDS_SVC_INSTANCE, 22 },
  64. { IDS_SVC_STATUS, 22 },
  65. { 0, 0 },
  66. };
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CServicePageHwProfile property page
  69. IMPLEMENT_DYNCREATE(CServicePageHwProfile, CPropertyPage)
  70. CServicePageHwProfile::CServicePageHwProfile() : CPropertyPage(CServicePageHwProfile::IDD)
  71. {
  72. //{{AFX_DATA_INIT(CServicePageHwProfile)
  73. m_fAllowServiceToInteractWithDesktop = FALSE;
  74. //}}AFX_DATA_INIT
  75. m_idRadioButton = 0;
  76. m_fPasswordDirty = FALSE;
  77. }
  78. CServicePageHwProfile::~CServicePageHwProfile()
  79. {
  80. }
  81. void CServicePageHwProfile::DoDataExchange(CDataExchange* pDX)
  82. {
  83. Assert(m_pData != NULL);
  84. Assert(m_pData->m_paQSC != NULL);
  85. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  86. if (!pDX->m_bSaveAndValidate)
  87. {
  88. // Determine if service is running under 'local system'
  89. m_fIsSystemAccount = (m_pData->m_paQSC->lpServiceStartName == NULL) ||
  90. (lstrcmpi(m_pData->m_strLogOnAccountName, szLocalSystemAccount) == 0);
  91. m_fAllowServiceToInteractWithDesktop = m_fIsSystemAccount &&
  92. (m_pData->m_paQSC->dwServiceType & SERVICE_INTERACTIVE_PROCESS);
  93. // JonN 4/11/00: 17756
  94. if (m_fIsSystemAccount)
  95. m_strAccountName.Empty();
  96. else
  97. m_strAccountName = m_pData->m_strLogOnAccountName;
  98. m_strPassword =
  99. (m_fIsSystemAccount) ? szPasswordNull : m_pData->m_strPassword;
  100. m_strPasswordConfirm = m_strPassword;
  101. //
  102. // JonN 4/10/00
  103. // 89823: RPC Service:Cannot restart the service when you disable it
  104. //
  105. // Do not allow the RpcSs service to change from Local System
  106. //
  107. if ( !lstrcmpi(m_pData->m_strServiceName,L"RpcSs")
  108. && m_fIsSystemAccount )
  109. {
  110. EnableDlgItem(m_hWnd, IDC_RADIO_LOGONAS_SYSTEMACCOUNT, FALSE);
  111. EnableDlgItem(m_hWnd, IDC_RADIO_LOGONAS_THIS_ACCOUNT, FALSE);
  112. }
  113. } // if
  114. CPropertyPage::DoDataExchange(pDX);
  115. //{{AFX_DATA_MAP(CServicePageHwProfile)
  116. DDX_Check(pDX, IDC_CHECK_SERVICE_INTERACT_WITH_DESKTOP, m_fAllowServiceToInteractWithDesktop);
  117. DDX_Text(pDX, IDC_EDIT_ACCOUNTNAME, m_strAccountName);
  118. DDV_MaxChars(pDX, m_strPassword, DNLEN+UNLEN+1);
  119. DDX_Text(pDX, IDC_EDIT_PASSWORD, m_strPassword);
  120. DDV_MaxChars(pDX, m_strPassword, PWLEN);
  121. DDX_Text(pDX, IDC_EDIT_PASSWORD_CONFIRM, m_strPasswordConfirm);
  122. DDV_MaxChars(pDX, m_strPasswordConfirm, PWLEN);
  123. //}}AFX_DATA_MAP
  124. if (pDX->m_bSaveAndValidate)
  125. {
  126. if (!m_fIsSystemAccount)
  127. {
  128. TrimString(m_strAccountName);
  129. if (m_strAccountName.IsEmpty()) // JonN 4/11/00: 17756
  130. {
  131. m_fIsSystemAccount = TRUE;
  132. }
  133. }
  134. if (!m_fIsSystemAccount)
  135. {
  136. //
  137. // Log On As "This Account"
  138. //
  139. // If not system account, can't interact with desktop
  140. m_pData->m_paQSC->dwServiceType &= ~SERVICE_INTERACTIVE_PROCESS;
  141. // Search if the string contains a server name
  142. // JonN 3/16/99: and if name is not a UPN (bug 280254)
  143. if (m_strAccountName.FindOneOf(_T("@\\")) < 0)
  144. {
  145. // Add ".\" at the beginning
  146. m_strAccountName = _T(".\\") + m_strAccountName;
  147. }
  148. if (m_strPassword != m_strPasswordConfirm)
  149. {
  150. DoServicesErrMsgBox(m_hWnd, MB_OK | MB_ICONEXCLAMATION, 0, IDS_MSG_PASSWORD_MISMATCH);
  151. pDX->Fail();
  152. Assert(FALSE && "Unreachable code");
  153. }
  154. } // if (!m_fIsSystemAccount)
  155. if (m_fIsSystemAccount)
  156. {
  157. //
  158. // Log On As "System Account"
  159. //
  160. if (m_fAllowServiceToInteractWithDesktop)
  161. m_pData->m_paQSC->dwServiceType |= SERVICE_INTERACTIVE_PROCESS;
  162. else
  163. m_pData->m_paQSC->dwServiceType &= ~SERVICE_INTERACTIVE_PROCESS;
  164. m_strAccountName.Empty(); // JonN 4/11/00: 17756
  165. m_strPassword.Empty(); // Clear the password (system account don't require password)
  166. m_fPasswordDirty = FALSE;
  167. }
  168. // JonN 4/11/00: 17756
  169. BOOL fWasSystemAccount = !lstrcmpi(
  170. m_pData->m_strLogOnAccountName, szLocalSystemAccount);
  171. BOOL fAccountNameModified = (m_fIsSystemAccount)
  172. ? !fWasSystemAccount
  173. : (fWasSystemAccount || lstrcmpi(m_strAccountName, m_pData->m_strLogOnAccountName));
  174. // Check if either the Account Name or password was modified
  175. // CODEWORK Note that fAccountNameModified will be TRUE if the last write
  176. // attempt failed.
  177. if (fAccountNameModified || m_fPasswordDirty)
  178. {
  179. if (fAccountNameModified && (m_strPassword == szPasswordNull))
  180. {
  181. // Account name modified, but password not changed
  182. DoServicesErrMsgBox(m_hWnd, MB_OK | MB_ICONEXCLAMATION, 0, IDS_MSG_PASSWORD_EMPTY);
  183. pDX->PrepareEditCtrl(IDC_EDIT_PASSWORD);
  184. pDX->Fail();
  185. Assert(FALSE && "Unreacheable code");
  186. }
  187. TRACE0("Service log on account name or password modified...\n");
  188. m_pData->m_strLogOnAccountName = // JonN 4/11/00: 17756
  189. (m_fIsSystemAccount) ? szLocalSystemAccount : m_strAccountName;
  190. m_pData->m_strPassword = m_strPassword;
  191. // If the account name is changed or the password is changed,
  192. // then all the following parameters must be re-written
  193. // to the registry. Otherwise ChangeServiceConfig() will fail.
  194. // This is not documented; it is the reality.
  195. m_pData->SetDirty( (enum CServicePropertyData::_DIRTYFLAGS)
  196. (CServicePropertyData::mskfDirtyAccountName |
  197. CServicePropertyData::mskfDirtyPassword |
  198. CServicePropertyData::mskfDirtySvcType) );
  199. }
  200. } // if
  201. } // CServicePageHwProfile::DoDataExchange()
  202. BEGIN_MESSAGE_MAP(CServicePageHwProfile, CPropertyPage)
  203. //{{AFX_MSG_MAP(CServicePageHwProfile)
  204. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_HARDWARE_PROFILES, OnItemChangedListHwProfiles)
  205. ON_NOTIFY(NM_DBLCLK, IDC_LIST_HARDWARE_PROFILES, OnDblclkListHwProfiles)
  206. ON_MESSAGE(WM_HELP, OnHelp)
  207. ON_MESSAGE(WM_CONTEXTMENU, OnContextHelp)
  208. ON_BN_CLICKED(IDC_BUTTON_DISABLE, OnButtonDisableHwProfile)
  209. ON_BN_CLICKED(IDC_BUTTON_ENABLE, OnButtonEnableHwProfile)
  210. ON_BN_CLICKED(IDC_BUTTON_CHOOSE_USER, OnButtonChooseUser)
  211. ON_BN_CLICKED(IDC_RADIO_LOGONAS_SYSTEMACCOUNT, OnRadioLogonasSystemAccount)
  212. ON_BN_CLICKED(IDC_RADIO_LOGONAS_THIS_ACCOUNT, OnRadioLogonasThisAccount)
  213. ON_BN_CLICKED(IDC_CHECK_SERVICE_INTERACT_WITH_DESKTOP, OnCheckServiceInteractWithDesktop)
  214. ON_EN_CHANGE(IDC_EDIT_ACCOUNTNAME, OnChangeEditAccountName)
  215. ON_EN_CHANGE(IDC_EDIT_PASSWORD, OnChangeEditPassword)
  216. ON_EN_CHANGE(IDC_EDIT_PASSWORD_CONFIRM, OnChangeEditPasswordConfirm)
  217. ON_WM_DESTROY()
  218. //}}AFX_MSG_MAP
  219. END_MESSAGE_MAP()
  220. /////////////////////////////////////////////////////////////////////////////
  221. // CServicePageHwProfile message handlers
  222. BOOL CServicePageHwProfile::OnInitDialog()
  223. {
  224. Assert(m_pData != NULL);
  225. Assert(m_pData->m_paQSC != NULL);
  226. if (m_pData->m_paQSC == NULL)
  227. EndDialog(FALSE); // Just in case
  228. m_pData->m_strPassword = szPasswordNull;
  229. ::LoadString(g_hInstanceSave, IDS_SVC_ENABLED,
  230. OUT m_szHwProfileEnabled, LENGTH(m_szHwProfileEnabled));
  231. ::LoadString(g_hInstanceSave, IDS_SVC_DISABLED,
  232. OUT m_szHwProfileDisabled, LENGTH(m_szHwProfileDisabled));
  233. m_hwndListViewHwProfiles = ::GetDlgItem(m_hWnd, IDC_LIST_HARDWARE_PROFILES);
  234. if (m_pData->m_paHardwareProfileEntryList != NULL)
  235. {
  236. ListView_AddColumnHeaders(m_hwndListViewHwProfiles, m_pData->m_fShowHwProfileInstances
  237. ? rgzHardwareProfileHeaderInst : rgzHardwareProfileHeader);
  238. BuildHwProfileList();
  239. }
  240. else
  241. {
  242. // There are no hardware profile(s) in the list, so hide
  243. // all the controls that have something to do with hardware profiles
  244. ShowDlgItemGroup(m_hWnd, rgzidHwProfileHide, FALSE);
  245. }
  246. CPropertyPage::OnInitDialog();
  247. return TRUE;
  248. } // OnInitDialog()
  249. /////////////////////////////////////////////////////////////////////
  250. // Select a given radio button and enable/disable
  251. // controls depending on which radio button is selected
  252. void CServicePageHwProfile::SelectRadioButton(UINT idRadioButtonNew)
  253. {
  254. Assert(HGetDlgItem(m_hWnd, idRadioButtonNew));
  255. if (idRadioButtonNew == m_idRadioButton)
  256. return;
  257. m_fAllowSetModified = FALSE;
  258. CheckRadioButton(IDC_RADIO_LOGONAS_SYSTEMACCOUNT, IDC_RADIO_LOGONAS_THIS_ACCOUNT, idRadioButtonNew);
  259. if (idRadioButtonNew == IDC_RADIO_LOGONAS_SYSTEMACCOUNT)
  260. {
  261. m_fIsSystemAccount = TRUE;
  262. ::EnableDlgItemGroup(m_hWnd, rgzidDisablePassword, FALSE);
  263. if (m_idRadioButton != 0)
  264. {
  265. GetDlgItemText(IDC_EDIT_ACCOUNTNAME, m_strAccountName);
  266. GetDlgItemText(IDC_EDIT_PASSWORD, m_strPassword);
  267. GetDlgItemText(IDC_EDIT_PASSWORD_CONFIRM, m_strPasswordConfirm);
  268. }
  269. SetDlgItemText(IDC_EDIT_ACCOUNTNAME, L"");
  270. SetDlgItemText(IDC_EDIT_PASSWORD, L"");
  271. SetDlgItemText(IDC_EDIT_PASSWORD_CONFIRM, L"");
  272. }
  273. else
  274. {
  275. m_fIsSystemAccount = FALSE;
  276. ::EnableDlgItemGroup(m_hWnd, rgzidDisablePassword, TRUE);
  277. SetDlgItemText(IDC_EDIT_ACCOUNTNAME, m_strAccountName);
  278. SetDlgItemText(IDC_EDIT_PASSWORD, m_strPassword);
  279. SetDlgItemText(IDC_EDIT_PASSWORD_CONFIRM, m_strPasswordConfirm);
  280. }
  281. GetDlgItem(IDC_CHECK_SERVICE_INTERACT_WITH_DESKTOP)->EnableWindow(m_fIsSystemAccount);
  282. m_idRadioButton = idRadioButtonNew;
  283. m_fAllowSetModified = TRUE;
  284. } // CServicePageHwProfile::SelectRadioButton()
  285. /////////////////////////////////////////////////////////////////////
  286. void CServicePageHwProfile::BuildHwProfileList()
  287. {
  288. LV_ITEM lvItem;
  289. INT iItem;
  290. CHardwareProfileEntry * pHPE;
  291. Assert(IsWindow(m_hwndListViewHwProfiles));
  292. ListView_DeleteAllItems(m_hwndListViewHwProfiles);
  293. m_iItemHwProfileEntry = -1; // No profile selected
  294. GarbageInit(OUT &lvItem, sizeof(lvItem));
  295. lvItem.iItem = 0;
  296. pHPE = m_pData->m_paHardwareProfileEntryList;
  297. while (pHPE != NULL)
  298. {
  299. lvItem.mask = LVIF_TEXT | LVIF_PARAM;
  300. lvItem.lParam = (LPARAM)pHPE;
  301. lvItem.iSubItem = 0;
  302. lvItem.pszText = pHPE->m_hpi.HWPI_szFriendlyName;
  303. iItem = ListView_InsertItem(m_hwndListViewHwProfiles, IN &lvItem);
  304. Report(iItem >= 0);
  305. lvItem.iItem = iItem;
  306. lvItem.mask = LVIF_TEXT;
  307. if (m_pData->m_fShowHwProfileInstances)
  308. {
  309. lvItem.iSubItem = 1;
  310. lvItem.pszText = const_cast<LPTSTR>((LPCTSTR)pHPE->m_strDeviceNameFriendly);
  311. VERIFY(ListView_SetItem(m_hwndListViewHwProfiles, IN &lvItem));
  312. Report(iItem >= 0);
  313. }
  314. lvItem.iSubItem = m_pData->m_iSubItemHwProfileStatus;
  315. lvItem.pszText = pHPE->m_fEnabled ? m_szHwProfileEnabled : m_szHwProfileDisabled;
  316. VERIFY(ListView_SetItem(m_hwndListViewHwProfiles, IN &lvItem));
  317. pHPE = pHPE->m_pNext;
  318. } // while
  319. // Select the first item
  320. ListView_SetItemState(m_hwndListViewHwProfiles, 0, LVIS_SELECTED, LVIS_SELECTED);
  321. } // BuildHwProfileList()
  322. /////////////////////////////////////////////////////////////////////
  323. // Toggle the current hardware profile item.
  324. void CServicePageHwProfile::ToggleCurrentHwProfileItem()
  325. {
  326. if (m_iItemHwProfileEntry < 0)
  327. return;
  328. LV_ITEM lvItem;
  329. GarbageInit(OUT &lvItem, sizeof(lvItem));
  330. lvItem.mask = LVIF_PARAM;
  331. lvItem.iItem = m_iItemHwProfileEntry;
  332. lvItem.iSubItem = 0;
  333. VERIFY(ListView_GetItem(m_hwndListViewHwProfiles, OUT &lvItem));
  334. Assert(lvItem.lParam != NULL);
  335. CHardwareProfileEntry * pHPE = (CHardwareProfileEntry *)lvItem.lParam;
  336. if (pHPE != NULL && !pHPE->m_fReadOnly) // Just in case
  337. {
  338. pHPE->m_fEnabled = !pHPE->m_fEnabled;
  339. lvItem.mask = LVIF_TEXT;
  340. lvItem.iSubItem = m_pData->m_iSubItemHwProfileStatus;
  341. lvItem.pszText = pHPE->m_fEnabled ? m_szHwProfileEnabled : m_szHwProfileDisabled;
  342. VERIFY(ListView_SetItem(m_hwndListViewHwProfiles, IN &lvItem));
  343. }
  344. EnableHwProfileButtons();
  345. } // ToggleCurrentHwProfileItem()
  346. /////////////////////////////////////////////////////////////////////
  347. // Enable/disable buttons according to current hardware profile item.
  348. void CServicePageHwProfile::EnableHwProfileButtons()
  349. {
  350. BOOL fButtonEnable = FALSE;
  351. BOOL fButtonDisable = FALSE;
  352. if (m_iItemHwProfileEntry >= 0)
  353. {
  354. LV_ITEM lvItem;
  355. GarbageInit(OUT &lvItem, sizeof(lvItem));
  356. lvItem.mask = LVIF_PARAM;
  357. lvItem.iItem = m_iItemHwProfileEntry;
  358. lvItem.iSubItem = 0;
  359. VERIFY(ListView_GetItem(m_hwndListViewHwProfiles, OUT &lvItem));
  360. Assert(lvItem.lParam != NULL);
  361. CHardwareProfileEntry * pHPE = (CHardwareProfileEntry *)lvItem.lParam;
  362. if (pHPE != NULL && !pHPE->m_fReadOnly)
  363. {
  364. Assert(pHPE->m_fEnabled == TRUE || pHPE->m_fEnabled == FALSE);
  365. fButtonEnable = !pHPE->m_fEnabled;
  366. fButtonDisable = pHPE->m_fEnabled;
  367. }
  368. } // if
  369. EnableDlgItem(m_hWnd, IDC_BUTTON_ENABLE, fButtonEnable);
  370. EnableDlgItem(m_hWnd, IDC_BUTTON_DISABLE, fButtonDisable);
  371. } // EnableHwProfileButtons()
  372. void CServicePageHwProfile::OnItemChangedListHwProfiles(NMHDR* pNMHDR, LRESULT* pResult)
  373. {
  374. m_iItemHwProfileEntry = ((NM_LISTVIEW *)pNMHDR)->iItem;
  375. EnableHwProfileButtons();
  376. *pResult = 0;
  377. }
  378. void CServicePageHwProfile::OnDblclkListHwProfiles(NMHDR* /*pNMHDR*/, LRESULT* pResult)
  379. {
  380. ToggleCurrentHwProfileItem();
  381. SetModified();
  382. *pResult = 0;
  383. }
  384. void CServicePageHwProfile::OnButtonEnableHwProfile()
  385. {
  386. ToggleCurrentHwProfileItem();
  387. SetModified();
  388. ::SetDlgItemFocus(m_hWnd, IDC_BUTTON_DISABLE);
  389. }
  390. void CServicePageHwProfile::OnButtonDisableHwProfile()
  391. {
  392. ToggleCurrentHwProfileItem();
  393. SetModified();
  394. ::SetDlgItemFocus(m_hWnd, IDC_BUTTON_ENABLE);
  395. }
  396. void CServicePageHwProfile::OnButtonChooseUser()
  397. {
  398. Assert(m_pData != NULL);
  399. PUSERDETAILS paUserDetails = NULL; // Pointer to allocated USERDETAILS buffer
  400. LPCTSTR pszServerName = NULL;
  401. BOOL fSuccess;
  402. if (!m_pData->m_strMachineName.IsEmpty())
  403. pszServerName = m_pData->m_strMachineName;
  404. // Invoke the user picker dialog
  405. CString str;
  406. fSuccess = UiGetUser(m_hWnd, FALSE, pszServerName, IN OUT str);
  407. if (fSuccess)
  408. {
  409. SetDlgItemText(IDC_EDIT_ACCOUNTNAME, str);
  410. SetModified();
  411. }
  412. } // OnButtonChooseUser()
  413. void CServicePageHwProfile::OnRadioLogonasSystemAccount()
  414. {
  415. CString strAccountName;
  416. GetDlgItemText(IDC_EDIT_ACCOUNTNAME, OUT strAccountName);
  417. TrimString(strAccountName);
  418. if (!strAccountName.IsEmpty()) // JonN 4/11/00: 17756
  419. SetModified();
  420. SelectRadioButton(IDC_RADIO_LOGONAS_SYSTEMACCOUNT);
  421. }
  422. void CServicePageHwProfile::OnCheckServiceInteractWithDesktop()
  423. {
  424. m_pData->SetDirty(CServicePropertyData::mskfDirtySvcType);
  425. SetModified();
  426. }
  427. void CServicePageHwProfile::OnRadioLogonasThisAccount()
  428. {
  429. SelectRadioButton(IDC_RADIO_LOGONAS_THIS_ACCOUNT);
  430. }
  431. void CServicePageHwProfile::OnChangeEditAccountName()
  432. {
  433. if (m_fAllowSetModified)
  434. SetModified();
  435. }
  436. void CServicePageHwProfile::OnChangeEditPassword()
  437. {
  438. if (m_fAllowSetModified)
  439. {
  440. m_fPasswordDirty = TRUE;
  441. SetModified();
  442. }
  443. }
  444. void CServicePageHwProfile::OnChangeEditPasswordConfirm()
  445. {
  446. if (m_fAllowSetModified)
  447. {
  448. m_fPasswordDirty = TRUE;
  449. SetModified();
  450. }
  451. }
  452. BOOL CServicePageHwProfile::OnApply()
  453. {
  454. // Write the data into the service control database
  455. if (!m_pData->FOnApply())
  456. {
  457. // Unable to write the information
  458. return FALSE;
  459. }
  460. BOOL f = CPropertyPage::OnApply();
  461. m_fAllowSetModified = FALSE;
  462. UpdateData(FALSE);
  463. BuildHwProfileList();
  464. m_fAllowSetModified = TRUE;
  465. return f;
  466. }
  467. BOOL CServicePageHwProfile::OnSetActive()
  468. {
  469. Assert(m_pData != NULL);
  470. m_fAllowSetModified = FALSE;
  471. BOOL f = CPropertyPage::OnSetActive();
  472. m_idRadioButton = 0;
  473. SelectRadioButton(m_fIsSystemAccount ? IDC_RADIO_LOGONAS_SYSTEMACCOUNT : IDC_RADIO_LOGONAS_THIS_ACCOUNT);
  474. m_fAllowSetModified = TRUE;
  475. m_fPasswordDirty = FALSE;
  476. return f;
  477. }
  478. BOOL CServicePageHwProfile::OnHelp(WPARAM /*wParam*/, LPARAM lParam)
  479. {
  480. return DoHelp(lParam, HELP_DIALOG_TOPIC(IDD_PROPPAGE_SERVICE_HWPROFILE));
  481. }
  482. BOOL CServicePageHwProfile::OnContextHelp(WPARAM wParam, LPARAM /*lParam*/)
  483. {
  484. return DoContextHelp(wParam, HELP_DIALOG_TOPIC(IDD_PROPPAGE_SERVICE_HWPROFILE));
  485. }