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.

319 lines
8.1 KiB

  1. // Copyright (c) 2001 Microsoft Corporation
  2. //
  3. // File: InstallationUnit.h
  4. //
  5. // Synopsis: Declares an InstallationUnit
  6. // An InstallationUnit represents a single
  7. // entity that can be installed. (i.e. DHCP, IIS, etc.)
  8. //
  9. // History: 02/03/2001 JeffJon Created
  10. #ifndef __CYS_SERVERATIONUNIT_H
  11. #define __CYS_SERVERATIONUNIT_H
  12. #include "pch.h"
  13. #include "resource.h"
  14. #include "InstallationProgressPage.h"
  15. // These are the values that can be returned from
  16. // InstallationUnit::InstallService()
  17. typedef enum
  18. {
  19. INSTALL_SUCCESS,
  20. INSTALL_FAILURE,
  21. // this means that there should be no
  22. // logging and reboot is handled by DCPromo
  23. // or Terminal Services installation
  24. INSTALL_SUCCESS_REBOOT,
  25. // this means that the finish page should
  26. // prompt the user to reboot
  27. INSTALL_SUCCESS_PROMPT_REBOOT,
  28. // this means that the operation requires
  29. // a reboot but the user chose not to reboot
  30. INSTALL_SUCCESS_NEEDS_REBOOT,
  31. // this means that the operation failed but
  32. // still requires a reboot and the user
  33. // chose not to reboot
  34. INSTALL_FAILURE_NEEDS_REBOOT,
  35. // No changes were selected while going
  36. // through the wizard
  37. INSTALL_NO_CHANGES,
  38. // Installation was cancelled
  39. INSTALL_CANCELLED
  40. } InstallationReturnType;
  41. // These are the values that can be returned from
  42. // InstallationUnit::UnInstallService()
  43. typedef enum
  44. {
  45. UNINSTALL_SUCCESS,
  46. UNINSTALL_FAILURE,
  47. // this means that there should be no
  48. // logging and reboot is handled by DCPromo
  49. // or Terminal Services installation
  50. UNINSTALL_SUCCESS_REBOOT,
  51. // this means that the finish page should
  52. // prompt the user to reboot
  53. UNINSTALL_SUCCESS_PROMPT_REBOOT,
  54. // this means that the operation succeeded
  55. // and requires a reboot but the user chose
  56. // not to reboot
  57. UNINSTALL_SUCCESS_NEEDS_REBOOT,
  58. // this means that the operation failed
  59. // and requires a reboot but the user chose
  60. // not to reboot
  61. UNINSTALL_FAILURE_NEEDS_REBOOT,
  62. // Uninstall was cancelled
  63. UNINSTALL_CANCELLED,
  64. // Some installation units do not have
  65. // uninstalls (ie ExpressInstallationUnit)
  66. UNINSTALL_NO_CHANGES
  67. } UnInstallReturnType;
  68. // This array of strings if for the UI log debugging only
  69. // It should match the values in the InstallationReturnType
  70. // or UninstallReturnType
  71. // above. The values of the enums are used to index these arrays
  72. extern String installReturnTypeStrings[];
  73. extern String uninstallReturnTypeStrings[];
  74. // These macros are used to make it easier to log the return value from
  75. // the InstallService() and UnInstallService() methods. It takes an
  76. // InstallationReturnType or UnInstallReturnType and uses that to index
  77. // the appropriate array of strings (installReturnTypeStrings or
  78. // uninstallReturnTypeStrings) to get a string that is then logged
  79. // to the the UI debug logfile
  80. #define LOG_INSTALL_RETURN(returnType) LOG(installReturnTypeStrings[returnType]);
  81. #define LOG_UNINSTALL_RETURN(returnType) LOG(uninstallReturnTypeStrings[returnType]);
  82. class InstallationUnit
  83. {
  84. public:
  85. // Constructor
  86. InstallationUnit(
  87. unsigned int serviceNameID,
  88. unsigned int serviceDescriptionID,
  89. unsigned int finishPageTitleID,
  90. unsigned int finishPageUninstallTitleID,
  91. unsigned int finishPageMessageID,
  92. unsigned int finishPageInstallFailedMessageID,
  93. unsigned int finishPageUninstallMessageID,
  94. unsigned int finishPageUninstallFailedMessageID,
  95. unsigned int uninstallMilestonePageWarningID,
  96. unsigned int uninstallMilestonePageCheckboxID,
  97. const String finishPageHelpString,
  98. const String installMilestoneHelpString,
  99. const String afterFinishHelpString,
  100. ServerRole newInstallType = NO_SERVER);
  101. // Destructor
  102. virtual
  103. ~InstallationUnit() {}
  104. // Installation virtual method
  105. virtual
  106. InstallationReturnType
  107. InstallService(HANDLE logfileHandle, HWND hwnd) = 0;
  108. virtual
  109. UnInstallReturnType
  110. UnInstallService(HANDLE logfileHandle, HWND hwnd) = 0;
  111. virtual
  112. InstallationReturnType
  113. CompletePath(HANDLE logfileHandle, HWND hwnd);
  114. void
  115. SetInstallResult(InstallationReturnType result);
  116. InstallationReturnType
  117. GetInstallResult() const;
  118. void
  119. SetUninstallResult(UnInstallReturnType result);
  120. UnInstallReturnType
  121. GetUnInstallResult() const;
  122. void
  123. SetInstalling(bool installRole);
  124. bool
  125. Installing() { return installing; }
  126. virtual
  127. void
  128. DoPostInstallAction(HWND);
  129. virtual
  130. InstallationStatus
  131. GetStatus();
  132. virtual
  133. bool
  134. IsServiceInstalled();
  135. // Return true if the installation unit will make some
  136. // changes during InstallService. Return false if
  137. // if it will not
  138. virtual
  139. bool
  140. GetMilestoneText(String& message) = 0;
  141. virtual
  142. bool
  143. GetUninstallMilestoneText(String& message) = 0;
  144. virtual
  145. String
  146. GetUninstallWarningText();
  147. virtual
  148. String
  149. GetUninstallCheckboxText();
  150. virtual
  151. String
  152. GetFinishText();
  153. virtual
  154. String
  155. GetFinishTitle();
  156. // Data accessors
  157. virtual
  158. String
  159. GetServiceName();
  160. virtual
  161. String
  162. GetServiceDescription();
  163. virtual
  164. String
  165. GetFinishHelp();
  166. virtual
  167. String
  168. GetMilestonePageHelp();
  169. virtual
  170. String
  171. GetAfterFinishHelp();
  172. ServerRole
  173. GetServerRole() { return role; }
  174. virtual
  175. int
  176. GetWizardStart();
  177. // This is called from the CustomServerPage in response to
  178. // a link in the description text being selected
  179. //
  180. // linkIndex - the index of the link in the description
  181. // as defined by the SysLink control
  182. // hwnd - HWND of the CustomServerPage
  183. virtual
  184. void
  185. ServerRoleLinkSelected(int /*linkIndex*/, HWND /*hwnd*/) {};
  186. // This is called from the FinishPage in response to
  187. // a link in the message text being selected
  188. //
  189. // linkIndex - the index of the link in the message
  190. // as defined by the SysLink control
  191. // hwnd - HWND of the FinishPage
  192. virtual
  193. void
  194. FinishLinkSelected(int /*inkIndex*/, HWND /*hwnd*/) {};
  195. // This is called from the Milestone pages to see if the
  196. // installer is already running. The default behavior
  197. // is to check to see if the Windows Setup Wizard is
  198. // running and popup an error if it is. This function
  199. // will return true if the installer is already in use.
  200. // Override this function in the subclasses to check a
  201. // different installer (ie DCPromo.exe for the AD role)
  202. // or popup a different message.
  203. //
  204. // hwnd - wizard page HWND
  205. virtual
  206. bool
  207. DoInstallerCheck(HWND hwnd) const;
  208. protected:
  209. void
  210. UpdateInstallationProgressText(
  211. HWND hwnd,
  212. unsigned int messageID);
  213. String name;
  214. String description;
  215. String finishHelp;
  216. String milestoneHelp;
  217. String afterFinishHelp;
  218. unsigned int nameID;
  219. unsigned int descriptionID;
  220. unsigned int finishTitleID;
  221. unsigned int finishUninstallTitleID;
  222. unsigned int finishMessageID;
  223. unsigned int finishInstallFailedMessageID;
  224. unsigned int finishUninstallMessageID;
  225. unsigned int finishUninstallFailedMessageID;
  226. unsigned int uninstallMilestoneWarningID;
  227. unsigned int uninstallMilestoneCheckboxID;
  228. bool installing;
  229. private:
  230. InstallationReturnType installationResult;
  231. UnInstallReturnType uninstallResult;
  232. ServerRole role;
  233. };
  234. #endif // __CYS_SERVERATIONUNIT_H