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.

399 lines
7.7 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. // File: cprops.hxx
  7. //
  8. // Contents:
  9. //
  10. // History: 17-June-1996 ramv (Ram Viswanathan) Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. typedef struct _schema_prop{
  14. WCHAR szPropertyName[MAX_PATH];
  15. DWORD dwFlags;
  16. DWORD dwNumValues; // Number of values
  17. DWORD dwSyntaxId; // Nt Syntax Id
  18. DWORD dwInfoLevel; // Info Level on which to do GetInfo
  19. }SCHEMA_PROP, *PSCHEMA_PROP;
  20. typedef struct _ntproperty{
  21. LPWSTR szPropertyName;
  22. DWORD dwFlags;
  23. DWORD dwNumValues; // Number of values
  24. DWORD dwSyntaxId; // Nt Syntax Id
  25. PNTOBJECT pNtObject; // Pointer to the NT Object
  26. }PROPERTY, *PPROPERTY;
  27. #define PROPERTY_NAME(pProperty) pProperty->szPropertyName
  28. #define PROPERTY_VALUES(pProperty) pProperty->lpValues
  29. #define PROPERTY_NUMVALUES(pProperty) pProperty->dwNumValues
  30. #define PROPERTY_SYNTAX(pProperty) pProperty->dwSyntaxId
  31. #define PROPERTY_NTOBJECT(pProperty) pProperty->pNtObject
  32. #define PROPERTY_FLAGS(pProperty) pProperty->dwFlags
  33. #define PROPERTY_INFOLEVEL(pProperty) pProperty->dwInfoLevel
  34. //
  35. // Schema Status flags
  36. //
  37. /* removed, not consistent with cache_property_modified, use
  38. PROPERTY_IS_MODIFIED instead to test if a property has been modifed
  39. in cache.
  40. //#define PROPERTY_VALID 0x1
  41. //#define PROPERTY_MODIFIED 0x2
  42. */
  43. #define PROPERTY_READABLE 0x4
  44. #define PROPERTY_WRITEABLE 0x8
  45. #define PROPERTY_RW PROPERTY_READABLE | PROPERTY_WRITEABLE
  46. #define PROPERTY_SETTABLE_ON_CREATE_ONLY 0x20
  47. #define CACHE_PROPERTY_MODIFIED 0x1
  48. #define PROPERTY_IS_MODIFIED(pProperty) \
  49. ( (PROPERTY_FLAGS(pProperty) & CACHE_PROPERTY_MODIFIED) ? \
  50. TRUE : FALSE )
  51. class CPropertyCache {
  52. public:
  53. HRESULT
  54. CPropertyCache::
  55. addproperty(
  56. LPWSTR szPropertyName,
  57. DWORD dwSyntaxId,
  58. DWORD dwNumValues,
  59. PNTOBJECT pNtObject
  60. );
  61. HRESULT
  62. CPropertyCache::
  63. updateproperty(
  64. LPWSTR szPropertyName,
  65. DWORD dwSyntaxId,
  66. DWORD dwNumValues,
  67. PNTOBJECT pNtObject,
  68. BOOL fExplicit
  69. );
  70. HRESULT
  71. CPropertyCache::
  72. findproperty(
  73. LPWSTR szPropertyName,
  74. PDWORD pdwIndex
  75. );
  76. HRESULT
  77. CPropertyCache::
  78. deleteproperty(
  79. DWORD dwIndex
  80. );
  81. HRESULT
  82. CPropertyCache::
  83. getproperty(
  84. LPWSTR szPropertyName,
  85. PDWORD pdwSyntaxId,
  86. PDWORD pdwNumValues,
  87. PNTOBJECT * ppNtObject
  88. );
  89. HRESULT
  90. CPropertyCache::
  91. unboundgetproperty(
  92. LPWSTR szPropertyName,
  93. PDWORD pdwSyntaxId,
  94. PDWORD pdwNumValues,
  95. PNTOBJECT * ppNtObject
  96. );
  97. HRESULT
  98. CPropertyCache::
  99. unboundgetproperty(
  100. DWORD dwIndex,
  101. PDWORD pdwSyntaxId,
  102. PDWORD pdwNumValues,
  103. PNTOBJECT * ppNtObject
  104. );
  105. HRESULT
  106. CPropertyCache::
  107. marshallgetproperty(
  108. LPWSTR szPropertyName,
  109. PDWORD pdwSyntaxId,
  110. PDWORD pdwNumValues,
  111. PNTOBJECT * ppNtObject
  112. );
  113. HRESULT
  114. CPropertyCache::
  115. putproperty(
  116. LPWSTR szPropertyName,
  117. DWORD dwSyntaxId,
  118. DWORD dwNumValues,
  119. PNTOBJECT pNtObject
  120. );
  121. HRESULT
  122. CPropertyCache::
  123. propertyismodified(
  124. LPWSTR szPropertyName,
  125. BOOL * pfModified
  126. );
  127. void
  128. CPropertyCache::
  129. flushpropcache();
  130. void
  131. CPropertyCache::
  132. reset_propindex(
  133. );
  134. BOOL
  135. CPropertyCache::
  136. index_valid(
  137. );
  138. BOOL
  139. CPropertyCache::
  140. index_valid(
  141. DWORD dwIndex
  142. );
  143. HRESULT
  144. CPropertyCache::
  145. skip_propindex(
  146. DWORD dwElements
  147. );
  148. HRESULT
  149. CPropertyCache::
  150. get_PropertyCount(
  151. PDWORD pdwMaxProperties
  152. );
  153. DWORD
  154. CPropertyCache::
  155. get_CurrentIndex(
  156. );
  157. LPWSTR
  158. CPropertyCache::
  159. get_CurrentPropName(
  160. );
  161. LPWSTR
  162. CPropertyCache::
  163. get_PropName(
  164. DWORD dwIndex
  165. );
  166. CPropertyCache::
  167. CPropertyCache();
  168. CPropertyCache::
  169. ~CPropertyCache();
  170. static
  171. HRESULT
  172. CPropertyCache::
  173. createpropertycache(
  174. PPROPERTYINFO pSchemaClassProps,
  175. DWORD dwNumProperties,
  176. CCoreADsObject FAR * pCoreADsObject,
  177. CPropertyCache FAR * FAR * ppPropertyCache
  178. );
  179. HRESULT
  180. CPropertyCache::
  181. unmarshallproperty(
  182. LPWSTR szPropertyName,
  183. LPBYTE lpValue,
  184. DWORD dwNumValues,
  185. DWORD dwSyntaxId,
  186. BOOL fExplicit
  187. );
  188. protected:
  189. DWORD _dwMaxProperties;
  190. CCoreADsObject * _pCoreADsObject;
  191. PPROPERTYINFO _pSchemaClassProps;
  192. DWORD _dwNumProperties;
  193. DWORD _dwCurrentIndex;
  194. PPROPERTY _pProperties;
  195. DWORD _cb;
  196. };
  197. HRESULT
  198. ValidatePropertyinSchemaClass(
  199. PPROPERTYINFO pSchemaClassProps,
  200. DWORD dwNumProperties,
  201. LPWSTR pszPropName,
  202. PDWORD pdwSyntaxId
  203. );
  204. STDMETHODIMP
  205. GenericGetPropertyManager(
  206. CPropertyCache * pPropertyCache,
  207. THIS_ BSTR bstrName,
  208. VARIANT FAR* pvProp
  209. );
  210. STDMETHODIMP
  211. GenericPutPropertyManager(
  212. CPropertyCache * pPropertyCache,
  213. PPROPERTYINFO pSchemaProps,
  214. DWORD dwSchemaPropSize,
  215. THIS_ BSTR bstrName,
  216. VARIANT vProp
  217. );
  218. HRESULT
  219. ValidateIfWriteableProperty(
  220. PPROPERTYINFO pSchemaClassProps,
  221. DWORD dwNumProperties,
  222. LPWSTR pszPropName
  223. );
  224. HRESULT
  225. GetPropertyInfoLevel(
  226. LPWSTR pszPropName,
  227. PPROPERTYINFO pSchemaClassProps,
  228. DWORD dwNumProperties,
  229. PDWORD pdwInfoLevel
  230. );
  231. STDMETHODIMP
  232. GenericGetExPropertyManager(
  233. DWORD dwObjectState,
  234. CPropertyCache * pPropertyCache,
  235. THIS_ BSTR bstrName,
  236. VARIANT FAR* pvProp
  237. );
  238. STDMETHODIMP
  239. GenericPutExPropertyManager(
  240. CPropertyCache * pPropertyCache,
  241. PPROPERTYINFO pSchemaProps,
  242. DWORD dwSchemaPropSize,
  243. THIS_ BSTR bstrName,
  244. VARIANT vProp
  245. );
  246. HRESULT
  247. GenericPropCountPropertyManager(
  248. CPropertyCache * pPropertyCache,
  249. PLONG plCount
  250. );
  251. HRESULT
  252. GenericNextPropertyManager(
  253. CPropertyCache * pPropertyCache,
  254. VARIANT FAR *pVariant
  255. );
  256. HRESULT
  257. GenericSkipPropertyManager(
  258. CPropertyCache * pPropertyCache,
  259. ULONG cElements
  260. );
  261. HRESULT
  262. GenericResetPropertyManager(
  263. CPropertyCache * pPropertyCache
  264. );
  265. HRESULT
  266. GenericDeletePropertyManager(
  267. CPropertyCache * pPropertyCache,
  268. VARIANT varEntry
  269. );
  270. HRESULT
  271. GenericGetPropItemPropertyManager(
  272. CPropertyCache * pPropertyCache,
  273. DWORD dwObjectState,
  274. BSTR bstrName,
  275. LONG lnADsType,
  276. VARIANT * pVariant
  277. );
  278. HRESULT
  279. GenericPutPropItemPropertyManager(
  280. CPropertyCache * pPropertyCache,
  281. PPROPERTYINFO pSchemaProps,
  282. DWORD dwSchemaPropSize,
  283. VARIANT varData
  284. );
  285. HRESULT
  286. GenericPurgePropertyManager(
  287. CPropertyCache * pPropertyCache
  288. );
  289. HRESULT
  290. GenericItemPropertyManager(
  291. CPropertyCache * pPropertyCache,
  292. DWORD dwObjectState,
  293. VARIANT varIndex,
  294. VARIANT *pVariant
  295. );
  296. HRESULT
  297. ConvertNtValuesToVariant(
  298. BSTR bstrName,
  299. LPNTOBJECT pNtSrcObjects,
  300. DWORD dwNumValues,
  301. VARIANT * pVariant
  302. );
  303. HRESULT
  304. ConvertVariantToVariantArray(
  305. VARIANT varData,
  306. VARIANT ** ppVarArray,
  307. DWORD * pdwNumValues
  308. );
  309. void
  310. FreeVariantArray(
  311. VARIANT * pVarArray,
  312. DWORD dwNumValues
  313. );
  314. HRESULT
  315. ConvertVariantToNtValues(
  316. VARIANT varData,
  317. PPROPERTYINFO pSchemaProps,
  318. DWORD dwSchemaPropSize,
  319. LPWSTR szPropertyName,
  320. PNTOBJECT *ppNtDestObjects,
  321. PDWORD pdwNumValues,
  322. PDWORD pdwSyntaxId,
  323. PDWORD pdwControlCode
  324. );