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.

169 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. WiaHelpers.h
  5. Abstract:
  6. Author:
  7. Hakki T. Bostanci (hakkib) 06-Apr-2000
  8. Revision History:
  9. --*/
  10. #ifndef _WIAHELPERS_H_
  11. #define _WIAHELPERS_H_
  12. //////////////////////////////////////////////////////////////////////////
  13. //
  14. // cross references
  15. //
  16. #include "ComWrappers.h"
  17. #include "WiaWrappers.h"
  18. //////////////////////////////////////////////////////////////////////////
  19. //
  20. //
  21. //
  22. class CMyWiaPropertyStorage : public IWiaPropertyStorage
  23. {
  24. public:
  25. HRESULT
  26. ReadSingle(
  27. const CPropSpec &PropSpec,
  28. CPropVariant *pPropVariant
  29. )
  30. {
  31. return ReadMultiple(1, &PropSpec, pPropVariant);
  32. }
  33. HRESULT
  34. WriteSingle(
  35. const CPropSpec &PropSpec,
  36. const CPropVariant &PropVariant,
  37. PROPID propidNameFirst = WIA_IPA_FIRST
  38. )
  39. {
  40. return WriteMultiple(1, &PropSpec, &PropVariant, propidNameFirst);
  41. }
  42. HRESULT
  43. ReadSingle(
  44. const CPropSpec &PropSpec,
  45. CPropVariant *pPropVariant,
  46. VARTYPE vtNew
  47. );
  48. HRESULT
  49. WriteVerifySingle(
  50. const CPropSpec &PropSpec,
  51. const CPropVariant &PropVariant,
  52. PROPID propidNameFirst = WIA_IPA_FIRST
  53. );
  54. };
  55. HRESULT
  56. ReadWiaItemProperty(
  57. IWiaItem *pWiaItem,
  58. const CPropSpec &PropSpec,
  59. CPropVariant *pPropVariant,
  60. VARTYPE vtNew
  61. );
  62. HRESULT
  63. WriteWiaItemProperty(
  64. IWiaItem *pWiaItem,
  65. const CPropSpec &PropSpec,
  66. const CPropVariant &PropVariant
  67. );
  68. //////////////////////////////////////////////////////////////////////////
  69. //
  70. //
  71. //
  72. bool operator ==(IWiaPropertyStorage &lhs, IWiaPropertyStorage &rhs);
  73. inline bool operator !=(IWiaPropertyStorage &lhs, IWiaPropertyStorage &rhs)
  74. {
  75. return !(lhs == rhs);
  76. }
  77. bool operator ==(IWiaItem &lhs, IWiaItem &rhs);
  78. inline bool operator !=(IWiaItem &lhs, IWiaItem &rhs)
  79. {
  80. return !(lhs == rhs);
  81. }
  82. //////////////////////////////////////////////////////////////////////////
  83. //
  84. // define these classes to be able to overload the == and != operators
  85. //
  86. class CIWiaPropertyStoragePtr : public CComPtr<IWiaPropertyStorage>
  87. {
  88. public:
  89. bool operator ==(CIWiaPropertyStoragePtr &rhs)
  90. {
  91. return **this == *rhs;
  92. }
  93. bool operator !=(CIWiaPropertyStoragePtr &rhs)
  94. {
  95. return !(**this == *rhs);
  96. }
  97. };
  98. class CIWiaItemPtr : public CComPtr<IWiaItem>
  99. {
  100. public:
  101. bool operator ==(CIWiaItemPtr &rhs)
  102. {
  103. return **this == *rhs;
  104. }
  105. bool operator !=(CIWiaItemPtr &rhs)
  106. {
  107. return !(**this == *rhs);
  108. }
  109. };
  110. //////////////////////////////////////////////////////////////////////////
  111. //
  112. //
  113. //
  114. class CMyEnumSTATPROPSTG : public IEnumSTATPROPSTG
  115. {
  116. public:
  117. HRESULT GetCount(ULONG *pcelt);
  118. HRESULT Clone(CMyEnumSTATPROPSTG **ppenum);
  119. };
  120. //////////////////////////////////////////////////////////////////////////
  121. //
  122. //
  123. //
  124. BOOL
  125. InstallImageDeviceFromInf(
  126. PCTSTR pInfFileName,
  127. PCTSTR pDeviceName = 0
  128. );
  129. HRESULT
  130. InstallTestDevice(
  131. IWiaDevMgr *pWiaDevMgr,
  132. PCTSTR pInfFileName,
  133. BSTR *pbstrDeviceId
  134. );
  135. #endif //_WIAHELPERS_H_