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.

423 lines
8.4 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 : public IPropertyCache {
  52. public:
  53. HRESULT
  54. CPropertyCache::
  55. addproperty(
  56. LPWSTR szPropertyName,
  57. DWORD dwSyntaxId
  58. );
  59. HRESULT
  60. CPropertyCache::
  61. updateproperty(
  62. LPWSTR szPropertyName,
  63. DWORD dwSyntaxId,
  64. DWORD dwNumValues,
  65. PNTOBJECT pNtObject,
  66. BOOL fExplicit
  67. );
  68. HRESULT
  69. CPropertyCache::
  70. findproperty(
  71. LPWSTR szPropertyName,
  72. PDWORD pdwIndex
  73. );
  74. HRESULT
  75. CPropertyCache::
  76. deleteproperty(
  77. DWORD dwIndex
  78. );
  79. HRESULT
  80. CPropertyCache::
  81. getproperty(
  82. LPWSTR szPropertyName,
  83. PDWORD pdwSyntaxId,
  84. PDWORD pdwNumValues,
  85. PNTOBJECT * ppNtObject
  86. );
  87. HRESULT
  88. CPropertyCache::
  89. unboundgetproperty(
  90. LPWSTR szPropertyName,
  91. PDWORD pdwSyntaxId,
  92. PDWORD pdwNumValues,
  93. PNTOBJECT * ppNtObject
  94. );
  95. HRESULT
  96. CPropertyCache::
  97. unboundgetproperty(
  98. DWORD dwIndex,
  99. PDWORD pdwSyntaxId,
  100. PDWORD pdwNumValues,
  101. PNTOBJECT * ppNtObject
  102. );
  103. HRESULT
  104. CPropertyCache::
  105. marshallgetproperty(
  106. LPWSTR szPropertyName,
  107. PDWORD pdwSyntaxId,
  108. PDWORD pdwNumValues,
  109. PNTOBJECT * ppNtObject
  110. );
  111. HRESULT
  112. CPropertyCache::
  113. putproperty(
  114. LPWSTR szPropertyName,
  115. DWORD dwSyntaxId,
  116. DWORD dwNumValues,
  117. PNTOBJECT pNtObject
  118. );
  119. HRESULT
  120. CPropertyCache::
  121. propertyismodified(
  122. LPWSTR szPropertyName,
  123. BOOL * pfModified
  124. );
  125. void
  126. CPropertyCache::
  127. flushpropcache();
  128. void
  129. CPropertyCache::
  130. reset_propindex(
  131. );
  132. BOOL
  133. CPropertyCache::
  134. index_valid(
  135. );
  136. BOOL
  137. CPropertyCache::
  138. index_valid(
  139. DWORD dwIndex
  140. );
  141. HRESULT
  142. CPropertyCache::
  143. skip_propindex(
  144. DWORD dwElements
  145. );
  146. HRESULT
  147. CPropertyCache::
  148. get_PropertyCount(
  149. PDWORD pdwMaxProperties
  150. );
  151. DWORD
  152. CPropertyCache::
  153. get_CurrentIndex(
  154. );
  155. LPWSTR
  156. CPropertyCache::
  157. get_CurrentPropName(
  158. );
  159. LPWSTR
  160. CPropertyCache::
  161. get_PropName(
  162. DWORD dwIndex
  163. );
  164. CPropertyCache::
  165. CPropertyCache();
  166. CPropertyCache::
  167. ~CPropertyCache();
  168. static
  169. HRESULT
  170. CPropertyCache::
  171. createpropertycache(
  172. PPROPERTYINFO pSchemaClassProps,
  173. DWORD dwNumProperties,
  174. CCoreADsObject FAR * pCoreADsObject,
  175. CPropertyCache FAR * FAR * ppPropertyCache
  176. );
  177. HRESULT
  178. CPropertyCache::
  179. unmarshallproperty(
  180. LPWSTR szPropertyName,
  181. LPBYTE lpValue,
  182. DWORD dwNumValues,
  183. DWORD dwSyntaxId,
  184. BOOL fExplicit
  185. );
  186. //
  187. // IPropertyCache
  188. //
  189. HRESULT
  190. locateproperty(
  191. LPWSTR szPropertyName,
  192. PDWORD pdwDispid
  193. );
  194. HRESULT
  195. putproperty(
  196. DWORD dwDispid,
  197. VARIANT varValue
  198. );
  199. HRESULT
  200. getproperty(
  201. DWORD dwDispid,
  202. VARIANT * pvarValue
  203. );
  204. protected:
  205. DWORD _dwMaxProperties;
  206. CCoreADsObject * _pCoreADsObject;
  207. PPROPERTYINFO _pSchemaClassProps;
  208. DWORD _dwNumProperties;
  209. DWORD _dwCurrentIndex;
  210. PPROPERTY _pProperties;
  211. DWORD _cb;
  212. };
  213. HRESULT
  214. ValidatePropertyinSchemaClass(
  215. PPROPERTYINFO pSchemaClassProps,
  216. DWORD dwNumProperties,
  217. LPWSTR pszPropName,
  218. PDWORD pdwSyntaxId
  219. );
  220. STDMETHODIMP
  221. GenericGetPropertyManager(
  222. CPropertyCache * pPropertyCache,
  223. THIS_ BSTR bstrName,
  224. VARIANT FAR* pvProp
  225. );
  226. STDMETHODIMP
  227. GenericPutPropertyManager(
  228. CPropertyCache * pPropertyCache,
  229. PPROPERTYINFO pSchemaProps,
  230. DWORD dwSchemaPropSize,
  231. THIS_ BSTR bstrName,
  232. VARIANT vProp
  233. );
  234. HRESULT
  235. ValidateIfWriteableProperty(
  236. PPROPERTYINFO pSchemaClassProps,
  237. DWORD dwNumProperties,
  238. LPWSTR pszPropName
  239. );
  240. HRESULT
  241. GetPropertyInfoLevel(
  242. LPWSTR pszPropName,
  243. PPROPERTYINFO pSchemaClassProps,
  244. DWORD dwNumProperties,
  245. PDWORD pdwInfoLevel
  246. );
  247. STDMETHODIMP
  248. GenericGetExPropertyManager(
  249. DWORD dwObjectState,
  250. CPropertyCache * pPropertyCache,
  251. THIS_ BSTR bstrName,
  252. VARIANT FAR* pvProp
  253. );
  254. STDMETHODIMP
  255. GenericPutExPropertyManager(
  256. CPropertyCache * pPropertyCache,
  257. PPROPERTYINFO pSchemaProps,
  258. DWORD dwSchemaPropSize,
  259. THIS_ BSTR bstrName,
  260. VARIANT vProp
  261. );
  262. HRESULT
  263. GenericPropCountPropertyManager(
  264. CPropertyCache * pPropertyCache,
  265. PLONG plCount
  266. );
  267. HRESULT
  268. GenericNextPropertyManager(
  269. CPropertyCache * pPropertyCache,
  270. VARIANT FAR *pVariant
  271. );
  272. HRESULT
  273. GenericSkipPropertyManager(
  274. CPropertyCache * pPropertyCache,
  275. ULONG cElements
  276. );
  277. HRESULT
  278. GenericResetPropertyManager(
  279. CPropertyCache * pPropertyCache
  280. );
  281. HRESULT
  282. GenericDeletePropertyManager(
  283. CPropertyCache * pPropertyCache,
  284. VARIANT varEntry
  285. );
  286. HRESULT
  287. GenericGetPropItemPropertyManager(
  288. CPropertyCache * pPropertyCache,
  289. DWORD dwObjectState,
  290. BSTR bstrName,
  291. LONG lnADsType,
  292. VARIANT * pVariant
  293. );
  294. HRESULT
  295. GenericPutPropItemPropertyManager(
  296. CPropertyCache * pPropertyCache,
  297. PPROPERTYINFO pSchemaProps,
  298. DWORD dwSchemaPropSize,
  299. VARIANT varData
  300. );
  301. HRESULT
  302. GenericPurgePropertyManager(
  303. CPropertyCache * pPropertyCache
  304. );
  305. HRESULT
  306. GenericItemPropertyManager(
  307. CPropertyCache * pPropertyCache,
  308. DWORD dwObjectState,
  309. VARIANT varIndex,
  310. VARIANT *pVariant
  311. );
  312. HRESULT
  313. ConvertNtValuesToVariant(
  314. BSTR bstrName,
  315. LPNTOBJECT pNtSrcObjects,
  316. DWORD dwNumValues,
  317. VARIANT * pVariant
  318. );
  319. HRESULT
  320. ConvertVariantToVariantArray(
  321. VARIANT varData,
  322. VARIANT ** ppVarArray,
  323. DWORD * pdwNumValues
  324. );
  325. void
  326. FreeVariantArray(
  327. VARIANT * pVarArray,
  328. DWORD dwNumValues
  329. );
  330. HRESULT
  331. ConvertVariantToNtValues(
  332. VARIANT varData,
  333. PPROPERTYINFO pSchemaProps,
  334. DWORD dwSchemaPropSize,
  335. LPWSTR szPropertyName,
  336. PNTOBJECT *ppNtDestObjects,
  337. PDWORD pdwNumValues,
  338. PDWORD pdwSyntaxId,
  339. PDWORD pdwControlCode
  340. );
  341. void
  342. ADsECodesToDispECodes(
  343. HRESULT *pHr
  344. );