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.

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