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.

105 lines
2.7 KiB

  1. // Toolset.h A set of tools added by a menu item.
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation
  4. #pragma once // MSINFO_TOOLSET_H
  5. #include "StdAfx.h"
  6. #include <afxtempl.h>
  7. /*
  8. * CTool - A single tool object, defining the menu item and interface for execution.
  9. *
  10. * History: a-jsari 11/11/97 Initial version.
  11. */
  12. class CTool {
  13. public:
  14. CTool(CRegKey *pKeyTool = NULL);
  15. ~CTool() { }
  16. const CString &GetName() const { return m_strName; }
  17. const CString &GetDescription() const { return m_strDescription; }
  18. const CTool &operator=(const CTool &tCopy);
  19. HRESULT RunTool();
  20. virtual BOOL IsValid() const { return m_fValid; }
  21. virtual const CString &GetPath() { return m_strPath; }
  22. virtual const CString &GetParam() { return m_strParam; }
  23. static BOOL PolicyPermitRun();
  24. protected:
  25. BOOL PathExists() const;
  26. BOOL m_fValid;
  27. CString m_strName;
  28. CString m_strPath;
  29. CString m_strParam;
  30. CString m_strDescription;
  31. };
  32. class CSystemInfoScope;
  33. /*
  34. * CCabTool - A tool to run the internal cab explosion code.
  35. *
  36. * History: a-jsari 2/13/98 Initial version
  37. */
  38. class CCabTool : public CTool {
  39. public:
  40. CCabTool(CSystemInfoScope *pScope);
  41. ~CCabTool() {};
  42. BOOL IsValid() const;
  43. const CString &GetPath();
  44. const CString &GetParam();
  45. private:
  46. CSystemInfoScope *m_pScope;
  47. };
  48. /*
  49. * CToolset - A set of tools under a common heading.
  50. *
  51. * History: a-jsari 11/6/97 Initial version
  52. */
  53. class CToolset {
  54. public:
  55. CToolset(CSystemInfoScope *pScope, CRegKey *pKeyTool = NULL, CString *szName = NULL);
  56. ~CToolset();
  57. const CString &GetName() const { return m_strName; }
  58. unsigned GetToolCount() const { return (unsigned)m_Tools.GetSize(); }
  59. const CString &GetToolName(unsigned iTool) const { return m_Tools[iTool]->GetName(); }
  60. HRESULT RunTool(unsigned iTool) const { return m_Tools[iTool]->RunTool(); }
  61. HRESULT AddToMenu(unsigned long iSet, CMenu *pMenu);
  62. const CToolset &operator=(const CToolset &tCopy);
  63. static const unsigned MAXIMUM_TOOLS;
  64. private:
  65. static BOOL s_fCabAdded;
  66. CMenu *m_pPopup;
  67. CString m_strName;
  68. CArray <CTool *, CTool * &> m_Tools;
  69. };
  70. /*
  71. * CToolList - A list of toolsets. Currently only one of these exists in the
  72. * CSystemInfo item.
  73. *
  74. * History: a-jsari 11/6/97 Initial version.
  75. */
  76. class CToolList {
  77. public:
  78. CToolList(CSystemInfoScope *pScope);
  79. ~CToolList();
  80. void Add(CToolset *pTool);
  81. HRESULT AddToMenu(CMenu *pMenu);
  82. CToolset *operator[](int iSet) const;
  83. static long Register(BOOL fRegister = TRUE);
  84. static void ReplaceString(CString & strString, const CString & strFind, const CString & strReplace);
  85. private:
  86. CMenu *m_pMainPopup;
  87. CArray <CToolset *, CToolset * &> m_InternalList;
  88. };
  89.