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.

121 lines
4.3 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. IN LPTSTR** ppszUniqueProviderNameArray,
  62. IN OUT PDWORD pdwProviderArrayLength,
  63. OUT HANDLE& hFile);
  64. HRESULT WriteInfHeader(LPCTSTR pszProvider, HANDLE& hFile);
  65. HRESULT PruneAndBuildPrinterINFs(BSTR bstrXmlPrinterCatalog, LPTSTR lpDownloadPath, DRIVER_INFO_6* paDriverInfo6, DWORD dwDriverInfoCount);
  66. HRESULT GetInstalledPrinterDriverInfo(const OSVERSIONINFO* pOsVersionInfo, DRIVER_INFO_6** ppaDriverInfo6, DWORD* pdwDriverInfoCount);
  67. //
  68. // Located in sysspec.cpp, but used in cdmp.cpp and sysspec.cpp
  69. //
  70. HRESULT AddPrunedDevRegProps(HDEVINFO hDevInfoSet,
  71. PSP_DEVINFO_DATA pDevInfoData,
  72. CXmlSystemSpec& xmlSpec,
  73. LPTSTR pszMatchingID, // pszMatchingID and pszDriverVer should be NULL or
  74. LPTSTR pszDriverVer, // point to valid strings
  75. DRIVER_INFO_6* paDriverInfo6, // OK if this is NULL (no installed printer drivers)
  76. DWORD dwDriverInfoCount,
  77. BOOL fIsSysSpecCall); // Called by GetSystemSpec and GetPackage, with slightly different behavior
  78. HRESULT GetMultiSzDevRegProp(HDEVINFO hDevInfoSet, PSP_DEVINFO_DATA pDevInfoData, DWORD dwProperty, LPTSTR* ppMultiSZ);
  79. HRESULT GetPropertyFromSetupDiReg(HDEVINFO hDevInfoSet, SP_DEVINFO_DATA devInfoData, LPCTSTR szProperty, LPTSTR *ppszData);
  80. HRESULT GetPropertyFromSetupDi(HDEVINFO hDevInfoSet, SP_DEVINFO_DATA devInfoData, ULONG ulProperty, LPTSTR* ppszProperty);
  81. HRESULT DoesHwidMatchPrinter(
  82. DRIVER_INFO_6* paDriverInfo6, // array of DRIVER_INFO_6 structs for installed printer drivers
  83. DWORD dwDriverInfoCount, // count of structs in paDriverInfo6 array
  84. LPCTSTR pszMultiSZ, // Hardware or Compatible MultiSZ to compare with installed drivers
  85. BOOL* pfHwidMatchesInstalledPrinter // [OUT] set TRUE if we match an installed printer driver
  86. );
  87. HRESULT AddIDToXml(LPCTSTR pszMultiSZ, CXmlSystemSpec& xmlSpec, DWORD dwProperty,
  88. DWORD& dwRank, HANDLE_NODE& hDevices, LPCTSTR pszMatchingID, LPCTSTR pszDriverVer);
  89. HRESULT GetMatchingDeviceID(HDEVINFO hDevInfoSet, PSP_DEVINFO_DATA pDevInfoData, LPTSTR* ppszMatchingID, LPTSTR* ppszDriverVer);
  90. //called by InternalLogDriverNotFound()
  91. HRESULT OpenUniqueFileName(
  92. IN LPTSTR lpBuffer,
  93. IN DWORD cchBuffer,
  94. OUT HANDLE &hFile
  95. );
  96. #if defined(__cplusplus)
  97. } // end extern "C"
  98. #endif
  99. #endif