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.

135 lines
3.4 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #ifndef __DEPPAGE__
  3. #define __DEPPAGE__
  4. #pragma once
  5. #ifndef ATLASSERT
  6. #define ATLASSERT(expr) _ASSERTE(expr)
  7. #endif
  8. #include "atlsnap.h"
  9. #include "resource.h"
  10. #include "..\common\PageHelper.h"
  11. #define WM_ENUM_NOW WM_USER + 20
  12. //-----------------------------------------------------------------------------
  13. class DependencyPage : public CSnapInPropertyPageImpl<DependencyPage>,
  14. public PageHelper
  15. {
  16. private:
  17. // supports the query builder routine.
  18. #define ServiceNode 0
  19. #define GroupNode 1
  20. typedef BYTE NODE_TYPE;
  21. #define DepService 0
  22. #define DepGroup 1
  23. #define GroupMember 2
  24. typedef BYTE QUERY_TYPE;
  25. typedef struct
  26. {
  27. LPCTSTR realName;
  28. bool loaded;
  29. NODE_TYPE nodeType;
  30. } ITEMEXTRA;
  31. #define QUERY_SIZE 512
  32. TCHAR *m_queryFormat;
  33. TCHAR *m_queryTemp;
  34. bstr_t m_ServiceName;
  35. bstr_t m_ServiceDispName;
  36. // icons for the trees.
  37. int m_servIcon;
  38. int m_sysDriverIcon;
  39. int m_emptyIcon;
  40. int m_groupIcon;
  41. // convenient strings.
  42. bstr_t m_qLang;
  43. bstr_t m_NameProp;
  44. bstr_t m_DispNameProp;
  45. CWbemServices m_Services;
  46. WbemConnectThread *m_pConnectThread;
  47. void Init(HWND hDlg);
  48. // builds the various queries.
  49. void BuildQuery(TV_ITEM *fmNode,
  50. QUERY_TYPE queryType,
  51. bool depends,
  52. bstr_t &query);
  53. // Figures out WHAT to load.
  54. void LoadLeaves(HWND hTree,
  55. TV_ITEM *fmNode,
  56. bool depends);
  57. // actually queries and loads child nodes.
  58. bool Load(HWND hTree,
  59. TV_ITEM *fmNode,
  60. bstr_t query,
  61. NODE_TYPE childType);
  62. // indicate that there's nothing below 'fmNode'.
  63. void NothingMore(HWND hTree, TV_ITEM *fmNode);
  64. // loads the roots.
  65. void LoadTrees(void);
  66. void TwoLines(UINT uID, LPCTSTR staticString, LPCTSTR inStr, LPTSTR outStr,bool bStaticFirst);
  67. public:
  68. // this page uses the global IWbemService.
  69. DependencyPage(WbemConnectThread *pConnectThread,
  70. IDataObject *pDataObject,
  71. long lNotifyHandle,
  72. bool bDeleteHandle = false,
  73. TCHAR* pTitle = NULL);
  74. virtual ~DependencyPage();
  75. HRESULT PropertyChangeNotify(long param)
  76. {
  77. return MMCPropertyChangeNotify(m_lNotifyHandle, param);
  78. }
  79. enum { IDD = IDD_DEPENDENCY };
  80. typedef CSnapInPropertyPageImpl<DependencyPage> _baseClass;
  81. BEGIN_MSG_MAP(DependencyPage)
  82. MESSAGE_HANDLER(WM_INITDIALOG, OnInit)
  83. MESSAGE_HANDLER(WM_ENUM_NOW, OnEnumNow)
  84. MESSAGE_HANDLER(WM_ASYNC_CIMOM_CONNECTED, OnEnumNow)
  85. NOTIFY_HANDLER(IDC_DEPENDS_TREE, TVN_ITEMEXPANDING, OnItemExpanding)
  86. NOTIFY_HANDLER(IDC_NEEDED_TREE, TVN_ITEMEXPANDING, OnItemExpanding)
  87. NOTIFY_HANDLER(IDC_DEPENDS_TREE, TVN_DELETEITEM, OnDeleteItem)
  88. NOTIFY_HANDLER(IDC_NEEDED_TREE, TVN_DELETEITEM, OnDeleteItem)
  89. MESSAGE_HANDLER(WM_HELP, OnF1Help)
  90. MESSAGE_HANDLER(WM_CONTEXTMENU , OnContextHelp)
  91. CHAIN_MSG_MAP(_baseClass)
  92. END_MSG_MAP()
  93. // Handler prototypes:
  94. LRESULT OnInit(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  95. LRESULT OnEnumNow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  96. LRESULT OnItemExpanding(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  97. LRESULT OnDeleteItem(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  98. LRESULT OnF1Help(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  99. LRESULT OnContextHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  100. BOOL OnApply();
  101. BOOL OnKillActive();
  102. long m_lNotifyHandle;
  103. bool m_bDeleteHandle;
  104. };
  105. #endif __DEPPAGE__