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.

197 lines
5.2 KiB

  1. //--------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995
  5. //
  6. // File: utilprop.cxx
  7. //
  8. // Contents: CUtilProp object definitions
  9. //
  10. //
  11. // History: 08-28-96 shanksh Created.
  12. //
  13. //----------------------------------------------------------------------------
  14. // @module UTILPROP.H | CUtilProp object definitions
  15. //
  16. //
  17. #ifndef _UTILPROP_HXX_
  18. #define _UTILPROP_HXX_
  19. //----------- structs and #defines -------------------------------------------
  20. //
  21. // simple table used to store property information. Used in
  22. // the read-only implementation of IDBProperties::GetPropertyInfo and
  23. //
  24. typedef struct _tagPROPSTRUCT {
  25. DBPROPID dwPropertyID;
  26. DBPROPFLAGS dwFlags;
  27. VARTYPE vtType;
  28. BOOL boolVal;
  29. LONG longVal;
  30. DBPROPOPTIONS dwOptions;
  31. PWSTR pwstrVal;
  32. LPOLESTR pwszDescription;
  33. DBID colid;
  34. } PROPSTRUCT;
  35. typedef struct tagPROPSET
  36. {
  37. const GUID *guidPropertySet;
  38. ULONG cProperties;
  39. PROPSTRUCT* pUPropInfo;
  40. } PROPSET;
  41. //
  42. // flags for IDBProperties::GetPropertyInfo
  43. //
  44. #define F_ROWSETRO (DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ)
  45. #define F_ROWSETRW (DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | \
  46. DBPROPFLAGS_WRITE)
  47. #define F_DSRO (DBPROPFLAGS_DATASOURCEINFO | DBPROPFLAGS_READ)
  48. #define F_DBINITRW (DBPROPFLAGS_DBINIT | DBPROPFLAGS_READ | \
  49. DBPROPFLAGS_WRITE)
  50. #define F_SESSRO (DBPROPFLAGS_SESSION | DBPROPFLAGS_READ)
  51. #define F_ADSIRO (DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ)
  52. #define F_ADSIRW (DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | \
  53. DBPROPFLAGS_WRITE)
  54. #define OPT_REQ (DBPROPOPTIONS_REQUIRED)
  55. #define OPT_SIC (DBPROPOPTIONS_OPTIONAL)
  56. // flags for Get and Set Properties
  57. const DWORD PROPSET_DSO = 0x0001;
  58. const DWORD PROPSET_INIT = 0x0002;
  59. const DWORD PROPSET_SESSION = 0x0004;
  60. const DWORD PROPSET_COMMAND = 0x0008;
  61. //----------------------------------------------------------------------------
  62. // CUtilProp | Containing class for all interfaces on the UtilProp
  63. // Object
  64. //
  65. class CUtilProp {
  66. DWORD _dwDescBufferLen;
  67. IMalloc *_pIMalloc;
  68. CCredentials *_pCredentials;
  69. protected:
  70. // Member for all of the property work
  71. PROPSTRUCT * _prgProperties;
  72. // Loads fields of DBPROPINFO struct. Helper for GetPropertyInfo
  73. STDMETHODIMP
  74. LoadDBPROPINFO(
  75. PROPSTRUCT* pPropStruct,
  76. ULONG cProperties,
  77. DBPROPINFO* pPropInfo
  78. );
  79. // Loads fields of DBPROP struct. Helper for GetProperties
  80. STDMETHODIMP
  81. LoadDBPROP(
  82. PROPSTRUCT* pPropSet,
  83. ULONG cProperties,
  84. DBPROP* pPropSupport,
  85. BOOL IsDBInitPropSet
  86. );
  87. STDMETHODIMP
  88. CUtilProp::StoreDBPROP (
  89. PROPSTRUCT* pPropStruct,
  90. PROPSTRUCT* pStaticPropStruct,
  91. ULONG cProperties,
  92. DBPROP* pPropSupport,
  93. DWORD dwPropIndex
  94. );
  95. HRESULT
  96. CUtilProp::IsValidValue (
  97. DBPROP* pDBProp,
  98. DWORD dwPropIndex
  99. );
  100. BOOL
  101. CUtilProp::IsADSIFlagSet();
  102. HRESULT
  103. CUtilProp::IsValidInitMode(long lVal);
  104. HRESULT
  105. CUtilProp::IsValidBindFlag(long lVal);
  106. BOOL
  107. CUtilProp::IsSpecialGuid(GUID guidPropSet);
  108. public:
  109. CUtilProp(void);
  110. ~CUtilProp(void);
  111. STDMETHODIMP CUtilProp::FInit(
  112. CCredentials* pCredentials
  113. );
  114. STDMETHODIMP GetProperties(
  115. ULONG cPropertySets,
  116. const DBPROPIDSET rgPropertySets[],
  117. ULONG* pcProperties,
  118. DBPROPSET** prgProperties,
  119. DWORD dwBitMask
  120. );
  121. STDMETHODIMP GetPropertyInfo(
  122. ULONG cPropertySets,
  123. const DBPROPIDSET rgPropertySets[],
  124. ULONG* pcPropertyInfoSets,
  125. DBPROPINFOSET** prgPropertyInfoSets,
  126. WCHAR** ppDescBuffer,
  127. BOOL fDSOInitialized
  128. );
  129. STDMETHODIMP CUtilProp::SetProperties(
  130. ULONG cProperties,
  131. DBPROPSET rgProperties[],
  132. DWORD dwBitMask
  133. );
  134. HRESULT
  135. GetSearchPrefInfo(
  136. DBPROPID dwPropId,
  137. PADS_SEARCHPREF_INFO pSearchPrefInfo
  138. );
  139. HRESULT
  140. CUtilProp::FreeSearchPrefInfo(
  141. PADS_SEARCHPREF_INFO pSearchPrefInfo,
  142. DWORD dwNumSearchPrefs
  143. );
  144. PROPSET *
  145. CUtilProp::GetPropSetFromGuid (
  146. GUID guidPropSet
  147. );
  148. BOOL
  149. CUtilProp::IsIntegratedSecurity ();
  150. HRESULT
  151. CUtilProp::GetPropertiesArgChk(
  152. ULONG cPropertySets,
  153. const DBPROPIDSET rgPropertySets[],
  154. ULONG* pcProperties,
  155. DBPROPSET** prgProperties,
  156. DWORD dwBitMask
  157. );
  158. };
  159. typedef CUtilProp *PCUTILPROP;
  160. #define NUMELEM(p) (sizeof(p) / sizeof(p[0]))
  161. #endif