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.

136 lines
3.7 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: ccdm.h
  6. //
  7. // Owner: YanL
  8. //
  9. // Description:
  10. //
  11. // CDM interface
  12. //
  13. //=======================================================================
  14. #ifndef _CCDM_H_
  15. #include <wustl.h>
  16. #include <wuv3.h>
  17. #include <varray.h>
  18. #include <v3stdlib.h>
  19. #include <cwudload.h>
  20. #include <diamond.h>
  21. #include <cbitmask.h>
  22. #include <bucket.h>
  23. #ifdef _UNICODE
  24. #define tstring wstring
  25. #else
  26. #define tstring string
  27. #endif
  28. class CCdm
  29. {
  30. enum enumDriverDisposition
  31. {
  32. CDM_NEW_DRIVER,
  33. CDM_UPDATED_DRIVER,
  34. CDM_CURRENT_DRIVER,
  35. };
  36. struct SCdmItem {
  37. PUID puid;
  38. enumDriverDisposition fInstallState;
  39. tchar_buffer bufHardwareIDs;
  40. tstring sDriverVer;
  41. tstring sPrinterDriverName;
  42. tstring sArchitecture;
  43. };
  44. public:
  45. int m_iCDMTotalItems; //Total CDM items in m_items array. This member is only valid after a call to CreateCDMInventoryList. Subsequent calls to CreateCDMInventoryList will overwrite this variable.
  46. Varray<PINVENTORY_ITEM> m_items; //Array of detected CDM catalog items. This member is only valid after a call to CreateCDMInventoryList. Subsequent calls to CreateCDMInventoryList will overwrite the data stored in this array.
  47. public:
  48. CCdm(){}
  49. ~CCdm(){}
  50. void CreateInventoryList
  51. (
  52. IN CBitmask *pBm, //bitmask to be used to prune the inventory list.
  53. IN CWUDownload *pDownload, //pointer to internet server download class.
  54. IN CDiamond *pDiamond, //pointer to diamond de-compression class.
  55. IN PUID puidCatalog, //puid identifier of catalog where device drivers are stored.
  56. IN PBYTE pOemInfoTable //Pointer OEM info table that OEM detection needs.
  57. );
  58. //Returns an inventory item formated for insertion into the
  59. //main inventory catalog. This record will still need the
  60. //description record setup but is otherwise ready for main
  61. //pruning.
  62. PINVENTORY_ITEM ConvertCDMItem(
  63. int index //Index of cdm record to be converted
  64. );
  65. protected:
  66. byte_buffer m_bufInventory;
  67. typedef pair< ULONG, byte_buffer > my_pair;
  68. vector< my_pair > m_aBuckets;
  69. void AddItem(
  70. vector<SCdmItem>& acdmItem,
  71. PUID puid,
  72. enumDriverDisposition fDisposition,
  73. LPCTSTR szHardwareId,
  74. LPCTSTR szDriverVer,
  75. LPCTSTR szPrinterDriverName = NULL,
  76. LPCTSTR szArchitecture = NULL
  77. );
  78. void AddInventoryRecords(
  79. vector<SCdmItem>& acdmItem
  80. );
  81. //Reads a compressed CDM hash table from an internet server.
  82. void ReadHashTable(
  83. IN CWUDownload *pDownload, //pointer to internet server download class.
  84. IN CDiamond *pDiamond, //pointer to diamond de-compression class.
  85. IN PUID puidCatalog //PUID id of catalog for which cdm hash table is to be retrieved.
  86. );
  87. //returns the index of a possible hardware match if it is in the hash table
  88. //if the hardware id is not found then this method returns -1
  89. ULONG IsInMap(
  90. IN LPCTSTR pHwID //hardware id to be retrieved
  91. );
  92. //Reads and initializes a compressed CDM bucket file from an internet server.
  93. //Returnes the array index where the bucket file is stored.
  94. byte_buffer& ReadBucketFile(
  95. IN CWUDownload *pDownload, //pointer to internet server download class.
  96. IN CDiamond *pDiamond, //pointer to diamond de-compression class.
  97. IN PUID puidCatalog, //PUID id of catalog for which cdm hash table is to be retrieved.
  98. IN ULONG iHashIndex //Hash table index of bucket file to be retrieved
  99. );
  100. };
  101. enum EDriverStatus
  102. {
  103. edsBackup,
  104. edsCurrent,
  105. edsNew,
  106. };
  107. void CdmInstallDriver(BOOL bWindowsNT, EDriverStatus eds, LPCTSTR szHwIDs, LPCTSTR szInfPathName, LPCTSTR szDisplayName, PDWORD pReboot);
  108. #define _CCDM_H_
  109. #endif