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.

138 lines
4.5 KiB

  1. //=============================================================================
  2. // PageServices.h : Declaration of the CPageServices
  3. //=============================================================================
  4. #if !defined(AFX_PAGESERVICES_H__DE6A034D_3151_4CA3_9964_8F2CE73F6374__INCLUDED_)
  5. #define AFX_PAGESERVICES_H__DE6A034D_3151_4CA3_9964_8F2CE73F6374__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. // PageServices.h : header file
  10. //
  11. #include "mscfgver.h"
  12. #include <winsvc.h>
  13. #include "MSConfigState.h"
  14. #include "PageBase.h"
  15. #define HIDEWARNINGVALUE _T("HideEssentialServiceWarning")
  16. extern LPCTSTR aszEssentialServices[];
  17. extern int CALLBACK ServiceListSortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  18. class CPageServices : public CPropertyPage, public CPageBase
  19. {
  20. DECLARE_DYNCREATE(CPageServices)
  21. // Sorting function needs to be a friend to access CServiceInfo class.
  22. friend int CALLBACK ServiceListSortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  23. private:
  24. //-------------------------------------------------------------------------
  25. // This class is used to encapsulate a service for the services tab.
  26. //-------------------------------------------------------------------------
  27. class CServiceInfo
  28. {
  29. public:
  30. CServiceInfo(LPCTSTR szService, BOOL fChecked = FALSE, DWORD dwStartType = 0, LPCTSTR szManufacturer = NULL, LPCTSTR szDisplay = NULL)
  31. : m_strService(szService), m_fChecked(fChecked), m_dwOldState(dwStartType)
  32. {
  33. if (szManufacturer != NULL)
  34. m_strManufacturer = szManufacturer;
  35. if (szDisplay != NULL)
  36. m_strDisplay = szDisplay;
  37. };
  38. CString m_strService;
  39. CString m_strManufacturer;
  40. CString m_strDisplay;
  41. BOOL m_fChecked;
  42. DWORD m_dwOldState;
  43. CString m_strEssential;
  44. CString m_strStatus;
  45. };
  46. public:
  47. CPageServices();
  48. ~CPageServices();
  49. void LoadServiceList();
  50. void EmptyServiceList(BOOL fUpdateUI = TRUE);
  51. void SetCheckboxesFromRegistry();
  52. void SetRegistryFromCheckboxes(BOOL fCommit = FALSE);
  53. void SetStateAll(BOOL fNewState);
  54. BOOL SetServiceStateFromCheckboxes();
  55. BOOL GetServiceInfo(SC_HANDLE schService, DWORD & dwStartType, CString & strPath);
  56. void GetManufacturer(LPCTSTR szFilename, CString & strManufacturer);
  57. void SaveServiceState();
  58. void RestoreServiceState();
  59. BOOL IsServiceEssential(CServiceInfo * pService);
  60. TabState GetCurrentTabState();
  61. LPCTSTR GetName() { return _T("services"); };
  62. BOOL OnApply();
  63. void CommitChanges();
  64. void SetNormal();
  65. void SetDiagnostic();
  66. void SetControlState();
  67. HWND GetDlgItemHWND(UINT nID)
  68. {
  69. HWND hwnd = NULL;
  70. CWnd * pWnd = GetDlgItem(nID);
  71. if (pWnd)
  72. hwnd = pWnd->m_hWnd;
  73. ASSERT(hwnd);
  74. return hwnd;
  75. }
  76. // Dialog Data
  77. //{{AFX_DATA(CPageServices)
  78. enum { IDD = IDD_PAGESERVICES };
  79. // NOTE - ClassWizard will add data members here.
  80. // DO NOT EDIT what you see in these blocks of generated code !
  81. //}}AFX_DATA
  82. // Overrides
  83. // ClassWizard generate virtual function overrides
  84. //{{AFX_VIRTUAL(CPageServices)
  85. protected:
  86. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  87. //}}AFX_VIRTUAL
  88. // Implementation
  89. protected:
  90. // Generated message map functions
  91. //{{AFX_MSG(CPageServices)
  92. virtual BOOL OnInitDialog();
  93. afx_msg void OnDestroy();
  94. afx_msg void OnItemChangedListServices(NMHDR* pNMHDR, LRESULT* pResult);
  95. afx_msg void OnButtonDisableAll();
  96. afx_msg void OnButtonEnableAll();
  97. afx_msg void OnCheckHideMS();
  98. afx_msg void OnColumnClickListServices(NMHDR* pNMHDR, LRESULT* pResult);
  99. afx_msg void OnSetFocusList(NMHDR* pNMHDR, LRESULT* pResult);
  100. //}}AFX_MSG
  101. DECLARE_MESSAGE_MAP()
  102. private:
  103. CWindow m_list; // attached to the list view
  104. BOOL m_fFillingList; // true if we're currently filling the list with services
  105. LPBYTE m_pBuffer; // buffer used to get service start type
  106. DWORD m_dwSize; // the size of the buffer
  107. CFileVersionInfo m_fileversion; // used to query manufacturer
  108. BOOL m_fHideMicrosoft; // whether to show Microsoft services
  109. BOOL m_fShowWarning; // show the warning for trying to disable essential service
  110. CStringList m_listDisabled; // list of the disabled services (used to preserve state when hiding MS services)
  111. int m_iLastColumnSort; // last column the user sorted by
  112. int m_iSortReverse; // used to keep track of multiple sorts on a column
  113. };
  114. //{{AFX_INSERT_LOCATION}}
  115. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  116. #endif // !defined(AFX_PAGESERVICES_H__DE6A034D_3151_4CA3_9964_8F2CE73F6374__INCLUDED_)