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.

341 lines
8.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: setuput.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __SETUPUT_H__
  11. #define __SETUPUT_H__
  12. //+------------------------------------------------------------------------
  13. //
  14. // File: setuput.h
  15. //
  16. // Contents: Header file for setup utility functions.
  17. //
  18. // Functions:
  19. //
  20. // History: 04/20/97 JerryK Created
  21. //
  22. //-------------------------------------------------------------------------
  23. #define SERVERINSTALLTICKS 50
  24. #define CA_DEFAULT_KEY_LENGTH_ROOT 2048
  25. #define CA_DEFAULT_KEY_LENGTH_SUB 1024
  26. #define wszCERTSRVEXENAME L"certsrv.exe"
  27. #define wszCERTSRVSECTION L"certsrv"
  28. #define wszSERVERSECTION L"certsrv_server"
  29. #define wszCLIENTSECTION L"certsrv_client"
  30. #define wszOLDDOCCOMPONENT L"certsrv_doc"
  31. #define wszREGKEYOCMSUBCOMPONENTS L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents"
  32. #define wszREGKEYCERTSRVTODOLIST L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Setup\\OCManager\\ToDoList\\CertSrv"
  33. #define wszW3SVCNAME L"W3Svc"
  34. #define _JumpIfOutOfMemory(hr, label, pMem) \
  35. { \
  36. if (NULL == (pMem)) \
  37. { \
  38. (hr) = E_OUTOFMEMORY; \
  39. _JumpError((hr), label, "Out of Memory"); \
  40. } \
  41. }
  42. #define IS_CLIENT_INSTALL 0x00000001
  43. #define IS_CLIENT_REMOVE 0x00000002
  44. #define IS_CLIENT_CHANGE 0x00000004
  45. #define IS_CLIENT_UPGRADE 0x00000008
  46. #define IS_CLIENT_ENABLED 0x00000010
  47. #define IS_SERVER_INSTALL 0x00000100
  48. #define IS_SERVER_REMOVE 0x00000200
  49. #define IS_SERVER_CHANGE 0x00000400
  50. #define IS_SERVER_UPGRADE 0x00000800
  51. #define IS_SERVER_ENABLED 0x00001000
  52. #define VP_MIN 1
  53. #define VP_MAX 1000
  54. #define VP_MAX_DAYS_WEEKS_MONTHS 9999
  55. // count the number of bytes needed to fully store the WSZ
  56. #define WSZ_BYTECOUNT(__z__) \
  57. ( (__z__ == NULL) ? 0 : (wcslen(__z__)+1)*sizeof(WCHAR) )
  58. typedef enum {
  59. cscInvalid,
  60. cscTopLevel,
  61. cscServer,
  62. cscClient,
  63. } CertSubComponent;
  64. typedef struct _UNATTENDPARM
  65. {
  66. WCHAR const *pwszName;
  67. WCHAR **ppwszValue;
  68. } UNATTENDPARM;
  69. typedef struct _SUBCOMP
  70. {
  71. WCHAR const *pwszSubComponent;
  72. CertSubComponent cscSubComponent;
  73. DWORD InstallFlags;
  74. DWORD UninstallFlags;
  75. DWORD ChangeFlags;
  76. DWORD UpgradeFlags;
  77. DWORD EnabledFlags;
  78. DWORD SetupStatusFlags;
  79. BOOL fDefaultInstallUnattend;
  80. BOOL fInstallUnattend;
  81. UNATTENDPARM *aUnattendParm;
  82. } SUBCOMP;
  83. HRESULT InitCASetup(HWND, PER_COMPONENT_DATA *pComp);
  84. DWORD
  85. myDoPageRequest(
  86. IN PER_COMPONENT_DATA *pComp,
  87. IN WizardPagesType WhichOnes,
  88. IN OUT PSETUP_REQUEST_PAGES SetupPages);
  89. VOID
  90. FreeCAComponentInfo(PER_COMPONENT_DATA *pComp);
  91. HRESULT
  92. PrepareUnattendedAttributes(
  93. IN HWND hwnd,
  94. IN WCHAR const *pwszComponent,
  95. IN WCHAR const *pwszSubComponent,
  96. IN PER_COMPONENT_DATA *pComp);
  97. VOID
  98. FreeCAGlobals(VOID);
  99. HRESULT
  100. HookUnattendedServerAttributes(
  101. IN OUT PER_COMPONENT_DATA *pComp,
  102. IN OUT const SUBCOMP *pServerComp);
  103. HRESULT
  104. HookUnattendedClientAttributes(
  105. IN OUT PER_COMPONENT_DATA *pComp,
  106. IN OUT const SUBCOMP *pClientComp);
  107. SUBCOMP const *
  108. LookupSubComponent(
  109. IN CertSubComponent SubComp);
  110. HRESULT
  111. EnableVRootsAndShares(
  112. IN BOOL fFileSharesOnly,
  113. IN BOOL fUpgrade,
  114. IN BOOL fServer,
  115. IN OUT PER_COMPONENT_DATA *pComp,
  116. IN HWND hwnd);
  117. HRESULT
  118. DisableVRootsAndShares(
  119. IN BOOL fFileSharesOnly);
  120. HRESULT
  121. InstallCore(
  122. IN HWND hwnd,
  123. IN PER_COMPONENT_DATA *pComp,
  124. IN BOOL fServer);
  125. HRESULT
  126. PreUninstallCore(
  127. IN HWND hwnd,
  128. IN PER_COMPONENT_DATA *pComp);
  129. HRESULT
  130. UninstallCore(
  131. IN HWND hwnd,
  132. OPTIONAL IN PER_COMPONENT_DATA *pComp,
  133. IN DWORD PerCentCompleteBase,
  134. IN DWORD PerCentCompleteMax,
  135. IN BOOL fPreserveClient,
  136. IN BOOL fRemoveVD,
  137. IN BOOL fPreserveToDoList);
  138. HRESULT
  139. UpgradeServer(
  140. IN HWND hwnd,
  141. IN PER_COMPONENT_DATA *pComp);
  142. HRESULT
  143. UpgradeClient(
  144. IN HWND hwnd,
  145. IN PER_COMPONENT_DATA *pComp);
  146. HRESULT CreateConfigFiles(
  147. WCHAR *pwszDirectoryPath,
  148. PER_COMPONENT_DATA *pComp,
  149. BOOL fRemove);
  150. HRESULT myStringToAnsiFile(HANDLE hFile, LPCSTR psz, DWORD cch);
  151. HRESULT myStringToAnsiFile(HANDLE hFile, LPCWSTR pwsz, DWORD cch);
  152. HRESULT myStringToAnsiFile(HANDLE hFile, CHAR ch);
  153. HRESULT
  154. myGetEnvString(
  155. WCHAR **ppwszOut,
  156. WCHAR const *pwszVariable);
  157. VOID
  158. certocmBumpGasGauge(
  159. IN PER_COMPONENT_DATA *pComp,
  160. IN DWORD PerCentComplete
  161. DBGPARM(IN WCHAR const *pwszSource));
  162. HRESULT
  163. UpdateSubComponentInstallStatus(
  164. IN WCHAR const *pwszComponent,
  165. IN WCHAR const *pwszSubComponent,
  166. IN OUT PER_COMPONENT_DATA *pComp);
  167. HRESULT StartCertsrvService(BOOL fSilent);
  168. BOOL certocmIsEnabled(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  169. BOOL certocmWasEnabled(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  170. BOOL certocmInstalling(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  171. BOOL certocmUninstalling(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  172. BOOL certocmPreserving(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  173. HRESULT certocmRetrieveUnattendedText(
  174. IN WCHAR const *pwszComponent,
  175. IN WCHAR const *pwszSubComponent,
  176. IN PER_COMPONENT_DATA *pComp);
  177. SUBCOMP *
  178. TranslateSubComponent(
  179. IN WCHAR const *pwszComponent,
  180. OPTIONAL IN WCHAR const *pwszSubComponent);
  181. HRESULT
  182. certocmReadInfString(
  183. IN HINF hInf,
  184. IN WCHAR const *pwszSection,
  185. IN WCHAR const *pwszName,
  186. IN OUT WCHAR **ppwszValue);
  187. HRESULT
  188. ImportPFXAndUpdateCSPInfo(
  189. IN const HWND hDlg,
  190. IN OUT PER_COMPONENT_DATA *pComp);
  191. HRESULT CreateProgramGroups(BOOL fClient,
  192. PER_COMPONENT_DATA *pComp,
  193. HWND hwnd);
  194. HRESULT
  195. LoadDefaultCAIDAttributes(
  196. IN OUT PER_COMPONENT_DATA *pComp);
  197. HRESULT
  198. LoadDefaultAdvanceAttributes(
  199. IN OUT CASERVERSETUPINFO* pServer);
  200. HRESULT
  201. BuildDBFileName(
  202. IN WCHAR const *pwszCAName,
  203. IN WCHAR const *pwszDBDirectory,
  204. OUT WCHAR **ppwszDBFile);
  205. VOID
  206. BuildPath(
  207. OUT WCHAR *pwszOut,
  208. IN DWORD cwcOut,
  209. IN WCHAR const *pwszDir,
  210. IN WCHAR const *pwszFile);
  211. HRESULT
  212. GetDefaultDBDirectory(
  213. IN PER_COMPONENT_DATA *pComp,
  214. OUT WCHAR **ppwszDir);
  215. HRESULT
  216. GetDefaultSharedFolder(
  217. OUT WCHAR **ppwszSharedFolder);
  218. HRESULT
  219. StartAndStopService(
  220. IN HINSTANCE hInstance,
  221. IN BOOL fUnattended,
  222. IN HWND const hwnd,
  223. IN WCHAR const *pwszServiceName,
  224. IN BOOL const fStopService,
  225. IN BOOL const fConfirm,
  226. IN int iMsg,
  227. OUT BOOL *pfServiceWasRunning);
  228. HRESULT
  229. FixCertsvcService(
  230. IN PER_COMPONENT_DATA *pComp);
  231. HRESULT
  232. DetermineServerCustomModule(
  233. IN OUT PER_COMPONENT_DATA *pComp,
  234. IN BOOL fPolicy);
  235. HRESULT
  236. DetermineServerUpgradePath(
  237. IN OUT PER_COMPONENT_DATA *pComp);
  238. HRESULT
  239. DetermineClientUpgradePath(
  240. IN OUT PER_COMPONENT_DATA *pComp);
  241. HRESULT CreateCertWebDatIncPage(IN PER_COMPONENT_DATA *pComp, IN BOOL bIsServer);
  242. HRESULT
  243. CancelCertsrvInstallation(
  244. HWND hwnd,
  245. PER_COMPONENT_DATA *pComp);
  246. HRESULT
  247. BuildCACertFileName(
  248. IN HINSTANCE hInstance,
  249. IN HWND hwnd,
  250. IN BOOL fUnattended,
  251. OPTIONAL IN WCHAR *pwszSharedFolder,
  252. IN WCHAR *pwszSanitizedName,
  253. OUT WCHAR **ppwszCACertFile);
  254. HRESULT
  255. myRenameCertRegKey(
  256. IN WCHAR const *pwszSrcCAName,
  257. IN WCHAR const *pwszDesCAName);
  258. bool IsValidPeriod(const CASERVERSETUPINFO *pServer);
  259. HRESULT
  260. CheckPostBaseInstallStatus(
  261. OUT BOOL *pfFinished);
  262. // externals
  263. extern BOOL g_fShowErrMsg;
  264. extern HINSTANCE g_hInstance;
  265. extern BOOL g_fW3SvcRunning;
  266. extern WCHAR *g_pwszArgvPath;
  267. extern WCHAR *g_pwszNoService;
  268. #if DBG_CERTSRV
  269. extern WCHAR *g_pwszDumpStrings;
  270. #endif
  271. extern UNATTENDPARM aUnattendParmClient[];
  272. extern UNATTENDPARM aUnattendParmServer[];
  273. #endif // __SETUPUT_H__