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.

559 lines
14 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. ocmanage.h
  5. Abstract:
  6. Public header file for Optional Component Manager.
  7. Revision History:
  8. --*/
  9. #if _MSC_VER > 1000
  10. #pragma once
  11. #endif
  12. //
  13. // Define type for optional component setup dll interface entry point.
  14. // Note the strings are declared with VOID typing since we don't
  15. // know in advance what the character width is.
  16. //
  17. typedef
  18. DWORD
  19. (*POCSETUPPROC) (
  20. IN LPCVOID ComponentId,
  21. IN LPCVOID SubcomponentId,
  22. IN UINT Function,
  23. IN UINT_PTR Param1,
  24. IN OUT PVOID Param2
  25. );
  26. //
  27. // Define interface function codes.
  28. //
  29. #define OC_PREINITIALIZE 0x00000000
  30. #define OC_INIT_COMPONENT 0x00000001
  31. #define OC_SET_LANGUAGE 0x00000002
  32. #define OC_QUERY_IMAGE 0x00000003
  33. #define OC_REQUEST_PAGES 0x00000004
  34. #define OC_QUERY_CHANGE_SEL_STATE 0x00000005
  35. #define OC_CALC_DISK_SPACE 0x00000006
  36. #define OC_QUEUE_FILE_OPS 0x00000007
  37. #define OC_NOTIFICATION_FROM_QUEUE 0x00000008
  38. #define OC_QUERY_STEP_COUNT 0x00000009
  39. #define OC_COMPLETE_INSTALLATION 0x0000000a
  40. #define OC_CLEANUP 0x0000000b
  41. #define OC_QUERY_STATE 0x0000000c
  42. #define OC_NEED_MEDIA 0x0000000d
  43. #define OC_ABOUT_TO_COMMIT_QUEUE 0x0000000e
  44. #define OC_QUERY_SKIP_PAGE 0x0000000f
  45. #define OC_WIZARD_CREATED 0x00000010
  46. #define OC_FILE_BUSY 0x00000011
  47. #define OC_EXTRA_ROUTINES 0x00000012
  48. #define OC_QUERY_IMAGE_EX 0x00000013
  49. #define OC_QUERY_ERROR 0x000000FF // dead
  50. //#define OC_OSSETUP_GET_WIZARD_TITLE 0x00000400
  51. //#define OC_OSSETUP_GET_COMPUTER_NAME 0x00000401
  52. //#define OC_OSSETUP_GET_SERVER_TYPE 0x00000402
  53. #define OC_PRIVATE_BASE 0x00010000
  54. //
  55. // Define OC Manager directory IDs, available in per-component INFs.
  56. //
  57. #define DIRID_OCM_MASTERINF 987654321 // full path
  58. #define DIRID_OCM_PLATFORM 987654322 // alpha, i386, etc
  59. #define DIRID_OCM_PLATFORM_ALTERNATE 987654323 // alpha, x86, etc
  60. #define DIRID_OCM_COMPONENT 987654324 // component shortname
  61. //
  62. // Define structure used as a table of helper/callback entry points
  63. // into the OC Manager, and the associated function prototypes.
  64. //
  65. typedef
  66. VOID
  67. (CALLBACK *PTICKGAUGE_ROUTINE) (
  68. IN PVOID OcManagerContext
  69. );
  70. typedef
  71. VOID
  72. (CALLBACK *PSETPROGRESSTEXT_ROUTINEA) (
  73. IN PVOID OcManagerContext,
  74. IN LPCSTR Text
  75. );
  76. typedef
  77. VOID
  78. (CALLBACK *PSETPROGRESSTEXT_ROUTINEW) (
  79. IN PVOID OcManagerContext,
  80. IN LPCWSTR Text
  81. );
  82. typedef
  83. UINT
  84. (CALLBACK *PSETPRIVATEDATA_ROUTINEA) (
  85. IN PVOID OcManagerContext,
  86. IN LPCSTR Name,
  87. IN PVOID Data,
  88. IN UINT Size,
  89. IN UINT Type
  90. );
  91. typedef
  92. UINT
  93. (CALLBACK *PSETPRIVATEDATA_ROUTINEW) (
  94. IN PVOID OcManagerContext,
  95. IN LPCWSTR Name,
  96. IN PVOID Data,
  97. IN UINT Size,
  98. IN UINT Type
  99. );
  100. typedef
  101. UINT
  102. (CALLBACK *PGETPRIVATEDATA_ROUTINEA) (
  103. IN PVOID OcManagerContext,
  104. IN LPCSTR ComponentId,
  105. IN LPCSTR Name,
  106. OUT PVOID Data, OPTIONAL
  107. IN OUT PUINT Size,
  108. OUT PUINT Type
  109. );
  110. typedef
  111. UINT
  112. (CALLBACK *PGETPRIVATEDATA_ROUTINEW) (
  113. IN PVOID OcManagerContext,
  114. IN LPCWSTR ComponentId,
  115. IN LPCWSTR Name,
  116. OUT PVOID Data, OPTIONAL
  117. IN OUT PUINT Size,
  118. OUT PUINT Type
  119. );
  120. typedef
  121. UINT
  122. (CALLBACK *PSETSETUPMODE_ROUTINE) (
  123. IN PVOID OcManagerContext,
  124. IN DWORD SetupMode
  125. );
  126. typedef
  127. UINT
  128. (CALLBACK *PGETSETUPMODE_ROUTINE) (
  129. IN PVOID OcManagerContext
  130. );
  131. typedef
  132. BOOL
  133. (CALLBACK *PQUERYSELECTIONSTATE_ROUTINEA) (
  134. IN PVOID OcManagerContext,
  135. IN LPCSTR SubcomponentId,
  136. IN UINT StateType
  137. );
  138. typedef
  139. BOOL
  140. (CALLBACK *PQUERYSELECTIONSTATE_ROUTINEW) (
  141. IN PVOID OcManagerContext,
  142. IN LPCWSTR SubcomponentId,
  143. IN UINT StateType
  144. );
  145. typedef
  146. UINT
  147. (CALLBACK *PCALLPRIVATEFUNCTION_ROUTINEA) (
  148. IN PVOID OcManagerContext,
  149. IN LPCSTR ComponentId,
  150. IN LPCSTR SubcomponentId,
  151. IN UINT Function,
  152. IN UINT Param1,
  153. IN OUT PVOID Param2,
  154. OUT PUINT Result
  155. );
  156. typedef
  157. UINT
  158. (CALLBACK *PCALLPRIVATEFUNCTION_ROUTINEW) (
  159. IN PVOID OcManagerContext,
  160. IN LPCWSTR ComponentId,
  161. IN LPCWSTR SubcomponentId,
  162. IN UINT Function,
  163. IN UINT Param1,
  164. IN OUT PVOID Param2,
  165. OUT PUINT Result
  166. );
  167. typedef
  168. BOOL
  169. (CALLBACK *PCONFIRMCANCEL_ROUTINE) (
  170. IN HWND ParentWindow
  171. );
  172. typedef
  173. HWND
  174. (CALLBACK *PQUERYWIZARDDIALOGHANDLE_ROUTINE) (
  175. IN PVOID OcManagerContext
  176. );
  177. typedef
  178. BOOL
  179. (CALLBACK *PSETREBOOT_ROUTINE) (
  180. IN PVOID OcManagerContext,
  181. IN BOOL Reserved
  182. );
  183. typedef
  184. HINF
  185. (CALLBACK *PGETINFHANDLE_ROUTINE) (
  186. IN UINT InfIndex,
  187. IN PVOID OcManagerContext
  188. );
  189. #define INFINDEX_UNATTENDED 1
  190. typedef
  191. BOOL
  192. (__cdecl *PREPORTEXTERNALERROR_ROUTINEA) (
  193. IN PVOID OcManagerContext,
  194. IN LPCSTR ComponentId,
  195. IN LPCSTR SubcomponentId, OPTIONAL
  196. IN DWORD_PTR MessageId,
  197. IN DWORD Flags,
  198. ...
  199. );
  200. typedef
  201. BOOL
  202. (__cdecl *PREPORTEXTERNALERROR_ROUTINEW) (
  203. IN PVOID OcManagerContext,
  204. IN LPCWSTR ComponentId,
  205. IN LPCWSTR SubcomponentId, OPTIONAL
  206. IN DWORD_PTR MessageId,
  207. IN DWORD Flags,
  208. ...
  209. );
  210. typedef
  211. VOID
  212. (WINAPI *OCH_SHOWHIDEWIZARDPAGE)(
  213. IN PVOID OcManagerContext,
  214. IN BOOL bShow
  215. );
  216. #define ERRFLG_SYSTEM_MESSAGE 0x00000001
  217. #define ERRFLG_IGNORE_INSERTS 0x00000002
  218. #define ERRFLG_PREFORMATTED 0x00000004
  219. typedef struct _OCMANAGER_ROUTINESA {
  220. PVOID OcManagerContext;
  221. PTICKGAUGE_ROUTINE TickGauge;
  222. PSETPROGRESSTEXT_ROUTINEA SetProgressText;
  223. PSETPRIVATEDATA_ROUTINEA SetPrivateData;
  224. PGETPRIVATEDATA_ROUTINEA GetPrivateData;
  225. PSETSETUPMODE_ROUTINE SetSetupMode;
  226. PGETSETUPMODE_ROUTINE GetSetupMode;
  227. PQUERYSELECTIONSTATE_ROUTINEA QuerySelectionState;
  228. PCALLPRIVATEFUNCTION_ROUTINEA CallPrivateFunction;
  229. PCONFIRMCANCEL_ROUTINE ConfirmCancelRoutine;
  230. PQUERYWIZARDDIALOGHANDLE_ROUTINE QueryWizardDialogHandle;
  231. PSETREBOOT_ROUTINE SetReboot;
  232. PGETINFHANDLE_ROUTINE GetInfHandle;
  233. PREPORTEXTERNALERROR_ROUTINEA ReportExternalError;
  234. OCH_SHOWHIDEWIZARDPAGE ShowHideWizardPage;
  235. } OCMANAGER_ROUTINESA, *POCMANAGER_ROUTINESA;
  236. typedef struct _OCMANAGER_ROUTINESW {
  237. PVOID OcManagerContext;
  238. PTICKGAUGE_ROUTINE TickGauge;
  239. PSETPROGRESSTEXT_ROUTINEW SetProgressText;
  240. PSETPRIVATEDATA_ROUTINEW SetPrivateData;
  241. PGETPRIVATEDATA_ROUTINEW GetPrivateData;
  242. PSETSETUPMODE_ROUTINE SetSetupMode;
  243. PGETSETUPMODE_ROUTINE GetSetupMode;
  244. PQUERYSELECTIONSTATE_ROUTINEW QuerySelectionState;
  245. PCALLPRIVATEFUNCTION_ROUTINEW CallPrivateFunction;
  246. PCONFIRMCANCEL_ROUTINE ConfirmCancelRoutine;
  247. PQUERYWIZARDDIALOGHANDLE_ROUTINE QueryWizardDialogHandle;
  248. PSETREBOOT_ROUTINE SetReboot;
  249. PGETINFHANDLE_ROUTINE GetInfHandle;
  250. PREPORTEXTERNALERROR_ROUTINEW ReportExternalError;
  251. OCH_SHOWHIDEWIZARDPAGE ShowHideWizardPage;
  252. } OCMANAGER_ROUTINESW, *POCMANAGER_ROUTINESW;
  253. #ifdef UNICODE
  254. typedef OCMANAGER_ROUTINESW OCMANAGER_ROUTINES;
  255. typedef POCMANAGER_ROUTINESW POCMANAGER_ROUTINES;
  256. #else
  257. typedef OCMANAGER_ROUTINESA OCMANAGER_ROUTINES;
  258. typedef POCMANAGER_ROUTINESA POCMANAGER_ROUTINES;
  259. #endif
  260. typedef
  261. BOOL
  262. (__cdecl *PLOGERROR_ROUTINEA) (
  263. IN PVOID OcManagerContext,
  264. IN DWORD ErrorLevel,
  265. IN LPCSTR Msg,
  266. ...
  267. );
  268. typedef
  269. BOOL
  270. (__cdecl *PLOGERROR_ROUTINEW) (
  271. IN PVOID OcManagerContext,
  272. IN DWORD ErrorLevel,
  273. IN LPCWSTR Msg,
  274. ...
  275. );
  276. typedef struct _EXTRA_ROUTINESA {
  277. DWORD size;
  278. PLOGERROR_ROUTINEA LogError;
  279. } EXTRA_ROUTINESA, *PEXTRA_ROUTINESA;
  280. typedef struct _EXTRA_ROUTINESW {
  281. DWORD size;
  282. PLOGERROR_ROUTINEW LogError;
  283. } EXTRA_ROUTINESW, *PEXTRA_ROUTINESW;
  284. #ifdef UNICODE
  285. typedef EXTRA_ROUTINESW EXTRA_ROUTINES;
  286. typedef PEXTRA_ROUTINESW PEXTRA_ROUTINES;
  287. #else
  288. typedef EXTRA_ROUTINESA EXTRA_ROUTINES;
  289. typedef PEXTRA_ROUTINESA PEXTRA_ROUTINES;
  290. #endif
  291. // for error handler
  292. typedef enum {
  293. OcErrLevInfo = 0x00000000,
  294. OcErrLevWarning = 0x01000000,
  295. OcErrLevError = 0x02000000,
  296. OcErrLevFatal = 0x03000000,
  297. OcErrLevMax = 0x04000000,
  298. OcErrBatch = 0x10000000,
  299. OcErrMask = 0xFF000000
  300. } OcErrorLevel;
  301. //
  302. // Flags.
  303. //
  304. #define OCFLAG_UNICODE 0x00000001
  305. #define OCFLAG_ANSI 0x00000002
  306. //
  307. // master component flags
  308. //
  309. #define OCFLAG_NOWIZPAGES 0x00000001
  310. #define OCFLAG_NOQUERYSKIP 0x00000002
  311. #define OCFLAG_NOEXTRAFLAGS 0x00000004
  312. //
  313. // Selection state types (for QuerySelectionState and OC_QUERY_STATE).
  314. //
  315. #define OCSELSTATETYPE_ORIGINAL 0
  316. #define OCSELSTATETYPE_CURRENT 1
  317. #define OCSELSTATETYPE_FINAL 2
  318. //
  319. // Setup data structure. Passed within a SETUP_INIT_COMPONENT structure
  320. // as OC_INIT_COMPONENT time.
  321. //
  322. typedef struct _SETUP_DATAA {
  323. DWORD SetupMode;
  324. DWORD ProductType;
  325. DWORDLONG OperationFlags;
  326. CHAR SourcePath[MAX_PATH];
  327. CHAR UnattendFile[MAX_PATH];
  328. } SETUP_DATAA, *PSETUP_DATAA;
  329. typedef struct _SETUP_DATAW {
  330. DWORD SetupMode;
  331. DWORD ProductType;
  332. DWORDLONG OperationFlags;
  333. WCHAR SourcePath[MAX_PATH];
  334. WCHAR UnattendFile[MAX_PATH];
  335. } SETUP_DATAW, *PSETUP_DATAW;
  336. #ifdef UNICODE
  337. typedef SETUP_DATAW SETUP_DATA;
  338. typedef PSETUP_DATAW PSETUP_DATA;
  339. #else
  340. typedef SETUP_DATAA SETUP_DATA;
  341. typedef PSETUP_DATAA PSETUP_DATA;
  342. #endif
  343. //
  344. // Values for SetupMode
  345. //
  346. #define SETUPMODE_UNKNOWN (-1)
  347. #define SETUPMODE_MINIMAL 0
  348. #define SETUPMODE_TYPICAL 1
  349. #define SETUPMODE_LAPTOP 2
  350. #define SETUPMODE_CUSTOM 3
  351. #define SETUPMODE_PRIVATE(x) ((x) & SETUPMODE_PRIVATE_MASK)
  352. //
  353. // Predefined upgrade modes
  354. //
  355. #define SETUPMODE_UPGRADEONLY 0x20000100
  356. #define SETUPMODE_ADDEXTRACOMPS 0x20000200
  357. //
  358. // Predefined mainteance modes
  359. //
  360. #define SETUPMODE_ADDREMOVE 0x10000100
  361. #define SETUPMODE_REINSTALL 0x10000200
  362. #define SETUPMODE_REMOVEALL 0x10000400
  363. //
  364. // Predefined fresh modes
  365. //
  366. #define SETUPMODE_FRESH 0x00000000
  367. #define SETUPMODE_MAINTENANCE 0x10000000
  368. #define SETUPMODE_UPGRADE 0x20000000
  369. #define SETUPMODE_STANDARD_MASK 0x000000ff
  370. #define SETUPMODE_PRIVATE_MASK 0xffffff00
  371. //
  372. // Flag for NeedMedia Callback, Ored in to
  373. // Return code to allow NeedMedia to return
  374. // FILEOP_ Return Codes
  375. //
  376. #define NEEDMEDIA_USEFILEOP 0x80000000
  377. //
  378. // Values for ProductType. Notice careful definitions
  379. // such that low bit on means some kind of DC.
  380. //
  381. #define PRODUCT_WORKSTATION 0
  382. #define PRODUCT_SERVER_PRIMARY 1
  383. #define PRODUCT_SERVER_STANDALONE 2
  384. #define PRODUCT_SERVER_SECONDARY 3
  385. //
  386. // Bit flags for OperationFlags. Note that this is a 64-bit field.
  387. //
  388. #define SETUPOP_WIN31UPGRADE 0x0000000000000001
  389. #define SETUPOP_WIN95UPGRADE 0x0000000000000002
  390. #define SETUPOP_NTUPGRADE 0x0000000000000004
  391. #define SETUPOP_BATCH 0x0000000000000008
  392. #define SETUPOP_STANDALONE 0x0000000000000010
  393. #define SETUPOP_AMD64_FILES_AVAIL 0x0000000100000000
  394. #define SETUPOP_OBSOLETE1_FILES_AVAIL 0x0000000200000000
  395. #define SETUPOP_OBSOLETE2_FILES_AVAIL 0x0000000400000000
  396. #define SETUPOP_X86_FILES_AVAIL 0x0000000800000000
  397. #define SETUPOP_IA64_FILES_AVAIL 0x0000001000000000
  398. //
  399. // Component initialization structure, passed at OC_INIT_COMPONENT time.
  400. //
  401. typedef struct _SETUP_INIT_COMPONENTA {
  402. UINT OCManagerVersion;
  403. UINT ComponentVersion;
  404. HINF OCInfHandle;
  405. HINF ComponentInfHandle;
  406. SETUP_DATAA SetupData;
  407. OCMANAGER_ROUTINESA HelperRoutines;
  408. } SETUP_INIT_COMPONENTA, *PSETUP_INIT_COMPONENTA;
  409. typedef struct _SETUP_INIT_COMPONENTW {
  410. UINT OCManagerVersion;
  411. UINT ComponentVersion;
  412. HINF OCInfHandle;
  413. HINF ComponentInfHandle;
  414. SETUP_DATAW SetupData;
  415. OCMANAGER_ROUTINESW HelperRoutines;
  416. } SETUP_INIT_COMPONENTW, *PSETUP_INIT_COMPONENTW;
  417. #ifdef UNICODE
  418. typedef SETUP_INIT_COMPONENTW SETUP_INIT_COMPONENT;
  419. typedef PSETUP_INIT_COMPONENTW PSETUP_INIT_COMPONENT;
  420. #else
  421. typedef SETUP_INIT_COMPONENTA SETUP_INIT_COMPONENT;
  422. typedef PSETUP_INIT_COMPONENTA PSETUP_INIT_COMPONENT;
  423. #endif
  424. //
  425. // Current OC Manager version, major and minor.
  426. //
  427. #define OCVER_MAJOR 5
  428. #define OCVER_MINOR 0
  429. #define OCMANAGER_VERSION ((DWORD)MAKELONG(OCVER_MINOR,OCVER_MAJOR))
  430. //
  431. // Wizard page request structure, used with OC_REQUEST_PAGES.
  432. //
  433. typedef struct _SETUP_REQUEST_PAGES {
  434. UINT MaxPages;
  435. HPROPSHEETPAGE Pages[ANYSIZE_ARRAY];
  436. } SETUP_REQUEST_PAGES, *PSETUP_REQUEST_PAGES;
  437. //
  438. // Flags used in Param2 of OC_QUERY_CHANGE_SEL_STATE notification
  439. //
  440. #define OCQ_ACTUAL_SELECTION 0x00000001
  441. #define OCQ_DEPENDENT_SELECTION 0x80000000
  442. //
  443. // Enumerated types.
  444. //
  445. typedef enum {
  446. SubCompInfoSmallIcon, // the small icon associated with the subcomponent
  447. SubCompInfoWatermark // the watermark image at the top of the wizard
  448. } SubComponentInfo;
  449. typedef struct _OC_QUERY_IMAGE_INFO {
  450. DWORD SizeOfStruct;
  451. SubComponentInfo ComponentInfo;
  452. UINT DesiredWidth;
  453. UINT DesiredHeight;
  454. } OC_QUERY_IMAGE_INFO, *POC_QUERY_IMAGE_INFO;
  455. typedef enum {
  456. WizPagesWelcome, // welcome page
  457. WizPagesMode, // setup mode page
  458. WizPagesEarly, // pages that come after the mode page and before prenet pages
  459. WizPagesPrenet, // pages that come before network setup
  460. WizPagesPostnet, // pages that come after network setup
  461. WizPagesLate, // pages that come after postnet pages and before the final page
  462. WizPagesFinal, // final page
  463. WizPagesTypeMax
  464. } WizardPagesType;
  465. typedef enum {
  466. SubcompUseOcManagerDefault,
  467. SubcompOn,
  468. SubcompOff
  469. } SubComponentState;
  470. typedef enum {
  471. OcPageComponentHierarchy,
  472. OcPageMax
  473. } OcManagerPage;
  474. // use the assert from SetupAPI
  475. #define sapiAssert MYASSERT