Source code of Windows XP (NT5)
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.

340 lines
8.0 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. HRESULT
  117. DisableVRootsAndShares(
  118. IN BOOL fFileSharesOnly);
  119. HRESULT
  120. InstallCore(
  121. IN HWND hwnd,
  122. IN PER_COMPONENT_DATA *pComp,
  123. IN BOOL fServer);
  124. HRESULT
  125. PreUninstallCore(
  126. IN HWND hwnd,
  127. IN PER_COMPONENT_DATA *pComp,
  128. IN BOOL fPreserveClient);
  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(WCHAR *pwszDirectoryPath,
  147. PER_COMPONENT_DATA *pComp, BOOL fRemove, HWND hwnd);
  148. HRESULT myStringToAnsiFile(HANDLE hFile, LPCSTR psz, DWORD cch);
  149. HRESULT myStringToAnsiFile(HANDLE hFile, LPCWSTR pwsz, DWORD cch);
  150. HRESULT myStringToAnsiFile(HANDLE hFile, CHAR ch);
  151. HRESULT
  152. myGetEnvString(
  153. WCHAR **ppwszOut,
  154. WCHAR const *pwszVariable);
  155. VOID
  156. certocmBumpGasGauge(
  157. IN PER_COMPONENT_DATA *pComp,
  158. IN DWORD PerCentComplete
  159. DBGPARM(IN WCHAR const *pwszSource));
  160. HRESULT
  161. UpdateSubComponentInstallStatus(
  162. IN WCHAR const *pwszComponent,
  163. IN WCHAR const *pwszSubComponent,
  164. IN OUT PER_COMPONENT_DATA *pComp);
  165. HRESULT StartCertsrvService(BOOL fSilent);
  166. BOOL certocmIsEnabled(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  167. BOOL certocmWasEnabled(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  168. BOOL certocmInstalling(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  169. BOOL certocmUninstalling(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  170. BOOL certocmPreserving(PER_COMPONENT_DATA *pComp, CertSubComponent SubComp);
  171. HRESULT certocmRetrieveUnattendedText(
  172. IN WCHAR const *pwszComponent,
  173. IN WCHAR const *pwszSubComponent,
  174. IN PER_COMPONENT_DATA *pComp);
  175. SUBCOMP *
  176. TranslateSubComponent(
  177. IN WCHAR const *pwszComponent,
  178. OPTIONAL IN WCHAR const *pwszSubComponent);
  179. HRESULT
  180. certocmReadInfString(
  181. IN HINF hInf,
  182. OPTIONAL IN WCHAR const *pwszFile,
  183. IN WCHAR const *pwszSection,
  184. IN WCHAR const *pwszName,
  185. IN OUT WCHAR **ppwszValue);
  186. HRESULT
  187. ImportPFXAndUpdateCSPInfo(
  188. IN const HWND hDlg,
  189. IN OUT PER_COMPONENT_DATA *pComp);
  190. HRESULT CreateProgramGroups(BOOL fClient,
  191. PER_COMPONENT_DATA *pComp,
  192. HWND hwnd);
  193. HRESULT
  194. LoadDefaultCAIDAttributes(
  195. IN OUT PER_COMPONENT_DATA *pComp);
  196. HRESULT
  197. LoadDefaultAdvanceAttributes(
  198. IN OUT CASERVERSETUPINFO* pServer);
  199. HRESULT
  200. BuildDBFileName(
  201. IN WCHAR const *pwszCAName,
  202. IN WCHAR const *pwszDBDirectory,
  203. OUT WCHAR **ppwszDBFile);
  204. VOID
  205. BuildPath(
  206. OUT WCHAR *pwszOut,
  207. IN DWORD cwcOut,
  208. IN WCHAR const *pwszDir,
  209. IN WCHAR const *pwszFile);
  210. HRESULT
  211. GetDefaultDBDirectory(
  212. IN PER_COMPONENT_DATA *pComp,
  213. OUT WCHAR **ppwszDir);
  214. HRESULT
  215. GetDefaultSharedFolder(
  216. OUT WCHAR **ppwszSharedFolder);
  217. HRESULT
  218. StartAndStopService(
  219. IN HINSTANCE hInstance,
  220. IN BOOL fUnattended,
  221. IN HWND const hwnd,
  222. IN WCHAR const *pwszServiceName,
  223. IN BOOL const fStopService,
  224. IN BOOL const fConfirm,
  225. IN int iMsg,
  226. OUT BOOL *pfServiceWasRunning);
  227. HRESULT
  228. FixCertsvcService(
  229. IN PER_COMPONENT_DATA *pComp);
  230. HRESULT
  231. DetermineServerCustomModule(
  232. IN OUT PER_COMPONENT_DATA *pComp,
  233. IN BOOL fPolicy);
  234. HRESULT
  235. DetermineServerUpgradePath(
  236. IN OUT PER_COMPONENT_DATA *pComp);
  237. HRESULT
  238. DetermineClientUpgradePath(
  239. IN OUT PER_COMPONENT_DATA *pComp);
  240. HRESULT CreateCertWebDatIncPage(IN PER_COMPONENT_DATA *pComp, IN BOOL bIsServer);
  241. HRESULT
  242. CancelCertsrvInstallation(
  243. HWND hwnd,
  244. PER_COMPONENT_DATA *pComp);
  245. HRESULT
  246. BuildCACertFileName(
  247. IN HINSTANCE hInstance,
  248. IN HWND hwnd,
  249. IN BOOL fUnattended,
  250. OPTIONAL IN WCHAR *pwszSharedFolder,
  251. IN WCHAR *pwszSanitizedName,
  252. OUT WCHAR **ppwszCACertFile);
  253. HRESULT
  254. myRenameCertRegKey(
  255. IN WCHAR const *pwszSrcCAName,
  256. IN WCHAR const *pwszDesCAName);
  257. bool IsValidPeriod(const CASERVERSETUPINFO *pServer);
  258. HRESULT
  259. CheckPostBaseInstallStatus(
  260. OUT BOOL *pfFinished);
  261. // externals
  262. extern BOOL g_fShowErrMsg;
  263. extern HINSTANCE g_hInstance;
  264. extern BOOL g_fW3SvcRunning;
  265. extern WCHAR *g_pwszArgvPath;
  266. extern WCHAR *g_pwszNoService;
  267. #if DBG_CERTSRV
  268. extern WCHAR *g_pwszDumpStrings;
  269. #endif
  270. extern UNATTENDPARM aUnattendParmClient[];
  271. extern UNATTENDPARM aUnattendParmServer[];
  272. #endif // __SETUPUT_H__