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.

171 lines
4.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. root.h
  7. WINS root node information (the root node is not displayed
  8. in the MMC framework but contains information such as
  9. all of the servers in this snapin).
  10. FILE HISTORY:
  11. */
  12. #ifndef _ROOT_H
  13. #define _ROOT_H
  14. #ifndef _WINSHAND_H
  15. #include "winshand.h"
  16. #endif
  17. #ifndef _TASK_H
  18. #include <task.h>
  19. #endif
  20. #ifndef _WINSMON_H
  21. #include "winsmon.h"
  22. #endif
  23. #ifndef _SERVER_H
  24. #include "server.h"
  25. #endif
  26. #ifndef _VRFYSRV_H
  27. #include "vrfysrv.h"
  28. #endif
  29. #define COMPUTERNAME_LEN_MAX 255
  30. /*---------------------------------------------------------------------------
  31. Class: CWinsRootHandler
  32. ---------------------------------------------------------------------------*/
  33. class CWinsRootHandler : public CWinsHandler
  34. {
  35. // Interface
  36. public:
  37. CWinsRootHandler(ITFSComponentData *pCompData);
  38. ~CWinsRootHandler();
  39. // base handler functionality we override
  40. OVERRIDE_NodeHandler_HasPropertyPages();
  41. OVERRIDE_NodeHandler_CreatePropertyPages();
  42. OVERRIDE_NodeHandler_OnAddMenuItems();
  43. OVERRIDE_NodeHandler_OnCommand();
  44. OVERRIDE_NodeHandler_GetString();
  45. HRESULT LoadColumns(ITFSComponent * pComponent, MMC_COOKIE cookie, LPARAM arg, LPARAM lParam);
  46. // Result handler functionality
  47. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  48. OVERRIDE_BaseHandlerNotify_OnPropertyChange();
  49. OVERRIDE_BaseHandlerNotify_OnRemoveChildren();
  50. OVERRIDE_BaseHandlerNotify_OnExpand();
  51. OVERRIDE_ResultHandler_AddMenuItems();
  52. OVERRIDE_ResultHandler_Command();
  53. // CWinsHandler overrides
  54. virtual HRESULT InitializeNode(ITFSNode * pNode);
  55. // helper routines
  56. HRESULT GetGroupName(CString * pstrGroupName);
  57. HRESULT SetGroupName(LPCTSTR pszGroupName);
  58. // adds the server to the root node in a sorted fashion, based
  59. // on the name or IP address
  60. HRESULT AddServerSortedIp(ITFSNode * pNewNode,BOOL bNewServer);
  61. // adds the server node to the root node
  62. HRESULT AddServer( LPCWSTR pServerName,
  63. BOOL bNewServer,
  64. DWORD dwIP,
  65. BOOL fConnected,
  66. DWORD dwFlags,
  67. DWORD dwrefreshInterval,
  68. BOOL fValidateNow = TRUE
  69. );
  70. // check for the server IP and name in the list of servers present
  71. BOOL IsIPInList(ITFSNode *pNode,DWORD add);
  72. BOOL IsServerInList(ITFSNode *pNode,CString str);
  73. // checks if the service is running on the local machine
  74. HRESULT CheckMachine(ITFSNode * pRootNode, LPDATAOBJECT pDataObject);
  75. HRESULT RemoveOldEntries(ITFSNode * pRootNode, LPCTSTR pszAddr);
  76. void AddStatusNode(ITFSNode * pRoot, CWinsServerHandler * pServer);
  77. void UpdateResultMessage(ITFSNode * pNode);
  78. BOOL IsServerListEmpty(ITFSNode * pRoot);
  79. public:
  80. CDWordArray* GetIPAddList()
  81. {
  82. return &m_IPAddList;
  83. }
  84. void SetOrderByName(BOOL fOrderByName)
  85. {
  86. if (fOrderByName)
  87. m_dwFlags &= ~FLAG_SERVER_ORDER_IP;
  88. else
  89. m_dwFlags |= FLAG_SERVER_ORDER_IP;
  90. }
  91. int GetOrderByName()
  92. {
  93. return (m_dwFlags & FLAG_SERVER_ORDER_IP) ? FALSE : TRUE;
  94. }
  95. void SetShowLongName(BOOL fShowLongName)
  96. {
  97. if (fShowLongName)
  98. m_dwFlags |= FLAG_SHOW_FQDN;
  99. else
  100. m_dwFlags &= ~FLAG_SHOW_FQDN;
  101. }
  102. BOOL GetShowLongName()
  103. {
  104. return (m_dwFlags & FLAG_SHOW_FQDN) ? TRUE : FALSE;
  105. }
  106. DWORD GetUpdateInterval()
  107. {
  108. return m_dwUpdateInterval;
  109. }
  110. void SetUpdateInterval(DWORD dwValue)
  111. {
  112. m_dwUpdateInterval = dwValue;
  113. }
  114. void DismissVerifyDialog()
  115. {
  116. if (m_dlgVerify.GetSafeHwnd())
  117. m_dlgVerify.Dismiss();
  118. }
  119. BOOL m_fValidate;
  120. // flags - set if the servers in the list need to be validated
  121. // how the names are to be displayed... FQDN or host
  122. // sort order of servers in the list... Name or IP
  123. DWORD m_dwFlags;
  124. SPITFSNode m_spStatusNode;
  125. BOOL m_bMachineAdded;
  126. private:
  127. CString m_strConnected;
  128. CString m_strTaskpadTitle;
  129. CDWordArray m_IPAddList;
  130. CVerifyWins m_dlgVerify;
  131. DWORD m_dwUpdateInterval; // Holds the value in milliSec
  132. // Command Handlers
  133. HRESULT OnCreateNewServer( ITFSNode * pNode );
  134. };
  135. #endif _ROOT_H