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.

133 lines
3.8 KiB

  1. /*++
  2. Copyright (C) 1999- Microsoft Corporation
  3. Module Name:
  4. ptpprop.h
  5. Abstract:
  6. This module declares CProperty and its derived classes
  7. Author:
  8. William Hsieh (williamh) created
  9. Revision History:
  10. --*/
  11. #ifndef PTPPROP__H_
  12. #define PTPPROP__H_
  13. //
  14. // This class represnets a property.
  15. //
  16. class CPTPProperty
  17. {
  18. public:
  19. CPTPProperty()
  20. {
  21. m_bstrWiaPropName = NULL;
  22. m_WiaDataType = VT_EMPTY;
  23. ZeroMemory(&m_WiaPropInfo, sizeof(m_WiaPropInfo));
  24. ZeroMemory(&m_DefaultValue, sizeof(m_DefaultValue));
  25. ZeroMemory(&m_CurrentValue, sizeof(m_CurrentValue));
  26. }
  27. CPTPProperty(WORD PTPPropCode, WORD PTPDataType);
  28. virtual ~CPTPProperty();
  29. virtual HRESULT Initialize(PTP_PROPDESC *pPTPPropDesc, PROPID WiaPropId,
  30. VARTYPE WiaDataType, LPCWSTR WiaPropName);
  31. HRESULT GetCurrentValue(PROPVARIANT *pPropVar);
  32. HRESULT GetCurrentValue(PTP_PROPVALUE *pPropValue);
  33. HRESULT GetDefaultValue(PROPVARIANT *pPropVar);
  34. HRESULT GetDefaultValue(PTP_PROPVALUE *pPropValue);
  35. HRESULT SetValue(PROPVARIANT *ppropVar);
  36. HRESULT SetValue(PTP_PROPVALUE *pPropValue);
  37. HRESULT Reset();
  38. const WIA_PROPERTY_INFO * GetWiaPropInfo()
  39. {
  40. return &m_WiaPropInfo;
  41. }
  42. const PTP_PROPVALUE * GetCurrentValue()
  43. {
  44. return &m_CurrentValue;
  45. }
  46. const PTP_PROPVALUE * GetDefaultValue()
  47. {
  48. return &m_DefaultValue;
  49. }
  50. const LPWSTR GetWiaPropName()
  51. {
  52. return m_bstrWiaPropName;
  53. }
  54. WORD GetPTPPropCode()
  55. {
  56. return m_PtpPropCode;
  57. }
  58. PROPID GetWiaPropId()
  59. {
  60. return m_WiaPropId;
  61. }
  62. WORD GetPTPPropDataType()
  63. {
  64. return m_PtpDataType;
  65. }
  66. VARTYPE GetWiaPropDataType()
  67. {
  68. return m_WiaDataType;
  69. }
  70. LONG GetWiaAccessFlags()
  71. {
  72. return m_WiaPropInfo.lAccessFlags;
  73. }
  74. protected:
  75. //
  76. // Override the following functions to provide different data
  77. // restreiving and recording methods
  78. //
  79. virtual HRESULT GetPropValueLong(PTP_PROPVALUE *pPropValue, long *plValue);
  80. virtual HRESULT GetPropValueBSTR(PTP_PROPVALUE *pPropValue, BSTR *pbstrValue);
  81. virtual HRESULT GetPropValueVector(PTP_PROPVALUE *pPropValue, void *pVector,
  82. VARTYPE BasicType);
  83. virtual HRESULT SetPropValueLong(PTP_PROPVALUE *pPropValue, long lValue);
  84. virtual HRESULT SetPropValueBSTR(PTP_PROPVALUE *pPropValue, BSTR bstrValue);
  85. virtual HRESULT SetPropValueVector(PTP_PROPVALUE *pPropValue,
  86. void *pVector, VARTYPE BasicType);
  87. HRESULT PropValue2Variant(PROPVARIANT *pPropVar, PTP_PROPVALUE *pPropValue);
  88. HRESULT Variant2PropValue(PTP_PROPVALUE *pPropValue, PROPVARIANT *pPropVar);
  89. WORD m_PtpPropCode;
  90. PROPID m_WiaPropId;
  91. WORD m_PtpDataType;
  92. VARTYPE m_WiaDataType;
  93. PTP_PROPVALUE m_CurrentValue;
  94. PTP_PROPVALUE m_DefaultValue;
  95. WIA_PROPERTY_INFO m_WiaPropInfo;
  96. BSTR m_bstrWiaPropName;
  97. };
  98. class CPTPPropertyDateTime : public CPTPProperty
  99. {
  100. public:
  101. CPTPPropertyDateTime(WORD PtpPropCode,
  102. WORD PtpDataType
  103. );
  104. protected:
  105. virtual HRESULT GetPropValueVector(PTP_PROPVALUE *pPropValue,
  106. void *pVector,
  107. VARTYPE BasicType
  108. );
  109. virtual HRESULT SetPropValueVector(PTP_PROPVALUE *pPropValue,
  110. void *pVector,
  111. VARTYPE BasicType
  112. );
  113. };
  114. #endif // #ifndef PTPPROP__H_