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.

687 lines
29 KiB

  1. /*
  2. * wuv3.h - definitions/declarations for Windows Update V3 Catalog infra-structure
  3. *
  4. * Copyright (c) 1998-1999 Microsoft Corporation. All Rights Reserved.
  5. *
  6. * Purpose:
  7. * This file defines the structures, values, macros, and functions
  8. * used by the Version 3 Windows Update Catalog
  9. *
  10. */
  11. #ifndef _WU_V3_CATALOG_INC
  12. #pragma pack(1)
  13. #define BLOCK
  14. typedef struct _WU_VERSION
  15. {
  16. WORD major; //major package version (5)
  17. WORD minor; //minor package version (0)
  18. WORD build; //build package version (2014)
  19. WORD ext; //additional version specification (216)
  20. } WU_VERSION, *PWU_VERSION;
  21. //Active setup and Driver type inventory record flags.
  22. //The WU_BROWSER_LANGAUGE_FLAG is used to specify that the browser
  23. //language should be used when determining what localized description
  24. //to display.
  25. //No other flags this value is only valid with no other defines are used.
  26. //This will cause the OS langauge to be used to use browser languge for
  27. //this inventory catalog item pass in the WU_BROWSER_LANGUAGE_FLAG
  28. #define WU_NOSPECIAL_FLAGS ((BYTE)0x00)
  29. //If this flag is set then we use the install cabs based on the browser locale else
  30. //else the install cabs come from the detected OS locale.
  31. #define WU_BROWSER_LANGAUGE_FLAG ((BYTE)0x01)
  32. //The WU_HIDDEN_ITEM_FLAG is used to specify that the item should be hidden even
  33. //if it would normally detect as available.
  34. #define WU_HIDDEN_ITEM_FLAG ((BYTE)0x02)
  35. //The WU_PATCH_ITEM_FLAG is set if this inventory item is a patch.
  36. //Patch packages are only offered if the version that is detected on
  37. //the client's computer exactly matches the patch version.
  38. #define WU_PATCH_ITEM_FLAG ((BYTE)0x04)
  39. //The WU_UPDATE_ONLY_FLAG is set if this inventory item is only to be shown
  40. //if it is detected as an update item.
  41. #define WU_UPDATE_ONLY_FLAG ((BYTE)0x08)
  42. //The WU_MULTILANGUAGE_FLAG is set if this inventory item is only applicable to
  43. //multi language OS and is a multi language enable package. This changes the way
  44. //in which the bitmask is process for this item. The bitmask is interpreted as
  45. //this update applies to systems where it is determined that the update contains
  46. //a language version applicable for the selected set of languages installed on this OS.
  47. #define WU_MULTILANGUAGE_FLAG ((BYTE)0x10)
  48. //Item is marked as a critical update. This flag also applies to the inventory.plt
  49. //list of catalogs.
  50. #define WU_CRITICAL_UPDATE_ITEM_FLAG ((BYTE)0x20)
  51. //The following defines are used for the inventory catalog record's variable type fields.
  52. //The WU_VARIABLE_END field is the only required field variable field. It is used to signify
  53. //that there are no more variable fields associated with an inventory record.
  54. #define WU_VARIABLE_END ((short)0)
  55. //codes 1 - 25 are for detection dlls. This allows us to reduce catalog size
  56. //over time when the detection dll is used by may different packages
  57. #define WU_DETECT_DLL_GENERIC (short)1 //detection dll other than wudetect name follows
  58. #define WU_DETECT_DLL_REG_KEY_EXISTS (short)2 //wudetect.dll,RegKeyExists no additional data
  59. //codes 26 - 39 are for reg values this equates to the DetRegKey= key in the detection CIF file.
  60. //This will cause the line DetRegKey=string data to be placed into the detection CIF.
  61. //The string data is a null terminated string that indicates what data to copy for example:
  62. //DetRegKey=HKLM,software\microsoft\windows\currentversion\setup\optionalcomponents\games
  63. //would have the string data set to HKLM,software\microsoft\windows\currentversion\setup\optionalcomponents\games
  64. #define WU_DETREGKEY (short)25
  65. //This will cause the string that follows to be placed into the CIF as "DetRegValue=string"
  66. #define WU_DETREGVALUE_INSTALLED_GENERIC (short)40
  67. //This will cause the CIF line to be placed into the detection CIF, DetRegValue=Installed,SZ,1
  68. #define WU_DETREGVALUE_INSTALLED_SZ1 (short)41
  69. //This variable length field is used in the corporate version of the WU catalog and it contains the CDM driver file bucket id. This id is a DWORD. This field allows the CDM corporate catalog control to bypass the normal CDM groveling and download all of the the server driver content in the corporate catalog.
  70. #define WU_CDM_BUCKETID_VALUE (short)42
  71. //This variable length field is used by the V3 control to store the grovled hwid in with
  72. //the cdm record. This is necessary because when the description file for this record is
  73. //read from the server it needs to grovel the local machine for a registry key and if this
  74. //key is present the Description read function will need to create an uninstall variable
  75. //field for the clients in memory description structure.
  76. #define WU_CDM_HARDWARE_ID (short)43
  77. //This variable length field contains the letter designation of the active setup detection
  78. //locale that is to be used for this package. If this variable field is not present then
  79. //the locale id '*' is used. The '*' causes Active setup to accept the default locale.
  80. #define WU_DET_CIF_LOCALE (short)44
  81. //This data structure defines the format for a WU_PATH_FILEINFO type.
  82. typedef struct _PATCHINFO
  83. {
  84. DWORD checkSum; //File checksum for this patch file.
  85. #pragma warning( disable : 4200 )
  86. char szFileName[]; //NULL terminated file name that this checksum belongs to.
  87. #pragma warning( default : 4200 )
  88. } PATCHINFO, *PPATCHINFO;
  89. //This variable field is used to provide the information needed to install patch items. Patch
  90. //items required an exact match on the each file type to be allowed an installation. The data
  91. //type used for the patch variable is composed of the id followed by one or more patchinfo
  92. //structures. The AddPatchField() API in the util.cpp is used by the backend creation tool to
  93. //add fields of this type into an inventory record's variable length field.
  94. #define WU_PATCH_FILEINFO (short)45
  95. //This variable length field is used by an inventory record to inform the installer
  96. //that the default cab pool platform should be used to find the installation cabs.
  97. //This variable length field has no data associated with it so its length is 4 bytes.
  98. #define WU_USE_DEFAULT_PLATFORM (short)46
  99. //This variable length field is used by an inventory record to inform the installer
  100. //that this field contains a PUID that shows where the installation cabs are. So the
  101. //length of this field will be 8 bytes. id=2,len=2, PUID=4
  102. #define WU_PUID_OVERRIDE (short)47
  103. //Following variable length id is used to mark an entry inactive
  104. #define WU_VARIABLE_MERGEINACTIVE (short)48
  105. // Driver date/version format mm/dd/yyyy,...
  106. #define WU_VARIABLE_DRIVERVER (short)49
  107. #define WU_PLOC (short)50 // obsolete
  108. #define WU_PLOCLEGEND (short)51 // obsolete
  109. #define WU_PLOCBITMASK (short)52 // obsolete
  110. #define WU_CDM_DRIVER_NAME (short)53
  111. //value of the uninstallkey to be used in detection CIF
  112. #define WU_KEY_UNINSTALLKEY (short)54
  113. //depends key with PUIDs
  114. #define WU_KEY_DEPENDSKEY (short)55
  115. // all the _keys used by detection DLLs separated by \n
  116. #define WU_KEY_CUSTOMDETECT (short)56
  117. // install priority description file (DWORD)
  118. #define WU_DESC_INSTALL_PRIORITY (short)57
  119. // product id for 128 bit security check
  120. #define WU_DESC_128BIT_PRODID (short)58
  121. // URL for 128 bit security check
  122. #define WU_DESC_128BIT_URL (short)59
  123. // AltName
  124. #define WU_DESC_ALTNAME (short)60
  125. // An array of CRC hash structs (WUCRC_HASH) for each CAB file name specified in WU_DESCRIPTION_CABFILENAME
  126. // in the same order.
  127. #define WU_DESC_CRC_ARRAY (short)61
  128. // Architecture string for printer driver
  129. #define WU_CDM_PRINTER_DRIVER_ARCH (short)62
  130. // An array of CRC hash structs (WUCRC_HASH) for RTF HTM (always the first item) and images
  131. // the images following the first item are in the same order as WU_DESC_RTF_IMAGES
  132. #define WU_DESC_RTF_CRC_ARRAY (short)63
  133. // contains names of the images and which correspond to WU_DESC_RTF_CRC_ARRAY starting from second item
  134. // does not contain name of the read this RTF HTM which is assumed to be PUID.HTM
  135. // field is missing if there are no images
  136. #define WU_DESC_RTF_IMAGES (short)64
  137. // contains the CRC for the install cif file in the form of a WUCRC_HASH
  138. #define WU_DESC_CIF_CRC (short)65
  139. // contains the name of the EULA to be used for this item. If the field is empty
  140. // then we assume that its EULA.HTM found in the EULA directory under content folder.
  141. // We modify the file name by adding plat_loc_ prefix to it. For example, 2_0x00000409_eula.htm
  142. #define WU_DESC_EULA (short)66
  143. struct DESCDIAGINFO
  144. {
  145. long puid;
  146. DWORD dwLocale;
  147. DWORD dwPlat;
  148. };
  149. // diagnostic information only (DESCDIAGINFO)
  150. #define WU_DESC_DIAGINFO (short)67
  151. //
  152. // These values are written into the bitmask.plt file as the platform ids. When additional
  153. // platforms are added we will need to add a new enumeration value here.
  154. //
  155. // IMPORTANT NOTE!!!
  156. // This definition must be consistant with osdet.cpp detection as well as with the database
  157. typedef enum
  158. {
  159. enV3_DefPlat = 0,
  160. enV3_W95IE5 = 1,
  161. enV3_W98IE4 = 2,
  162. enV3_W98IE5 = 3,
  163. enV3_NT4IE5X86 = 4,
  164. enV3_NT4IE5ALPHA = 5,
  165. enV3_NT5IE5X86 = 6,
  166. //enV3_NT5IE5ALPHA = 7,
  167. enV3_NT4IE4ALPHA = 8,
  168. enV3_NT4IE4X86 = 9,
  169. enV3_W95IE4 = 10,
  170. enV3_MILLENNIUMIE5 = 11,
  171. enV3_W98SEIE5 = 12,
  172. //enV3_NEPTUNEIE5 = 13,
  173. enV3_NT4IE5_5X86 = 14,
  174. enV3_W95IE5_5 = 15,
  175. enV3_W98IE5_5 = 16,
  176. enV3_NT5IE5_5X86 = 17,
  177. enV3_Wistler = 18,
  178. enV3_Wistler64 = 19,
  179. enV3_NT5DC = 20,
  180. } enumV3Platform;
  181. /*
  182. // (05/01/2001)
  183. // Since the following structure is marked as obsolete and is not being used anywhere, I am commenting it out,
  184. // as it gives the follwoing warning when build with /w4
  185. // d:\nt\wurel\os\xp\cltrc1\wincom\wuv3\inc\wuv3.h(255) : error C4310: cast truncates constant value
  186. //obsolete
  187. typedef struct _PLOC
  188. {
  189. WORD platform; //Platform ID for this identifier. This currently can be one of:
  190. DWORD dwLocale; //Locale id that this PLOC is for.
  191. BOOL IsSelected(void) { return ((platform & (WORD)0x8000) != 0 ); }
  192. void Select(void) { (platform |= (WORD)0x8000); return; }
  193. void Clear(void) { (platform &= (BYTE)0x7fff); return; }
  194. } PLOC, *PPLOC;
  195. */
  196. #ifndef PUID
  197. typedef long PUID; //Windows Update assigned identifier
  198. //that is unique across catalogs.
  199. typedef PUID *PPUID; //Pointer to a PUID type.
  200. #endif
  201. //defined value used in the link and installLink fields to indicate
  202. //no link dependencies
  203. #define WU_NO_LINK (PUID)-1
  204. //PUID's cannot normally be 0 so 0 is used as a special identifier in the case of
  205. //GetCatalog. GetCatalog uses a 0 puid to indicate the master list of sub-catalogs.
  206. #define WU_CATALOG_LIST_PUID (PUID)0
  207. typedef struct ACTIVESETUP_RECORD
  208. {
  209. GUID g; //guid that identifies the item to be updated
  210. PUID puid; //Windows Update assigned unique identifier. This value is unique for all inventory record types, (Active Setup, CDM, and Section records). This ID specifies the name of the description and installation cab files.
  211. WU_VERSION version; //version of package that is this inventory record identifies
  212. BYTE flags; //flags specific to this record.
  213. PUID link; //PUID value of other record in inventory list that this record is dependent on. This field contains WU_NO_LINK if this item has no dependencies.
  214. PUID installLink; //The installLink field contains either WU_NO_LINK if there are no install
  215. //dependencies else this is the index of an item that must be
  216. //installed before this item can be installed. This is mainly
  217. //used for device drivers however there is nothing in the catalog
  218. //structure that precludes this link being used for applications
  219. //as well.
  220. } ACTIVESETUP_RECORD, *PACTIVESETUP_RECORD;
  221. GUID const WU_GUID_SPECIAL_RECORD = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x0, 0x00, 0x0, 0x00, 0x0, 0x00 } };
  222. #define WU_GUID_DRIVER_RECORD WU_GUID_SPECIAL_RECORD
  223. #define WU_GUID_DETECTION_DLL_RECORD WU_GUID_SPECIAL_RECORD
  224. //Add a new section record identifier if a new detection method needs to be added.
  225. #define SECTION_RECORD_TYPE_SECTION (BYTE)1
  226. #define SECTION_RECORD_TYPE_DEVICE_DRIVER (BYTE)2
  227. //This is simply for consistenty with the spec. The spec refers to
  228. //device driver insertion record. From the codes standpoint the is
  229. //a SECTION_RECORD_TYPE_DEVICE_DRIVER however this define makes it
  230. //a little unclear so I defined another type with the same value and
  231. //will change the v3 control code to use it. I am leaving the old define
  232. //above in place so that the backend tool set does not break.
  233. #define SECTION_RECORD_TYPE_DEVICE_DRIVER_INSERTION (BYTE)2
  234. #define SECTION_RECORD_TYPE_PRINTER (BYTE)3
  235. #define SECTION_RECORD_TYPE_DRIVER_RECORD (BYTE)4
  236. #define SECTION_RECORD_TYPE_CATALOG_RECORD (BYTE)5 //Inventory.plt catalog item record that describes a sub catalog.
  237. #define SECTION_RECORD_LEVEL_SECTION (BYTE)0
  238. #define SECTION_RECORD_LEVEL_SUBSECTION (BYTE)1 //sub section of current section
  239. #define SECTION_RECORD_LEVEL_SUBSUBSECTION (BYTE)2 //sub section of previous sub section
  240. //The SECTION_RECORD_UPDATE specifies that the section record update is
  241. //a special section. This type is used if present to place items that
  242. //are to be shown as recommended updates. A record update section is
  243. //always tied to the previous section or sub section. For example if
  244. //the inventory catalog order was:
  245. //
  246. //section
  247. // sub section
  248. // item 1 - Detects as Update
  249. // item 2 - Detects as new offering
  250. // item 3 - already present
  251. // update section
  252. //
  253. //Then the processed list would read
  254. //
  255. //section
  256. // sub section
  257. // item 2 - Detects as new offering
  258. // update section
  259. // item 1 - Detects as Update
  260. #define SECTION_RECORD_UPDATE (BYTE)3
  261. typedef struct _SECTION_RECORD
  262. {
  263. GUID g; //guid this type of record is WU_GUID_SPECIAL_RECORD
  264. BYTE type; //section record type
  265. PUID puid; //Windows Update assigned unique identifier. This value is unique for all inventory record types, (Active Setup, CDM, and Section records). This ID specifies the name of the description and installation cab files.
  266. BYTE flags; //flags specific to this record.
  267. BYTE level; //section level can be a section, sub section or sub sub section
  268. } SECTION_RECORD, *PSECTION_RECORD;
  269. typedef struct _DRIVER_RECORD
  270. {
  271. GUID g; //guid this type of record is WU_GUID_DRIVER_RECORD
  272. BYTE type; //driver record indicator flag, This type is set to
  273. //SECTION_RECORD_TYPE_DEVICE_DRIVER
  274. //i.e. SECTION_RECORD_TYPE_DEVICE_DRIVER_INSERTION
  275. //for a device driver or printer record place holder.
  276. PUID puid; //Windows Update assigned unique identifier. This value is unique for all inventory record types, (Active Setup, CDM, and Section records). This ID specifies the name of the description and installation cab files.
  277. WU_VERSION reserved;
  278. BYTE flags; //flags specific to this record.
  279. PUID link; //PUID value of other record in inventory list that this record is dependent on. This field contains WU_NO_LINK if this item has no dependencies.
  280. PUID installLink; //The installLink field contains either 0 if there are no install
  281. //dependencies else this is the index of an item that must be
  282. //installed before this item can be installed. This is mainly
  283. //used for device drivers however there is nothing in the catalog
  284. //structure that precludes this link being used for applications
  285. //as well.
  286. } DRIVER_RECORD, *PDRIVER_RECORD;
  287. typedef union _WU_INV_FIXED
  288. {
  289. ACTIVESETUP_RECORD a; //Active Setup detection record
  290. SECTION_RECORD s; //Catalog section record
  291. DRIVER_RECORD d; //CDM driver record insertion point
  292. //if additional inventory detection
  293. //record types are added they need to be added here.
  294. } WU_INV_FIXED, *PWU_INV_FIXED;
  295. typedef struct _WU_VARIABLE_FIELD
  296. {
  297. _WU_VARIABLE_FIELD();
  298. short id; //record type identifier
  299. short len; //length of variable record data
  300. //size we are using a 0 size array place hold we need to disable the
  301. //compiler warning since it will complain about this being non standard
  302. //behavor.
  303. #pragma warning( disable : 4200 )
  304. BYTE pData[]; //variable field record data
  305. #pragma warning( default : 4200 )
  306. //The GetNextItem function returns a pointer to the next variable array item
  307. //if it exists or NULL if it does not.
  308. struct _WU_VARIABLE_FIELD *GetNext(void);
  309. //The FindItem function returns a pointer to the next variable array item
  310. //if the requested item is found or NULL the item is not found.
  311. struct _WU_VARIABLE_FIELD *Find(short id);
  312. //returns the total size of this variable field array.
  313. int GetSize(void);
  314. } WU_VARIABLE_FIELD, *PWU_VARIABLE_FIELD;
  315. #define WU_ITEM_STATE_UNKNOWN 0 //Inventory item state has not been detected yet
  316. #define WU_ITEM_STATE_INSTALL 1 //Inventory item has been detected as an installable item
  317. #define WU_ITEM_STATE_UPDATE 2 //Inventory item has been detected as an Updatable item
  318. #define WU_ITEM_STATE_PRUNED 3 //Inventory item has been pruned from the list.
  319. #define WU_ITEM_STATE_CURRENT 4 //Inventory item has been detected at the currently installed item.
  320. #define WU_STATE_REASON_NONE 0
  321. #define WU_STATE_REASON_UPDATEONLY 1
  322. #define WU_STATE_REASON_BITMASK 2
  323. #define WU_STATE_REASON_PERSONALIZE 3
  324. #define WU_STATE_REASON_BACKEND 4
  325. #define WU_STATE_REASON_OLDERUPDATE 5
  326. #define WU_STATE_REASON_DRIVERINS 6
  327. #define WU_STATE_REASON_HIDDENDEP 7
  328. #define WU_STATE_REASON_PRUNED 8
  329. #define WU_STATE_REASON_CURRENT 9
  330. typedef struct _WU_INV_STATE
  331. {
  332. BYTE state; //Currently defined item state (Unknown, Installed, Update, Pruned)
  333. BOOL bChecked; //TRUE if the user has selected this item to be installed | updated
  334. BOOL bHidden; //Item display state, TRUE = hide from user FALSE = show item to user.
  335. BOOL dwReason; //reason for the items current state
  336. WU_VERSION verInstalled;
  337. } WU_INV_STATE, *PWU_INV_STATE;
  338. //Description specific flags
  339. #define DESCRIPTION_FLAGS_COOL ((DWORD)0x01) //new update
  340. #define DESCRIPTION_FLAGS_POWER ((DWORD)0x02) //best for power users
  341. #define DESCRIPTION_FLAGS_NEW ((DWORD)0x04) //cool stuff
  342. #define DESCRIPTION_FLAGS_REGISTRATION ((DWORD)0x08) //registration required
  343. #define DESCRIPTION_EXCLUSIVE ((DWORD)0x10) //This item cannot be selected with other items.
  344. #define DESCRIPTION_WARNING_SCARY ((DWORD)0x20) //Display a scary warning message
  345. #define DESCRIPTION_128BIT ((DWORD)0x40) //128bit stuff
  346. //defined variable Description file items.
  347. #define WU_DESCRIPTION_NONE ((short)0) //no other description flags only valid if used with no other flags
  348. #define WU_DESCRIPTION_TITLE ((short)1) //title of item that is to be displayed
  349. #define WU_DESCRIPTION_DESCRIPTION ((short)2) //description text that is displayed with item
  350. #define WU_DESCRIPTION_PACKAGE ((short)3) //?????
  351. #define WU_DESCRIPTION_EURLA_URL ((short)4) //license text url that needs read and accepted before package is installed
  352. #define WU_DESCRIPTION_READTHIS_URL ((short)5) //read this first url
  353. #define WU_DESCRIPTION_PATCH ((short)6) //?????? this is not a patch in the clasic sense need to find out what this is
  354. #define WU_DESCRIPTION_UNINSTALL_KEY ((short)7) //uninstall command
  355. #define WU_DESCRIPTION_INSTALLCABNAME ((short)8) //name of cab file that contains the installation CIF. This cab name is a NULL terminated string and is passed to active setup to install the package.
  356. #define WU_DESCRIPTION_CABFILENAME ((short)9) //cab file name for installation this is one or more and is in the format of an array of NULL terminated strings with the last entry double null terminated. This is known as a multisz string in the langauge of the registry.
  357. #define WU_DESCRIPTION_SERVERROOT ((short)10) //Server root3rd Level - Server root for install cabs. The tools and database will also need to understand that at times a piece of content can be located on a different download server from the main server and the structures need to be able to handle this. This allows us to host a single server site, a split server site like what we have today and a multi headed download server farm. The real goal behind this is to make sure we can host OEM content on the site without having to store the cabs on our servers.
  358. typedef struct _WU_DESCRIPTION
  359. {
  360. DWORD flags; //Icon flags to display with description
  361. DWORD size; //compressed total size of package
  362. DWORD downloadTime; //time to download @ 28,800
  363. PUID dependency; //display dependency link
  364. PWU_VARIABLE_FIELD pv; //variable length fields associated with this description file
  365. } WU_DESCRIPTION, *PWU_DESCRIPTION;
  366. //These flags are used by the client in memory inventory file to quickly determine
  367. //the type of inventory record. This is stored in each inventory item
  368. //add new inventory detection record types if required here.
  369. #define WU_TYPE_ACTIVE_SETUP_RECORD ((BYTE)1) //active setup record type
  370. #define WU_TYPE_CDM_RECORD_PLACE_HOLDER ((BYTE)2) //cdm code download manager place holder record. This is used to set the insertion point for other CDM driver records. Note: There is only one of these per inventory catalog.
  371. #define WU_TYPE_CDM_RECORD ((BYTE)3) //cdm code download manager record type
  372. #define WU_TYPE_SECTION_RECORD ((BYTE)4) //a section record place holder
  373. #define WU_TYPE_SUBSECTION_RECORD ((BYTE)5) //a sub section record place holder
  374. #define WU_TYPE_SUBSUBSECTION_RECORD ((BYTE)6) //a sub sub section record place holder
  375. #define WU_TYPE_RECORD_TYPE_PRINTER ((BYTE)7) //a printer detection record type
  376. #define WU_TYPE_CATALOG_RECORD ((BYTE)8) //Inventory.plt catalog item record that describes a sub catalog.
  377. //data return values used with GetItemInfo
  378. #define WU_ITEM_GUID 1 //item's guid.
  379. #define WU_ITEM_PUID 2 //item's puid.
  380. #define WU_ITEM_FLAGS 3 //item's flags.
  381. #define WU_ITEM_LINK 4 //item's detection dependency link.
  382. #define WU_ITEM_INSTALL_LINK 5 //item's install dependency link.
  383. #define WU_ITEM_LEVEL 6 //section record's level.
  384. typedef struct _INVENTORY_ITEM
  385. {
  386. int iReserved; //inventory record bitmask index
  387. BYTE recordType; //in memory item record type. This is setup when the catalog is parsed by the ParseCatalog method.
  388. int ndxLinkDetect; //index of item upon which this item is dependent. If this item is not dependent on any other items then this item will be -1.
  389. int ndxLinkInstall; //index of item upon which this item is dependent. If this item is not dependent on any other items then this item will be -1.
  390. PWU_INV_FIXED pf; //fixed record portion of the catalog inventory.
  391. PWU_VARIABLE_FIELD pv; //variable portion of the catalog inventory
  392. PWU_INV_STATE ps; //Current item state
  393. PWU_DESCRIPTION pd; //item description structure
  394. //Copies information about an inventory item to a user supplied buffer.
  395. BOOL GetFixedFieldInfo
  396. (
  397. int infoType, //type of information to be returned
  398. PVOID pBuffer //caller supplied buffer for the returned information. The caller is responsible for ensuring that the return buffer is large enough to contain the requested information.
  399. );
  400. //Quickly returns an items puid id to a caller.
  401. PUID GetPuid
  402. (
  403. void
  404. );
  405. } INVENTORY_ITEM, *PINVENTORY_ITEM;
  406. typedef struct _WU_CATALOG_HEADER
  407. {
  408. short version; //version of the catalog (this allows for future expansion)
  409. int totalItems; //total items in catalog
  410. BYTE sortOrder; //catalog sort order. 0 is the default and means use the position value of the record within the catalog.
  411. } WU_CATALOG_HEADER, *PWU_CATALOG_HEADER;
  412. typedef struct _WU_CATALOG
  413. {
  414. WU_CATALOG_HEADER hdr; //catalog header record (note the parsing function will need to fixup the items pointer when the catalog is read)
  415. PINVENTORY_ITEM *pItems; //beginning of individual catalog items
  416. } WU_CATALOG, *PWU_CATALOG;
  417. //size of the OEM field in a bitmask record. This is for documentation and clarity
  418. //The actual field in the BITMASK structure is a pointer to an array of OEM fields.
  419. //bitmask helper macros
  420. //returns 1 if bit is set 0 if bit is not set
  421. inline bool GETBIT(PBYTE pbits, int index) { return (pbits[(index/8)] & (0x80 >> (index%8))) != 0; }
  422. //sets requested bit to 1
  423. inline void SETBIT(PBYTE pbits, int index) { pbits[index/8] |= (0x080 >> (index%8)); }
  424. //clears requested bit to 0
  425. inline void CLRBIT(PBYTE pbits, int index) { pbits[index/8] &= (0xff ^ (0x080 >> (index%8))); }
  426. #define BITMASK_GLOBAL_INDEX 0 //index of global bitmask
  427. #define BITMASK_OEM_DEFAULT 1 //index of default OEM bitmask
  428. #define BITMASK_ID_OEM ((BYTE)1) //BITMASKID entry is an OEM id
  429. #define BITMASK_ID_LOCALE ((BYTE)2) //BITMASKID entry is a LOCALE id
  430. //The bitmask file is arranged as a series of bit bitmasks in the same order as
  431. //the oem and langauge ids. For example if DELL1 was the second id in the id
  432. //array section of the bitmask file then is bitmask would begin the third bitmask
  433. //in the bitmask section of the file. The reason that it is the third and not
  434. //second is that the first bitmask is always the global bitmask and there is no
  435. //corrisponding id field for the global mask as this mask is always present.
  436. //A bitmask OEM or LOCALE id is a DWORD.
  437. typedef DWORD BITMASKID;
  438. typedef DWORD *PBITMASKID;
  439. typedef struct _BITMASK
  440. {
  441. int iRecordSize; //number of bits in a single bitmask record
  442. int iBitOffset; //offset to bitmap bits in bytes
  443. int iOemCount; //Total number of oem ids in bitmask
  444. int iLocaleCount; //Total number of locale ids in bitmask
  445. int iPlatformCount; //Total number of platforms defined.
  446. #pragma warning( disable : 4200 )
  447. BITMASKID bmID[]; //OEM & LANGAUGE & future types arrays.
  448. #pragma warning( default : 4200 )
  449. //since there are one or more array of OEM & LANGAUGE types this needs to be
  450. //a pointer and will need to be manually set to the correct location when the
  451. //bitmask file is created or read.
  452. PBYTE GetBitsPtr(void) { return ((PBYTE)this+iBitOffset); } //beginning of bitmask bit arrays
  453. PBYTE GetBitMaskPtr(int index) { return GetBitsPtr() + ((iRecordSize+7)/8) * index; }
  454. } BITMASK, *PBITMASK;
  455. //catalog list
  456. #define CATLIST_STANDARD ((DWORD)0x00)
  457. #define CATLIST_CRITICALUPDATE ((DWORD)0x01)
  458. #define CATLIST_DRIVERSPRESENT ((DWORD)0x02)
  459. #define CATLIST_AUTOUPDATE ((DWORD)0x04)
  460. #define CATLIST_SILENTUPDATE ((DWORD)0x08)
  461. #define CATLIST_64BIT ((DWORD)0x10)
  462. #define CATLIST_SETUP ((DWORD)0x20)
  463. typedef struct _CATALOGLIST
  464. {
  465. DWORD dwPlatform;
  466. DWORD dwCatPuid;
  467. DWORD dwFlags;
  468. } CATALOGLIST, *PCATALOGLIST;
  469. //Global scope functions that handle creation of variable size objects for the
  470. //inventory item and description structures.
  471. //Adds a variable size field to an inventory type Variable size field
  472. void __cdecl AddVariableSizeField
  473. (
  474. IN OUT PINVENTORY_ITEM *pItem, //pointer to variable field after pvNew is added.
  475. IN PWU_VARIABLE_FIELD pvNew //new variable field to add
  476. );
  477. //Adds a variable size field to a description type Variable size field
  478. void __cdecl AddVariableSizeField
  479. (
  480. IN PWU_DESCRIPTION *pDescription, //pointer to variable field after pvNew is added.
  481. PWU_VARIABLE_FIELD pvNew //new variable field to add
  482. );
  483. //Adds a variable size field to a variable field chain.
  484. //The format of a variable size field is:
  485. //[(short)id][(short)len][variable size data]
  486. //The variable field always ends with a WU_VARIABLE_END type.
  487. PWU_VARIABLE_FIELD CreateVariableField
  488. (
  489. IN short id, //id of variable field to add to variable chain.
  490. IN PBYTE pData, //pointer to binary data to add.
  491. IN int iDataLen //Length of binary data to add.
  492. );
  493. //Converts a ##,##,##,## to the V3 catalog version format
  494. void __cdecl StringToVersion
  495. (
  496. IN LPSTR szStr, //string version
  497. IN OUT PWU_VERSION pVersion //WU version structure that contains converted version string
  498. );
  499. //Converts a V3 catalog version to a string format ##,##,##,##
  500. void __cdecl VersionToString
  501. (
  502. IN PWU_VERSION pVersion, //WU version structure that contains the version to be converted to a string.
  503. IN OUT LPSTR szStr //character string array that will contain the converted version, the caller
  504. //needs to ensure that this array is at least 16 bytes.
  505. );
  506. //0 if they are equal
  507. //1 if pV1 > pv2
  508. //-1 if pV1 < pV2
  509. //compares active setup type versions and returns:
  510. int __cdecl CompareASVersions
  511. (
  512. PWU_VERSION pV1, //pointer to version1
  513. PWU_VERSION pV2 //pointer to version2
  514. );
  515. BOOL IsValidGuid(GUID* pGuid);
  516. #define _WU_V3_CATALOG_INC
  517. //This USEWUV3INCLUDES define is for simplicity. If this present then we include
  518. //the other headers that are commonly used for V3 control objects. Note: These
  519. //objects still come from a 1:1 interleave library wuv3.lib. So you only get
  520. //the objects that you use in your application.
  521. #pragma pack()
  522. #ifdef USEWUV3INCLUDES
  523. #include <debug.h>
  524. #include <cwudload.h>
  525. #include <diamond.h>
  526. #include <ccatalog.h>
  527. #include <cbitmask.h>
  528. #include <ccdm.h>
  529. #include <selection.h>
  530. #undef _MAC
  531. #include <wuv3sys.h>
  532. #endif
  533. const int MAX_CATALOG_INI = 1024;
  534. #endif