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.

285 lines
7.1 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1997 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // PropList.h
  7. //
  8. // Abstract:
  9. // Definition of the CClusPropList class.
  10. //
  11. // Implementation File:
  12. // PropList.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) February 24, 1997
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef _PROPLIST_H_
  23. #define _PROPLIST_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Include Files
  26. /////////////////////////////////////////////////////////////////////////////
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Forward Class Declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. class CObjectProperty;
  31. class CClusPropList;
  32. /////////////////////////////////////////////////////////////////////////////
  33. // External Class Declarations
  34. /////////////////////////////////////////////////////////////////////////////
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CObjectProperty
  37. /////////////////////////////////////////////////////////////////////////////
  38. #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
  39. class CObjectProperty
  40. {
  41. public:
  42. LPCWSTR m_pwszName;
  43. CLUSTER_PROPERTY_FORMAT m_propFormat;
  44. union CValue
  45. {
  46. CString * pstr;
  47. DWORD * pdw;
  48. BOOL * pb;
  49. struct
  50. {
  51. PBYTE * ppb;
  52. DWORD * pcb;
  53. };
  54. };
  55. CValue m_value;
  56. CValue m_valuePrev;
  57. void Set(
  58. IN LPCWSTR pwszName,
  59. IN CString & rstrValue,
  60. IN CString & rstrPrevValue
  61. )
  62. {
  63. m_pwszName = pwszName;
  64. m_propFormat = CLUSPROP_FORMAT_SZ;
  65. m_value.pstr = &rstrValue;
  66. m_value.pcb = NULL;
  67. m_valuePrev.pstr = &rstrPrevValue;
  68. m_valuePrev.pcb = NULL;
  69. }
  70. void Set(
  71. IN LPCWSTR pwszName,
  72. IN DWORD & rdwValue,
  73. IN DWORD & rdwPrevValue
  74. )
  75. {
  76. m_pwszName = pwszName;
  77. m_propFormat = CLUSPROP_FORMAT_DWORD;
  78. m_value.pdw = &rdwValue;
  79. m_value.pcb = NULL;
  80. m_valuePrev.pdw = &rdwPrevValue;
  81. m_valuePrev.pcb = NULL;
  82. }
  83. void Set(
  84. IN LPCWSTR pwszName,
  85. IN BOOL & rbValue,
  86. IN BOOL & rbPrevValue
  87. )
  88. {
  89. m_pwszName = pwszName;
  90. m_propFormat = CLUSPROP_FORMAT_DWORD;
  91. m_value.pb = &rbValue;
  92. m_value.pcb = NULL;
  93. m_valuePrev.pb = &rbPrevValue;
  94. m_valuePrev.pcb = NULL;
  95. }
  96. void Set(
  97. IN LPCWSTR pwszName,
  98. IN PBYTE & rpbValue,
  99. IN DWORD & rcbValue,
  100. IN PBYTE & rpbPrevValue,
  101. IN DWORD & rcbPrevValue
  102. )
  103. {
  104. m_pwszName = pwszName;
  105. m_propFormat = CLUSPROP_FORMAT_BINARY;
  106. m_value.ppb = &rpbValue;
  107. m_value.pcb = &rcbValue;
  108. m_valuePrev.ppb = &rpbPrevValue;
  109. m_valuePrev.pcb = &rcbPrevValue;
  110. }
  111. void Set(
  112. IN LPCWSTR pwszName,
  113. IN LPWSTR & rpwszValue,
  114. IN DWORD & rcbValue,
  115. IN LPWSTR & rpwszPrevValue,
  116. IN DWORD & rcbPrevValue
  117. )
  118. {
  119. m_pwszName = pwszName;
  120. m_propFormat = CLUSPROP_FORMAT_MULTI_SZ;
  121. m_value.ppb = (PBYTE *) &rpwszValue;
  122. m_value.pcb = &rcbValue;
  123. m_valuePrev.ppb = (PBYTE *) &rpwszPrevValue;
  124. m_valuePrev.pcb = &rcbPrevValue;
  125. }
  126. }; //*** class CObjectProperty
  127. /////////////////////////////////////////////////////////////////////////////
  128. // CClusPropList dialog
  129. /////////////////////////////////////////////////////////////////////////////
  130. class CClusPropList : public CObject
  131. {
  132. DECLARE_DYNAMIC(CClusPropList);
  133. // Construction
  134. public:
  135. CClusPropList(IN BOOL bAlwaysAddProp = FALSE);
  136. ~CClusPropList(void);
  137. // Attributes
  138. protected:
  139. BOOL m_bAlwaysAddProp;
  140. CLUSPROP_BUFFER_HELPER m_proplist;
  141. CLUSPROP_BUFFER_HELPER m_propCurrent;
  142. DWORD m_cbBufferSize;
  143. DWORD m_cbDataSize;
  144. public:
  145. const CLUSPROP_BUFFER_HELPER const * Proplist(void) const { return &m_proplist; }
  146. PBYTE PbProplist(void) const { return m_proplist.pb; }
  147. DWORD CbProplist(void) const { return m_cbDataSize + sizeof(CLUSPROP_SYNTAX); /*endmark*/ }
  148. DWORD Cprops(void) const
  149. {
  150. if (m_proplist.pb == NULL)
  151. return 0;
  152. return m_proplist.pList->nPropertyCount;
  153. }
  154. void AddProp(
  155. IN LPCWSTR pwszName,
  156. IN const CString & rstrValue,
  157. IN const CString & rstrPrevValue
  158. );
  159. void AddProp(
  160. IN LPCWSTR pwszName,
  161. IN DWORD dwValue,
  162. IN DWORD dwPrevValue
  163. );
  164. void AddProp(
  165. IN LPCWSTR pwszName,
  166. IN const PBYTE pbValue,
  167. IN DWORD cbValue,
  168. IN const PBYTE pbPrevValue,
  169. IN DWORD cbPrevValue
  170. );
  171. void AllocPropList(IN DWORD cbMinimum);
  172. // Operations
  173. public:
  174. DWORD DwGetNodeProperties(
  175. IN HNODE hNode,
  176. IN DWORD dwControlCode,
  177. IN HNODE hHostNode = NULL,
  178. IN LPVOID lpInBuffer = NULL,
  179. IN DWORD cbInBufferSize = 0
  180. );
  181. DWORD DwGetGroupProperties(
  182. IN HGROUP hGroup,
  183. IN DWORD dwControlCode,
  184. IN HNODE hHostNode = NULL,
  185. IN LPVOID lpInBuffer = NULL,
  186. IN DWORD cbInBufferSize = 0
  187. );
  188. DWORD DwGetResourceProperties(
  189. IN HRESOURCE hResource,
  190. IN DWORD dwControlCode,
  191. IN HNODE hHostNode = NULL,
  192. IN LPVOID lpInBuffer = NULL,
  193. IN DWORD cbInBufferSize = 0
  194. );
  195. DWORD DwGetResourceTypeProperties(
  196. IN HCLUSTER hCluster,
  197. IN LPCWSTR pwszResTypeName,
  198. IN DWORD dwControlCode,
  199. IN HNODE hHostNode = NULL,
  200. IN LPVOID lpInBuffer = NULL,
  201. IN DWORD cbInBufferSize = 0
  202. );
  203. DWORD DwGetNetworkProperties(
  204. IN HNETWORK hNetwork,
  205. IN DWORD dwControlCode,
  206. IN HNODE hHostNode = NULL,
  207. IN LPVOID lpInBuffer = NULL,
  208. IN DWORD cbInBufferSize = 0
  209. );
  210. DWORD DwGetNetInterfaceProperties(
  211. IN HNETINTERFACE hNetInterface,
  212. IN DWORD dwControlCode,
  213. IN HNODE hHostNode = NULL,
  214. IN LPVOID lpInBuffer = NULL,
  215. IN DWORD cbInBufferSize = 0
  216. );
  217. // Overrides
  218. // Implementation
  219. protected:
  220. void CopyProp(
  221. IN PCLUSPROP_SZ pprop,
  222. IN CLUSTER_PROPERTY_TYPE proptype,
  223. IN LPCWSTR pwsz,
  224. IN DWORD cbsz = 0
  225. );
  226. void CopyProp(
  227. IN PCLUSPROP_DWORD pprop,
  228. IN CLUSTER_PROPERTY_TYPE proptype,
  229. IN DWORD dw
  230. );
  231. void CopyProp(
  232. IN PCLUSPROP_BINARY pprop,
  233. IN CLUSTER_PROPERTY_TYPE proptype,
  234. IN const PBYTE pb,
  235. IN DWORD cb
  236. );
  237. DWORD DwGetPrivateProps(
  238. OUT PBYTE * ppbProps,
  239. IN CLUSTER_CONTROL_OBJECT ccobjtype = CLUS_OBJECT_RESOURCE
  240. );
  241. DWORD DwSetPrivateProps(
  242. IN PBYTE pbProps,
  243. IN DWORD cbProps,
  244. IN CLUSTER_CONTROL_OBJECT ccobjtype = CLUS_OBJECT_RESOURCE
  245. );
  246. }; //*** class CClusPropList
  247. #pragma warning( default : 4201 )
  248. /////////////////////////////////////////////////////////////////////////////
  249. #endif // _PROPLIST_H_