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.

341 lines
6.9 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ocmgrlib.h
  5. Abstract:
  6. Header file for Optional Component Manager common library.
  7. Author:
  8. Ted Miller (tedm) 13-Sep-1996
  9. Revision History:
  10. --*/
  11. //
  12. // debugging text output flag. this can go away once we figure out a way to log information
  13. // when called from sysocmgr other than popping up UI in the user's face
  14. //
  15. #define OcErrTrace 0x20000000
  16. //
  17. // Default icon index, in case we couldn't find the specified one or
  18. // a component's INF doesn't specify one. It's a little diamond in
  19. // a generic gray.
  20. //
  21. #define DEFAULT_ICON_INDEX 11
  22. //
  23. // Maximum string lengths.
  24. //
  25. #define MAXOCDESC 150
  26. #define MAXOCTIP 200
  27. #define MAXOCIFLAG 512
  28. //
  29. // Maximum number of needs (subcomps that are needed by a subcomp).
  30. //
  31. //#define MAX_NEEDS 10
  32. //
  33. // Indices for selection states.
  34. //
  35. #define SELSTATE_NO 0
  36. #define SELSTATE_PARTIAL 1
  37. #define SELSTATE_YES 2
  38. #define SELSTATE_INIT 666
  39. //
  40. // Structure used with OcCreateOcPage
  41. //
  42. typedef struct _OC_PAGE_CONTROLS {
  43. //
  44. // Dialog template info.
  45. //
  46. HMODULE TemplateModule;
  47. LPCTSTR TemplateResource;
  48. //
  49. // Ids for various controls.
  50. //
  51. UINT ListBox;
  52. UINT DetailsButton;
  53. UINT TipText;
  54. UINT ResetButton;
  55. UINT InstalledCountText;
  56. UINT SpaceNeededText;
  57. UINT SpaceAvailableText;
  58. UINT InstructionsText;
  59. UINT HeaderText;
  60. UINT SubheaderText;
  61. UINT ComponentHeaderText;
  62. } OC_PAGE_CONTROLS, *POC_PAGE_CONTROLS;
  63. //
  64. // Structure used with OcCreateSetupPage
  65. //
  66. typedef struct _SETUP_PAGE_CONTROLS {
  67. //
  68. // Dialog template info.
  69. //
  70. HMODULE TemplateModule;
  71. LPCTSTR TemplateResource;
  72. //
  73. // Progress bar and progress text.
  74. //
  75. UINT ProgressBar;
  76. UINT ProgressLabel;
  77. UINT ProgressText;
  78. //
  79. // Animation for external install program
  80. //
  81. UINT AnimationControl;
  82. UINT AnimationResource;
  83. BOOL ForceExternalProgressIndicator;
  84. BOOL AllowCancel;
  85. // title and description
  86. UINT HeaderText;
  87. UINT SubheaderText;
  88. } SETUP_PAGE_CONTROLS, *PSETUP_PAGE_CONTROLS;
  89. //
  90. // Flags for OcInitialize
  91. //
  92. #define OCINIT_FORCENEWINF 0x00000001
  93. #define OCINIT_KILLSUBCOMPS 0x00000002
  94. #define OCINIT_RUNQUIET 0x00000004
  95. #define OCINIT_LANGUAGEAWARE 0x00000008
  96. // for calling pOcQueryOrSetNewInf and OcComponentState
  97. typedef enum {
  98. infQuery = 0,
  99. infSet,
  100. infReset
  101. };
  102. //
  103. // Routines that must be provided by whoever links to
  104. // the OC Manager common library. These are the routines that 'cement'
  105. // the OC Manager into a particular environment.
  106. //
  107. typedef
  108. VOID
  109. (WINAPI *POC_FILL_IN_SETUP_DATA_PROC_A)(
  110. OUT PSETUP_DATAA SetupData
  111. );
  112. typedef
  113. VOID
  114. (WINAPI *POC_FILL_IN_SETUP_DATA_PROC_W)(
  115. OUT PSETUP_DATAW SetupData
  116. );
  117. typedef
  118. INT
  119. (WINAPIV *POC_LOG_ERROR)(
  120. IN OcErrorLevel Level,
  121. IN LPCTSTR FormatString,
  122. ...
  123. );
  124. typedef
  125. VOID
  126. (WINAPI *POC_SET_REBOOT_PROC)(
  127. VOID
  128. );
  129. typedef
  130. HWND
  131. (WINAPI *POC_SHOWHIDEWIZARDPAGE)(
  132. IN BOOL bShow
  133. );
  134. typedef
  135. LRESULT
  136. (WINAPI *POC_BILLBOARD_PROGRESS_CALLBACK)(
  137. IN UINT Msg,
  138. IN WPARAM wParam,
  139. IN LPARAM lParam
  140. );
  141. typedef
  142. VOID
  143. (WINAPI *POC_BILLBOARD_SET_PROGRESS_TEXT_W)(
  144. IN PWSTR Text
  145. );
  146. typedef
  147. VOID
  148. (WINAPI *POC_BILLBOARD_SET_PROGRESS_TEXT_A)(
  149. IN PSTR Text
  150. );
  151. typedef
  152. VOID
  153. (WINAPI *POC_SETUP_PERF_DATA)(
  154. IN PWSTR FileName,
  155. IN ULONG LineNumber,
  156. IN PWSTR TagStr,
  157. IN PWSTR FormatStr,
  158. ...
  159. );
  160. typedef struct _OCM_CLIENT_CALLBACKSA {
  161. //
  162. // Routine to fill in the setup data structure that provides info
  163. // about the environment in which the OC Manager is running.
  164. //
  165. POC_FILL_IN_SETUP_DATA_PROC_A FillInSetupDataA;
  166. //
  167. // Routine to log an error.
  168. //
  169. POC_LOG_ERROR LogError;
  170. //
  171. // Routine to indicate need to reboot
  172. //
  173. POC_SET_REBOOT_PROC SetReboot;
  174. //
  175. // Routine to tell the wizard to show or hide
  176. // Only has effect if the billboard is shown
  177. //
  178. POC_SHOWHIDEWIZARDPAGE ShowHideWizardPage;
  179. //
  180. // Routine to call into to the the progress feedback
  181. // to the billboard.
  182. //
  183. POC_BILLBOARD_PROGRESS_CALLBACK BillboardProgressCallback;
  184. //
  185. // Routine which tells setup what string to display for the progress bar.
  186. //
  187. POC_BILLBOARD_SET_PROGRESS_TEXT_A BillBoardSetProgressText;
  188. POC_SETUP_PERF_DATA SetupPerfData;
  189. } OCM_CLIENT_CALLBACKSA, *POCM_CLIENT_CALLBACKSA;
  190. typedef struct _OCM_CLIENT_CALLBACKSW {
  191. //
  192. // Routine to fill in the setup data structure that provides info
  193. // about the environment in which the OC Manager is running.
  194. //
  195. POC_FILL_IN_SETUP_DATA_PROC_A FillInSetupDataA;
  196. //
  197. // Routine to log an error.
  198. //
  199. POC_LOG_ERROR LogError;
  200. //
  201. // Routine to indicate need to reboot
  202. //
  203. POC_SET_REBOOT_PROC SetReboot;
  204. POC_FILL_IN_SETUP_DATA_PROC_W FillInSetupDataW;
  205. //
  206. // Routine to tell the wizard to show or hide
  207. // Only has effect if the billboard is shown
  208. //
  209. POC_SHOWHIDEWIZARDPAGE ShowHideWizardPage;
  210. //
  211. // Routine to call into to the the progress feedback
  212. // to the billboard.
  213. //
  214. POC_BILLBOARD_PROGRESS_CALLBACK BillboardProgressCallback;
  215. //
  216. // Routine which tells setup what string to display for the progress bar.
  217. //
  218. POC_BILLBOARD_SET_PROGRESS_TEXT_W BillBoardSetProgressText;
  219. POC_SETUP_PERF_DATA SetupPerfData;
  220. } OCM_CLIENT_CALLBACKSW, *POCM_CLIENT_CALLBACKSW;
  221. #ifndef UNICODE // ansi
  222. typedef OCM_CLIENT_CALLBACKSA OCM_CLIENT_CALLBACKS;
  223. typedef POCM_CLIENT_CALLBACKSA POCM_CLIENT_CALLBACKS;
  224. #else // unicode
  225. typedef OCM_CLIENT_CALLBACKSW OCM_CLIENT_CALLBACKS;
  226. typedef POCM_CLIENT_CALLBACKSW POCM_CLIENT_CALLBACKS;
  227. #endif
  228. //
  229. // Routines that are provided by the OC Manager common library.
  230. //
  231. PVOID
  232. OcInitialize(
  233. IN POCM_CLIENT_CALLBACKS Callbacks,
  234. IN LPCTSTR MasterOcInfName,
  235. IN UINT Flags,
  236. OUT PBOOL ShowError,
  237. IN PVOID Log
  238. );
  239. VOID
  240. OcTerminate(
  241. IN OUT PVOID *OcManagerContext
  242. );
  243. UINT
  244. OcGetWizardPages(
  245. IN PVOID OcManagerContext,
  246. OUT PSETUP_REQUEST_PAGES Pages[WizPagesTypeMax]
  247. );
  248. HPROPSHEETPAGE
  249. OcCreateOcPage(
  250. IN PVOID OcManagerContext,
  251. IN POC_PAGE_CONTROLS WizardPageControlsInfo,
  252. IN POC_PAGE_CONTROLS DetailsPageControlsInfo
  253. );
  254. HPROPSHEETPAGE
  255. OcCreateSetupPage(
  256. IN PVOID OcManagerContext,
  257. IN PSETUP_PAGE_CONTROLS ControlsInfo
  258. );
  259. VOID
  260. OcRememberWizardDialogHandle(
  261. IN PVOID OcManagerContext,
  262. IN HWND DialogHandle
  263. );
  264. BOOL
  265. OcSubComponentsPresent(
  266. IN PVOID OcManagerContext
  267. );
  268. UINT
  269. OcComponentState(
  270. LPCTSTR component,
  271. UINT operation,
  272. DWORD *val
  273. );
  274. #define OcSetComponentState(a,b) OcComponentState(a,infSet,b)
  275. #define OcGetComponentState(a,b) OcComponentState(a,infQuery,b)