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.

493 lines
9.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. //
  28. // Dynamic Dispid Table
  29. //
  30. typedef struct _dispproperty {
  31. LPWSTR szPropertyName;
  32. } DISPPROPERTY, *PDISPPROPERTY;
  33. #define PROPERTY_NAME(pProperty) pProperty->szPropertyName
  34. #define PROPERTY_VALUES(pProperty) pProperty->lpValues
  35. #define PROPERTY_NUMVALUES(pProperty) pProperty->dwNumValues
  36. #define PROPERTY_SYNTAX(pProperty) pProperty->dwSyntaxId
  37. #define PROPERTY_NTOBJECT(pProperty) pProperty->pNtObject
  38. #define PROPERTY_FLAGS(pProperty) pProperty->dwFlags
  39. #define PROPERTY_INFOLEVEL(pProperty) pProperty->dwInfoLevel
  40. //
  41. // Schema Status flags
  42. //
  43. #define PROPERTY_VALID 0x1
  44. #define PROPERTY_MODIFIED 0x2
  45. #define PROPERTY_READABLE 0x4
  46. #define PROPERTY_WRITEABLE 0x8
  47. #define PROPERTY_RW PROPERTY_READABLE | PROPERTY_WRITEABLE
  48. #define PROPERTY_SETTABLE_ON_CREATE_ONLY 0x20
  49. #define CACHE_PROPERTY_MODIFIED 0x1
  50. //
  51. // Dynamic Dispid Table
  52. //
  53. #define DISPATCH_NAME(pDispProperty) \
  54. ( (pDispProperty)->szPropertyName)
  55. #define DISPATCH_PROPERTY_NAME(dwDispid) \
  56. ( (_pDispProperties+(dwDispid))->szPropertyName )
  57. #define DISPATCH_INDEX_VALID(dwDispid) \
  58. ( (((LONG)(dwDispid)) >=0 && (dwDispid) <_dwDispMaxProperties) ? TRUE : FALSE)
  59. class CPropertyCache : public IPropertyCache {
  60. public:
  61. HRESULT
  62. CPropertyCache::
  63. addproperty(
  64. LPWSTR szPropertyName,
  65. DWORD dwSyntaxId,
  66. DWORD dwNumValues,
  67. PNTOBJECT pNtObject
  68. );
  69. HRESULT
  70. CPropertyCache::
  71. updateproperty(
  72. LPWSTR szPropertyName,
  73. DWORD dwSyntaxId,
  74. DWORD dwNumValues,
  75. PNTOBJECT pNtObject,
  76. BOOL fExplicit
  77. );
  78. HRESULT
  79. CPropertyCache::
  80. findproperty(
  81. LPWSTR szPropertyName,
  82. PDWORD pdwIndex
  83. );
  84. HRESULT
  85. CPropertyCache::
  86. deleteproperty(
  87. DWORD dwIndex
  88. );
  89. HRESULT
  90. CPropertyCache::
  91. getproperty(
  92. LPWSTR szPropertyName,
  93. PDWORD pdwSyntaxId,
  94. PDWORD pdwNumValues,
  95. PNTOBJECT * ppNtObject,
  96. BOOL *pfModified = NULL // indicates if the property was
  97. // modified or not in cache. Used by UMI.
  98. );
  99. HRESULT
  100. CPropertyCache::
  101. unboundgetproperty(
  102. LPWSTR szPropertyName,
  103. PDWORD pdwSyntaxId,
  104. PDWORD pdwNumValues,
  105. PNTOBJECT * ppNtObject
  106. );
  107. HRESULT
  108. CPropertyCache::
  109. unboundgetproperty(
  110. DWORD dwIndex,
  111. PDWORD pdwSyntaxId,
  112. PDWORD pdwNumValues,
  113. PNTOBJECT * ppNtObject
  114. );
  115. HRESULT
  116. CPropertyCache::
  117. marshallgetproperty(
  118. LPWSTR szPropertyName,
  119. PDWORD pdwSyntaxId,
  120. PDWORD pdwNumValues,
  121. PNTOBJECT * ppNtObject
  122. );
  123. HRESULT
  124. CPropertyCache::
  125. putproperty(
  126. LPWSTR szPropertyName,
  127. DWORD dwSyntaxId,
  128. DWORD dwNumValues,
  129. PNTOBJECT pNtObject,
  130. BOOL fMarkAsClean = FALSE
  131. );
  132. void
  133. CPropertyCache::
  134. flushpropcache();
  135. CPropertyCache::
  136. CPropertyCache();
  137. CPropertyCache::
  138. ~CPropertyCache();
  139. void
  140. CPropertyCache::
  141. reset_propindex(
  142. );
  143. BOOL
  144. CPropertyCache::
  145. index_valid(
  146. );
  147. BOOL
  148. CPropertyCache::
  149. index_valid(
  150. DWORD dwIndex
  151. );
  152. HRESULT
  153. CPropertyCache::
  154. skip_propindex(
  155. DWORD dwElements
  156. );
  157. HRESULT
  158. CPropertyCache::
  159. get_PropertyCount(
  160. PDWORD pdwMaxProperties
  161. );
  162. DWORD
  163. CPropertyCache::
  164. get_CurrentIndex(
  165. );
  166. LPWSTR
  167. CPropertyCache::
  168. get_CurrentPropName(
  169. );
  170. LPWSTR
  171. CPropertyCache::
  172. get_PropName(
  173. DWORD dwIndex
  174. );
  175. static
  176. HRESULT
  177. CPropertyCache::
  178. createpropertycache(
  179. PPROPERTYINFO pSchemaClassProps,
  180. DWORD dwNumProperties,
  181. CCoreADsObject FAR * pCoreADsObject,
  182. CPropertyCache FAR * FAR * ppPropertyCache
  183. );
  184. HRESULT
  185. CPropertyCache::
  186. unmarshallproperty(
  187. LPWSTR szPropertyName,
  188. LPBYTE lpValue,
  189. DWORD dwNumValues,
  190. DWORD dwSyntaxId,
  191. BOOL fExplicit
  192. );
  193. //
  194. // IPropertyCache
  195. //
  196. HRESULT
  197. locateproperty(
  198. LPWSTR szPropertyName,
  199. PDWORD pdwDispid
  200. );
  201. HRESULT
  202. putproperty(
  203. DWORD dwDispid,
  204. VARIANT varValue
  205. );
  206. HRESULT
  207. getproperty(
  208. DWORD dwDispid,
  209. VARIANT * pvarValue
  210. );
  211. HRESULT
  212. GetPropNames(
  213. UMI_PROPERTY_VALUES **pProps
  214. );
  215. void
  216. ClearModifiedFlags(void);
  217. protected:
  218. //
  219. // Dynamic Dispid Table
  220. //
  221. HRESULT
  222. DispatchAddProperty(
  223. LPWSTR szPropertyName,
  224. PDWORD pdwDispid
  225. );
  226. HRESULT
  227. DispatchFindProperty(
  228. LPWSTR szPropertyName,
  229. PDWORD pdwDispid
  230. );
  231. //
  232. // These 3 functions are supposted to replace the 3 functions
  233. // in IPropertyCache. We will make these functions private and
  234. // IPropertyCahce call these functions for now.
  235. //
  236. HRESULT
  237. DispatchLocateProperty(
  238. LPWSTR szPropertyName,
  239. PDWORD pdwDispid
  240. );
  241. HRESULT
  242. DispatchGetProperty(
  243. DWORD dwDispid,
  244. VARIANT *pvarVal
  245. );
  246. HRESULT
  247. DispatchPutProperty(
  248. DWORD dwDispid,
  249. VARIANT& varVal
  250. );
  251. DWORD _dwMaxProperties;
  252. CCoreADsObject * _pCoreADsObject;
  253. PPROPERTYINFO _pSchemaClassProps;
  254. DWORD _dwNumProperties;
  255. DWORD _dwCurrentIndex;
  256. PPROPERTY _pProperties;
  257. DWORD _cb;
  258. //
  259. // Dynamic Dispid Table
  260. //
  261. PDISPPROPERTY _pDispProperties;
  262. DWORD _cbDisp;
  263. DWORD _dwDispMaxProperties;
  264. };
  265. HRESULT
  266. ValidatePropertyinSchemaClass(
  267. PPROPERTYINFO pSchemaClassProps,
  268. DWORD dwNumProperties,
  269. LPWSTR pszPropName,
  270. PDWORD pdwSyntaxId
  271. );
  272. STDMETHODIMP
  273. GenericGetPropertyManager(
  274. CPropertyCache * pPropertyCache,
  275. THIS_ BSTR bstrName,
  276. VARIANT FAR* pvProp
  277. );
  278. STDMETHODIMP
  279. GenericPutPropertyManager(
  280. CPropertyCache * pPropertyCache,
  281. PPROPERTYINFO pSchemaProps,
  282. DWORD dwSchemaPropSize,
  283. THIS_ BSTR bstrName,
  284. VARIANT vProp,
  285. BOOL fCheckWriteAccess = TRUE
  286. );
  287. HRESULT
  288. ValidateIfWriteableProperty(
  289. PPROPERTYINFO pSchemaClassProps,
  290. DWORD dwNumProperties,
  291. LPWSTR pszPropName
  292. );
  293. HRESULT
  294. GetPropertyInfoLevel(
  295. LPWSTR pszPropName,
  296. PPROPERTYINFO pSchemaClassProps,
  297. DWORD dwNumProperties,
  298. PDWORD pdwInfoLevel
  299. );
  300. STDMETHODIMP
  301. GenericGetExPropertyManager(
  302. DWORD dwObjectState,
  303. CPropertyCache * pPropertyCache,
  304. THIS_ BSTR bstrName,
  305. VARIANT FAR* pvProp
  306. );
  307. STDMETHODIMP
  308. GenericPutExPropertyManager(
  309. CPropertyCache * pPropertyCache,
  310. PPROPERTYINFO pSchemaProps,
  311. DWORD dwSchemaPropSize,
  312. THIS_ BSTR bstrName,
  313. VARIANT vProp
  314. );
  315. HRESULT
  316. GenericPropCountPropertyManager(
  317. CPropertyCache * pPropertyCache,
  318. PLONG plCount
  319. );
  320. HRESULT
  321. GenericNextPropertyManager(
  322. CPropertyCache * pPropertyCache,
  323. VARIANT FAR *pVariant
  324. );
  325. HRESULT
  326. GenericSkipPropertyManager(
  327. CPropertyCache * pPropertyCache,
  328. ULONG cElements
  329. );
  330. HRESULT
  331. GenericResetPropertyManager(
  332. CPropertyCache * pPropertyCache
  333. );
  334. HRESULT
  335. GenericDeletePropertyManager(
  336. CPropertyCache * pPropertyCache,
  337. VARIANT varEntry
  338. );
  339. HRESULT
  340. GenericGetPropItemPropertyManager(
  341. CPropertyCache * pPropertyCache,
  342. DWORD dwObjectState,
  343. BSTR bstrName,
  344. LONG lnADsType,
  345. VARIANT * pVariant
  346. );
  347. HRESULT
  348. GenericPutPropItemPropertyManager(
  349. CPropertyCache * pPropertyCache,
  350. PPROPERTYINFO pSchemaProps,
  351. DWORD dwSchemaPropSize,
  352. VARIANT varData
  353. );
  354. HRESULT
  355. GenericPurgePropertyManager(
  356. CPropertyCache * pPropertyCache
  357. );
  358. HRESULT
  359. GenericItemPropertyManager(
  360. CPropertyCache * pPropertyCache,
  361. DWORD dwObjectState,
  362. VARIANT varIndex,
  363. VARIANT *pVariant
  364. );
  365. HRESULT
  366. ConvertNtValuesToVariant(
  367. BSTR bstrName,
  368. LPNTOBJECT pNtSrcObjects,
  369. DWORD dwNumValues,
  370. VARIANT * pVariant
  371. );
  372. HRESULT
  373. ConvertVariantToVariantArray(
  374. VARIANT varData,
  375. VARIANT ** ppVarArray,
  376. DWORD * pdwNumValues
  377. );
  378. void
  379. FreeVariantArray(
  380. VARIANT * pVarArray,
  381. DWORD dwNumValues
  382. );
  383. HRESULT
  384. ConvertVariantToNtValues(
  385. VARIANT varData,
  386. PPROPERTYINFO pSchemaProps,
  387. DWORD dwSchemaPropSize,
  388. LPWSTR szPropertyName,
  389. PNTOBJECT *ppNtDestObjects,
  390. PDWORD pdwNumValues,
  391. PDWORD pdwSyntaxId,
  392. PDWORD pdwControlCode
  393. );