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.

282 lines
6.3 KiB

  1. // Copyright (C) 2002 Microsoft Corporation
  2. //
  3. // class ManageYourServer, which implements IManageYourServer
  4. //
  5. // 21 January 2002 sburns
  6. #ifndef MANAGEYOURSERVER_HPP_INCLUDED
  7. #define MANAGEYOURSERVER_HPP_INCLUDED
  8. #include <cys.h>
  9. enum HardenedLevel {
  10. NO_HARDENING,
  11. USERS_HARDENED,
  12. ADMINS_HARDENED,
  13. ALL_HARDENED
  14. };
  15. class ManageYourServer
  16. :
  17. public IManageYourServer /* ,
  18. public ISupportErrorInfo */ // CODEWORK: add support for ErrorInfo
  19. {
  20. // this is the only entity with access to the ctor of this class
  21. friend class ClassFactory<ManageYourServer>;
  22. public:
  23. // IUnknown methods
  24. virtual
  25. HRESULT __stdcall
  26. QueryInterface(const IID& riid, void **ppv);
  27. virtual
  28. ULONG __stdcall
  29. AddRef();
  30. virtual
  31. ULONG __stdcall
  32. Release();
  33. // IDispatch methods
  34. virtual
  35. HRESULT __stdcall
  36. GetTypeInfoCount(UINT *pcti);
  37. virtual
  38. HRESULT __stdcall
  39. GetTypeInfo(UINT cti, LCID, ITypeInfo **ppti);
  40. virtual
  41. HRESULT __stdcall
  42. GetIDsOfNames(
  43. REFIID riid,
  44. OLECHAR **prgpsz,
  45. UINT cNames,
  46. LCID lcid,
  47. DISPID *prgids);
  48. virtual
  49. HRESULT __stdcall
  50. Invoke(
  51. DISPID id,
  52. REFIID riid,
  53. LCID lcid,
  54. WORD wFlags,
  55. DISPPARAMS *params,
  56. VARIANT *pVarResult,
  57. EXCEPINFO *pei,
  58. UINT *puArgErr);
  59. // // ISupportErrorInfo methods
  60. //
  61. // virtual
  62. // HRESULT __stdcall
  63. // InterfaceSupportsErrorInfo(const IID& iid);
  64. //
  65. // IManageYourServer methods
  66. //
  67. virtual
  68. HRESULT __stdcall
  69. GetConfiguredRoleMarkup(
  70. /* [retval][out] */ BSTR *result);
  71. virtual
  72. HRESULT __stdcall
  73. HasRoleStatusChanged(
  74. /* [retval][out] */ BOOL *result);
  75. virtual
  76. HRESULT __stdcall
  77. IsClusterNode(
  78. /* [retval][out] */ BOOL *result);
  79. virtual
  80. HRESULT __stdcall
  81. IsCurrentUserAnAdministrator(
  82. /* [out, retval] */ BOOL* result);
  83. virtual
  84. HRESULT __stdcall
  85. IsSupportedSku(
  86. /* [out, retval] */ BOOL* result);
  87. virtual
  88. HRESULT __stdcall
  89. IsStartupFlagSet(
  90. /* [out, retval] */ BOOL* result);
  91. virtual
  92. HRESULT __stdcall
  93. SetRunAtLogon(
  94. /* [in] */ BOOL newState);
  95. // NTRAID#NTBUG9-530202-29-Mar-2002-jrowlett
  96. // support needed to check if link is valid
  97. virtual
  98. HRESULT __stdcall
  99. IsServerManagementConsolePresent(
  100. /* [out, retval] */ BOOL* result );
  101. // NTRAID#NTBUG9-602954-29-Apr-2002-jrowlett
  102. // support hiding the startup checkbox when policy is enabled.
  103. virtual
  104. HRESULT __stdcall
  105. IsShowAtStartupPolicyEnabled(
  106. /* [out, retval] */ BOOL* result );
  107. // NTRAID#NTBUG9-627875-2002/05/22-artm
  108. // support hiding startup checkbox when running on datacenter server
  109. virtual
  110. HRESULT __stdcall
  111. IsDatacenterServer(
  112. /* [out, retval] */ BOOL* result );
  113. // NTRAID#NTBUG9-648428-2002/06/25-artm
  114. // support hiding web application server console link if on IA64
  115. virtual
  116. HRESULT __stdcall
  117. IsWebServerConsolePresent(
  118. /* [out, retval] */ BOOL* result );
  119. // NTRAID#NTBUG9-632113-2002/07/01-artm
  120. // support saving collapsed/expanded state of role nodes
  121. virtual
  122. HRESULT __stdcall
  123. CollapseRole(
  124. /* [in] */ BSTR roleId, /* [in] */ BOOL collapse );
  125. // NTRAID#NTBUG9-632113-2002/07/01-artm
  126. // support checking collapsed state of role nodes
  127. virtual
  128. HRESULT __stdcall
  129. IsRoleCollapsed(
  130. /* [in] */ BSTR roleId, /* [out, retval] */ BOOL* result);
  131. // NTRAID#NTBUG9-680200-2002/08/01-artm
  132. // Support retrieving working area of the display.
  133. //
  134. // Area info is returned as a comma separated string b/c JScript does not
  135. // support getting back SAFEARRAY's.
  136. //
  137. // e.g. "0,0,800,600" --> working area is 800 wide, 600 high, and starts at
  138. // screen position (0,0)
  139. virtual
  140. HRESULT __stdcall
  141. GetWorkingAreaInfo(
  142. /* [out, retval] */ BSTR* info);
  143. private:
  144. // only our friend class factory can instantiate us.
  145. ManageYourServer();
  146. // only Release can cause us to be deleted
  147. virtual
  148. ~ManageYourServer();
  149. // not implemented: no copying allowed
  150. ManageYourServer(const ManageYourServer&);
  151. const ManageYourServer& operator=(const ManageYourServer&);
  152. struct RoleStatus
  153. {
  154. ServerRole role; // The enum used to identify a role
  155. InstallationStatus status; // The enum used for the role's state
  156. // we sort by role
  157. bool
  158. operator<(const RoleStatus& rhs) const
  159. {
  160. if (this == &rhs)
  161. {
  162. return false;
  163. }
  164. return this->role < rhs.role;
  165. }
  166. bool
  167. operator==(const RoleStatus& rhs) const
  168. {
  169. if (this == &rhs)
  170. {
  171. // identity is equality
  172. return true;
  173. }
  174. return (this->role == rhs.role) && (this->status == rhs.status);
  175. }
  176. };
  177. typedef
  178. std::vector<RoleStatus, Burnslib::Heap::Allocator<RoleStatus> >
  179. RoleStatusVector;
  180. typedef void (*ParamSubFunc)(String& target);
  181. typedef
  182. std::map<
  183. ServerRole,
  184. std::pair<String, ParamSubFunc>,
  185. std::less<ServerRole>,
  186. Burnslib::Heap::Allocator<std::pair<String, ParamSubFunc> > >
  187. RoleToFragmentNameMap;
  188. static
  189. void
  190. AppendXmlFragment(
  191. String& s,
  192. const String& fragName,
  193. ParamSubFunc subFunc);
  194. static
  195. void
  196. BuildFragMap();
  197. static
  198. void
  199. GetRoleStatus(RoleStatusVector& stat);
  200. // NTRAID#NTBUG9-698722-2002/09/03-artm
  201. static
  202. void
  203. InitDCPromoStatusCheck();
  204. static bool isDCCheckInitialized;
  205. static RoleToFragmentNameMap fragMap;
  206. static bool fragMapBuilt;
  207. RoleStatusVector roleStatus;
  208. ComServerReference dllref;
  209. long refcount;
  210. ITypeInfo** m_ppTypeInfo;
  211. bool foundTLS; // Found terminal licensing server?
  212. HardenedLevel ieSecurity; // Level of IE security (hardening patch)
  213. };
  214. #endif // MANAGEYOURSERVER_HPP_INCLUDED