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.

339 lines
7.2 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: cprops.hxx
  7. //
  8. // Contents:
  9. //
  10. // History: 17-Feb-1998 sophiac Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. typedef struct _property{
  14. WCHAR szPropertyName[MAX_PATH];
  15. DWORD dwFlags;
  16. DWORD dwNumValues; // Number of values
  17. DWORD dwSyntaxId; // IIS Syntax Id
  18. DWORD dwMDIdentifier; // IIS MetaData Identifier
  19. PIISOBJECT pIISObject; // Pointer to the IIS Object
  20. }PROPERTY, *PPROPERTY;
  21. //
  22. // Dynamic Dispid Table
  23. //
  24. typedef struct _dispproperty {
  25. WCHAR szPropertyName[MAX_PATH];
  26. } DISPPROPERTY, *PDISPPROPERTY;
  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_IISOBJECT(pProperty) pProperty->pIISObject
  32. #define PROPERTY_FLAGS(pProperty) pProperty->dwFlags
  33. #define PROPERTY_INFOLEVEL(pProperty) pProperty->dwInfoLevel
  34. #define PROPERTY_METAID(pProperty) pProperty->dwMDIdentifier
  35. //
  36. // Schema Status flags
  37. //
  38. #define CACHE_PROPERTY_INITIALIZED 0x0
  39. #define CACHE_PROPERTY_MODIFIED 0x1
  40. #define CACHE_PROPERTY_CLEARED 0x2
  41. //
  42. // Dynamic Dispid Table
  43. //
  44. #define DISPATCH_NAME(pDispProperty) \
  45. ( (pDispProperty)->szPropertyName)
  46. #define DISPATCH_PROPERTY_NAME(dwDispid) \
  47. ( (_pDispProperties+(dwDispid))->szPropertyName )
  48. #define DISPATCH_INDEX_VALID(dwDispid) \
  49. ( ((dwDispid) <_dwDispMaxProperties) ? TRUE : FALSE)
  50. class CPropertyCache : public IPropertyCache {
  51. public:
  52. HRESULT
  53. CPropertyCache::
  54. addproperty(
  55. LPWSTR szPropertyName,
  56. DWORD dwSyntaxId,
  57. DWORD dwNumValues,
  58. PIISOBJECT pIISObject
  59. );
  60. HRESULT
  61. CPropertyCache::
  62. updateproperty(
  63. LPWSTR szPropertyName,
  64. DWORD dwSyntaxId,
  65. DWORD dwNumValues,
  66. PIISOBJECT pIISObject,
  67. BOOL fExplicit
  68. );
  69. HRESULT
  70. CPropertyCache::
  71. findproperty(
  72. LPWSTR szPropertyName,
  73. PDWORD pdwIndex
  74. );
  75. HRESULT
  76. CPropertyCache::
  77. deleteproperty(
  78. DWORD dwIndex
  79. );
  80. HRESULT
  81. CPropertyCache::
  82. getproperty(
  83. LPWSTR szPropertyName,
  84. PDWORD pdwSyntaxId,
  85. PDWORD pdwNumValues,
  86. PIISOBJECT * ppIISObject
  87. );
  88. HRESULT
  89. CPropertyCache::
  90. putproperty(
  91. LPWSTR szPropertyName,
  92. DWORD dwFlags,
  93. DWORD dwSyntaxId,
  94. DWORD dwNumValues,
  95. PIISOBJECT pIISObject
  96. );
  97. HRESULT
  98. CPropertyCache::
  99. IISMarshallProperties(
  100. PMETADATA_RECORD * ppMetaDataRecords,
  101. PDWORD pdwMDNumDataEntries
  102. );
  103. HRESULT
  104. CPropertyCache::
  105. IISUnMarshallProperties(
  106. LPBYTE pBase,
  107. LPBYTE pBuffer,
  108. DWORD dwMDNumDataEntries,
  109. BOOL fExplicit
  110. );
  111. void
  112. CPropertyCache::
  113. flushpropcache();
  114. CPropertyCache::
  115. CPropertyCache();
  116. CPropertyCache::
  117. ~CPropertyCache();
  118. void
  119. CPropertyCache::
  120. reset_propindex(
  121. );
  122. BOOL
  123. CPropertyCache::
  124. index_valid(
  125. );
  126. BOOL
  127. CPropertyCache::
  128. index_valid(
  129. DWORD dwIndex
  130. );
  131. HRESULT
  132. CPropertyCache::
  133. skip_propindex(
  134. DWORD dwElements
  135. );
  136. HRESULT
  137. CPropertyCache::
  138. get_PropertyCount(
  139. PDWORD pdwMaxProperties
  140. );
  141. DWORD
  142. CPropertyCache::
  143. get_CurrentIndex(
  144. );
  145. LPWSTR
  146. CPropertyCache::
  147. get_CurrentPropName(
  148. );
  149. LPWSTR
  150. CPropertyCache::
  151. get_PropName(
  152. DWORD dwIndex
  153. );
  154. static
  155. HRESULT
  156. CPropertyCache::
  157. createpropertycache(
  158. CCoreADsObject FAR * pCoreADsObject,
  159. CPropertyCache FAR * FAR * ppPropertyCache
  160. );
  161. HRESULT
  162. InitializePropertyCache(
  163. IN LPCWSTR pwszServerName
  164. )
  165. {
  166. return ADsAllocString( pwszServerName, &_bstrServerName );
  167. }
  168. HRESULT
  169. CPropertyCache::
  170. unmarshallproperty(
  171. LPWSTR szPropertyName,
  172. LPBYTE lpValue,
  173. DWORD dwNumValues,
  174. DWORD dwSyntaxId,
  175. BOOL fExplicit
  176. );
  177. //
  178. // IPropertyCache
  179. //
  180. HRESULT
  181. locateproperty(
  182. LPWSTR szPropertyName,
  183. PDWORD pdwDispid
  184. );
  185. HRESULT
  186. putproperty(
  187. DWORD dwDispid,
  188. VARIANT varValue
  189. );
  190. HRESULT
  191. getproperty(
  192. DWORD dwDispid,
  193. VARIANT * pvarValue
  194. );
  195. protected:
  196. //
  197. // Dynamic Dispid Table
  198. //
  199. HRESULT
  200. DispatchAddProperty(
  201. LPWSTR szPropertyName,
  202. PDWORD pdwDispid
  203. );
  204. HRESULT
  205. DispatchFindProperty(
  206. LPWSTR szPropertyName,
  207. PDWORD pdwDispid
  208. );
  209. //
  210. // These 3 functions are supposted to replace the 3 functions
  211. // in IPropertyCache. We will make these functions private and
  212. // IPropertyCahce call these functions for now.
  213. //
  214. HRESULT
  215. DispatchLocateProperty(
  216. LPWSTR szPropertyName,
  217. PDWORD pdwDispid
  218. );
  219. HRESULT
  220. DispatchGetProperty(
  221. DWORD dwDispid,
  222. VARIANT *pvarVal
  223. );
  224. HRESULT
  225. DispatchPutProperty(
  226. DWORD dwDispid,
  227. VARIANT& varVal
  228. );
  229. HRESULT LoadSchema( void )
  230. /*++
  231. Routine Description:
  232. Loads the schema information for this machine. It is
  233. essential that this method be called at the top of any
  234. routine that uses _pSchema. Since the schema cache is
  235. not very clever, we want to ensure that we don't load
  236. it until we absolutely have to.
  237. Return Value:
  238. Notes:
  239. --*/
  240. {
  241. IMSAdminBase * pTempAdminBase = NULL;
  242. CCredentials localCred;
  243. //
  244. // Get a reference to the schema for this machine.
  245. //
  246. // BUGBUG: The IMSAdminBase is held by the cache, and is not
  247. // incremented when the interface is handed out here.
  248. //
  249. return (_pSchema == NULL ) ?
  250. ::InitServerInfo( localCred, _bstrServerName, &pTempAdminBase, &_pSchema ) :
  251. S_FALSE;
  252. }
  253. DWORD _dwMaxProperties;
  254. CCoreADsObject * _pCoreADsObject;
  255. DWORD _dwNumProperties;
  256. DWORD _dwCurrentIndex;
  257. PPROPERTY _pProperties;
  258. BOOL _bPropsLoaded;
  259. DWORD _cb;
  260. // _pSchema is lazy loaded. It is essential to call LoadSchema() at
  261. // the start of any routine that attempts to use _pSchema.
  262. IIsSchema * _pSchema;
  263. BSTR _bstrServerName;
  264. //
  265. // Dynamic Dispid Table
  266. //
  267. PDISPPROPERTY _pDispProperties;
  268. DWORD _cbDisp;
  269. DWORD _dwDispMaxProperties;
  270. };