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.

117 lines
3.8 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1998-2001 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: cdmp.h
  6. //
  7. //
  8. // Description:
  9. //
  10. // CDM internal header
  11. //
  12. //=======================================================================
  13. #ifndef _CDMP_H
  14. #define _CDMP_H
  15. #include <winspool.h>
  16. #include <winsprlp.h> // private header containing EPD_ALL_LOCAL_AND_CLUSTER define
  17. #include <winnt.h>
  18. #include <iuxml.h>
  19. #if defined(__cplusplus)
  20. extern "C" {
  21. #endif
  22. #define MAX_INDEX_TO_SEARCH 100 //range to find unique file names for hardware_XXX.xml
  23. //
  24. // Unicode text files require a magic header (first byte of file must be 0xFF and second 0xFE).
  25. //
  26. const BYTE UNICODEHDR[] = { 0xFF, 0xFE };
  27. class CDeviceInstanceIdArray
  28. {
  29. public:
  30. CDeviceInstanceIdArray();
  31. ~CDeviceInstanceIdArray();
  32. int Add(LPCWSTR pszDIID);
  33. LPWSTR operator[](int index);
  34. int Size() { return m_nCount; }
  35. void FreeAll();
  36. private:
  37. LPWSTR* m_ppszDIID;
  38. int m_nCount;
  39. int m_nPointers;
  40. };
  41. //
  42. // Used to control functionality of GetPackage() : NOTE that pBstrCatalog is always
  43. // allocated and returned unless function fails.
  44. //
  45. typedef enum { GET_PRINTER_INFS, // writes generated printer INF's to path returned in lpDownloadPath
  46. DOWNLOAD_DRIVER, // downloads driver to path returned in lpDownloadPath
  47. GET_CATALOG_XML // returns catalog BSTR only - no download or INF created
  48. } ENUM_GETPKG;
  49. HRESULT GetPackage( ENUM_GETPKG eFunction,
  50. PDOWNLOADINFO pDownloadInfo,
  51. LPTSTR lpDownloadPath,
  52. DWORD cchDownloadPath,
  53. BSTR* pbstrXmlCatalog); // must be freed by caller if allocated
  54. // called by DownloadUpdatedFiles()
  55. HRESULT GetDownloadPath(BSTR bstrXmlItems, LPTSTR szPath);
  56. HRESULT OpenUniqueProviderInfName(
  57. IN LPCTSTR szDirPath,
  58. IN LPCTSTR pszProvider,
  59. IN OUT LPTSTR pszFilePath,
  60. IN DWORD cchFilePath,
  61. OUT HANDLE &hFile);
  62. HRESULT WriteInfHeader(LPCTSTR pszProvider, HANDLE& hFile);
  63. HRESULT PruneAndBuildPrinterINFs(BSTR bstrXmlPrinterCatalog, LPTSTR lpDownloadPath, DRIVER_INFO_6* paDriverInfo6, DWORD dwDriverInfoCount);
  64. HRESULT GetInstalledPrinterDriverInfo(const OSVERSIONINFO* pOsVersionInfo, DRIVER_INFO_6** ppaDriverInfo6, DWORD* pdwDriverInfoCount);
  65. //
  66. // Located in sysspec.cpp, but used in cdmp.cpp and sysspec.cpp
  67. //
  68. HRESULT AddPrunedDevRegProps(HDEVINFO hDevInfoSet,
  69. PSP_DEVINFO_DATA pDevInfoData,
  70. CXmlSystemSpec& xmlSpec,
  71. LPTSTR pszMatchingID, // pszMatchingID and pszDriverVer should be NULL or
  72. LPTSTR pszDriverVer, // point to valid strings
  73. DRIVER_INFO_6* paDriverInfo6, // OK if this is NULL (no installed printer drivers)
  74. DWORD dwDriverInfoCount,
  75. BOOL fIsSysSpecCall); // Called by GetSystemSpec and GetPackage, with slightly different behavior
  76. HRESULT GetMultiSzDevRegProp(HDEVINFO hDevInfoSet, PSP_DEVINFO_DATA pDevInfoData, DWORD dwProperty, LPTSTR* ppMultiSZ);
  77. HRESULT DoesHwidMatchPrinter(
  78. DRIVER_INFO_6* paDriverInfo6, // array of DRIVER_INFO_6 structs for installed printer drivers
  79. DWORD dwDriverInfoCount, // count of structs in paDriverInfo6 array
  80. LPCTSTR pszMultiSZ, // Hardware or Compatible MultiSZ to compare with installed drivers
  81. BOOL* pfHwidMatchesInstalledPrinter // [OUT] set TRUE if we match an installed printer driver
  82. );
  83. HRESULT AddIDToXml(LPCTSTR pszMultiSZ, CXmlSystemSpec& xmlSpec, DWORD dwProperty,
  84. DWORD& dwRank, HANDLE_NODE& hDevices, LPCTSTR pszMatchingID, LPCTSTR pszDriverVer);
  85. HRESULT GetMatchingDeviceID(HDEVINFO hDevInfoSet, PSP_DEVINFO_DATA pDevInfoData, LPTSTR* ppszMatchingID, LPTSTR* ppszDriverVer);
  86. //called by InternalLogDriverNotFound()
  87. HRESULT OpenUniqueFileName(
  88. IN LPTSTR lpBuffer,
  89. IN DWORD cchBuffer,
  90. OUT HANDLE &hFile
  91. );
  92. #if defined(__cplusplus)
  93. } // end extern "C"
  94. #endif
  95. #endif