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.

166 lines
6.3 KiB

  1. #pragma once
  2. #include "globals.h"
  3. #include "delebase.h"
  4. #include <map>
  5. #include <string>
  6. #include <vector>
  7. using namespace std;
  8. #define WEBSERVER_LIST_DELIM _T( '%' )
  9. #define NULL_TERMINATOR _T( '\0' )
  10. class CUDDIServicesNode;
  11. typedef map<tstring, tstring> CConfigMap;
  12. class CUDDIWebServerNode;
  13. typedef map<int, CUDDIWebServerNode *> CUDDIWebServerNodeMap;
  14. typedef pair<int, CUDDIWebServerNode *> CUDDIWebServerNodeMapEntry;
  15. //
  16. // Utility class.
  17. //
  18. class CStringCollection
  19. {
  20. public:
  21. CStringCollection( const wstring& strDelimitedStrings, const wstring& strDelim = L"%" );
  22. virtual ~CStringCollection();
  23. void DeleteString( const wstring& str );
  24. void AddString( const wstring& str );
  25. wstring GetDelimitedString() const;
  26. BOOL Exists( const wstring& str ) const;
  27. inline int Size() const {return _coll.size();}
  28. inline const wstring& operator[]( const int &idx ) const {return _coll[idx];}
  29. private:
  30. CStringCollection();
  31. CStringCollection( const CStringCollection& copy );
  32. CStringCollection& operator=( const CStringCollection& rhs );
  33. vector< wstring > _coll;
  34. wstring _strDelim;
  35. };
  36. //
  37. // Helper class for working with versions.
  38. //
  39. class CDBSchemaVersion
  40. {
  41. public:
  42. CDBSchemaVersion();
  43. BOOL Parse( const tstring& versionString );
  44. BOOL IsCompatible( const CDBSchemaVersion& version );
  45. public:
  46. int m_major;
  47. int m_minor;
  48. int m_build;
  49. int m_rev;
  50. tstring szVersion;
  51. private:
  52. int GetPart( const _TCHAR* token );
  53. };
  54. class CUDDISiteNode : public CDelegationBase
  55. {
  56. public:
  57. CUDDISiteNode( _TCHAR *szName, _TCHAR *szInstanceName, int id, CUDDIServicesNode *parent, BOOL bExtension );
  58. virtual ~CUDDISiteNode();
  59. static CUDDISiteNode* Create( _TCHAR *szName, _TCHAR *szInstanceName, int id, CUDDIServicesNode* parent, BOOL bExtension );
  60. static BOOL IsDatabaseServer( PTCHAR szName );
  61. static BOOL IsDatabaseServer( PTCHAR szName, PTCHAR szInstance );
  62. static BOOL CALLBACK NewDatabaseServerDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  63. static BOOL GetFullyQualifiedInstanceName( LPCTSTR szName, tstring& strInstanceName );
  64. static BOOL AddWebServerToSite( const wstring& strSite, const wstring& strWebServer, HWND hwndConsole );
  65. virtual const _TCHAR *GetDisplayName( int nCol = 0 );
  66. virtual const GUID & getNodeType() { return thisGuid; }
  67. virtual const int GetBitmapIndex() { return INDEX_DBSERVER; }
  68. virtual BOOL ChildExists( const WCHAR *pwszName );
  69. virtual BOOL HasChildren();
  70. BOOL IsDeleted() { return m_isDeleted; }
  71. HRESULT GetData();
  72. HRESULT SaveData();
  73. HRESULT AddChildrenToScopePane( IConsoleNameSpace *pConsoleNameSpace, HSCOPEITEM parent );
  74. BOOL ResetCryptography();
  75. tstring GetConnectionString();
  76. CConfigMap& GetConfigMap();
  77. const LPCTSTR GetName();
  78. const _TCHAR *GetInstanceName();
  79. size_t PublishToActiveDirectory();
  80. void RemoveFromActiveDirectory();
  81. BOOL CanPublishToActiveDirectory();
  82. CUDDIWebServerNode* FindChild( LPCTSTR szName );
  83. CUDDIServicesNode *GetStaticNode();
  84. void OnDeleteChild( const tstring& szName );
  85. void AddChild( const wstring& strName, IConsole *pConsole );
  86. public:
  87. //
  88. // Virtual functions go here (for MMCN_*)
  89. //
  90. virtual HRESULT OnSelect( CComponent *pComponent, IConsole *pConsole, BOOL bScope, BOOL bSelect );
  91. virtual HRESULT OnPropertyChange( IConsole *pConsole, CComponent *pComponent );
  92. virtual HRESULT OnUpdateItem( IConsole *pConsole, long item, ITEM_TYPE itemtype );
  93. virtual HRESULT OnRefresh( IConsole *pConsole );
  94. virtual HRESULT OnDelete( IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsoleComp );
  95. virtual HRESULT OnShowContextHelp(IDisplayHelp *pDisplayHelp, LPOLESTR helpFile);
  96. virtual HRESULT OnShow( IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem );
  97. virtual HRESULT OnExpand( IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent );
  98. virtual HRESULT OnAddMenuItems( IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed );
  99. virtual HRESULT OnMenuCommand( IConsole *pConsole, IConsoleNameSpace *pConsoleNameSpace, long lCommandID, IDataObject *pDataObject );
  100. virtual HRESULT CreatePropertyPages( IPropertySheetCallback *lpProvider, LONG_PTR handle );
  101. virtual HRESULT HasPropertySheets();
  102. virtual HRESULT GetWatermarks( HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch );
  103. virtual HRESULT RemoveChildren( IConsoleNameSpace *pNS );
  104. private:
  105. void ClearChildMap();
  106. BOOL LoadChildMap( const tstring& szWebServers );
  107. BOOL SaveChildMap( tstring& szWebServers );
  108. static HRESULT GetConfig( CConfigMap& configMap, const tstring& connectionString );
  109. static HRESULT SaveConfig( CConfigMap& configMap, const tstring& connectionString );
  110. const _TCHAR* GetNextWebServer( tstring& webServerList, int& position );
  111. void AddWebServer( tstring& webServerList, const tstring& webServer );
  112. BOOL AddChildEntry( CUDDIWebServerNode *pNode, UINT position = -1 );
  113. tstring GetConnectionStringOLEDB();
  114. static void HandleOLEDBError( HRESULT hrErr );
  115. private:
  116. //
  117. // Property page dialog procedures
  118. //
  119. static BOOL CALLBACK GeneralDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  120. static BOOL CALLBACK RolesDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  121. static BOOL CALLBACK SecurityDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  122. static BOOL CALLBACK ActiveDirectoryDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  123. static BOOL CALLBACK CryptographyDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  124. static BOOL CALLBACK AdvancedDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  125. static BOOL CALLBACK PropertyEditDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  126. static const GUID thisGuid;
  127. enum menuItems { IDM_NEW_WEBSERVER = 1, IDM_DEBUG };
  128. static UINT m_nNextChildID;
  129. _TCHAR* m_szName;
  130. _TCHAR* m_szInstanceName;
  131. tstring m_strDisplayName;
  132. LONG_PTR m_ppHandle;
  133. CUDDIServicesNode* m_pParent;
  134. BOOL m_isDeleted;
  135. CConfigMap m_mapConfig;
  136. CConfigMap m_mapChanges;
  137. CUDDIWebServerNodeMap m_mapChildren;
  138. CDBSchemaVersion m_siteVersion;
  139. public:
  140. BOOL m_bIsDirty;
  141. BOOL m_bStdSvr;
  142. };