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.

369 lines
11 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // Common.h
  7. //
  8. // Description:
  9. // Definition of common type, constant and header files.
  10. //
  11. // Author:
  12. // Henry Wang (HenryWa) 24-AUG-1999
  13. //
  14. // Notes:
  15. //
  16. //////////////////////////////////////////////////////////////////////////////
  17. #pragma once
  18. #pragma warning( disable : 4786 )
  19. //////////////////////////////////////////////////////////////////////////////
  20. // Include Files
  21. //////////////////////////////////////////////////////////////////////////////
  22. using namespace std;
  23. class CProvBase;
  24. class CObjPath;
  25. class CWbemClassObject;
  26. extern long g_cObj;
  27. extern long g_cLock;
  28. typedef LPVOID * PPVOID;
  29. typedef CProvBase * ( * FPNEW )(
  30. IN LPCWSTR pwszName,
  31. IN CWbemServices * pNamespace,
  32. DWORD dwEnumType
  33. );
  34. typedef void ( * FPFILLWMI )(
  35. IN PVOID phCluster,
  36. IN PVOID phClusterObj,
  37. IN LPCWSTR pwszName,
  38. IN IWbemClassObject * pClass,
  39. IN IWbemServices * pServices,
  40. IN IWbemObjectSink * pHandler
  41. );
  42. LPWSTR PwszSpaceReplace(
  43. LPWSTR pwszTrgInout,
  44. LPCWSTR pwszSrcIn,
  45. WCHAR wchArgIn
  46. );
  47. enum PROP_TYPE
  48. {
  49. DWORD_TYPE,
  50. SZ_TYPE,
  51. MULTI_SZ_TYPE
  52. };
  53. enum ACCESS_TYPE
  54. {
  55. READONLY,
  56. READWRITE
  57. };
  58. //////////////////////////////////////////////////////////////////////////////
  59. //++
  60. //
  61. // typedef struct SPropMapEntry
  62. //
  63. // Description:
  64. // structure to map property name defined in mof
  65. // to the property name defined in wolfpack header.
  66. // PropertyType indicate the type of wolfpack properties.
  67. // Mof property is always in VARIANT format and it's type
  68. // is in vt field
  69. //
  70. //--
  71. //////////////////////////////////////////////////////////////////////////////
  72. struct SPropMapEntry
  73. {
  74. LPCWSTR mofName;
  75. LPCWSTR clstName;
  76. PROP_TYPE PropertyType;
  77. ACCESS_TYPE Access;
  78. };
  79. //////////////////////////////////////////////////////////////////////////////
  80. //++
  81. //
  82. // struct SPropMapEntryArray
  83. //
  84. // Description:
  85. // Array of SPropMapEntry
  86. //
  87. //--
  88. //////////////////////////////////////////////////////////////////////////////
  89. struct SPropMapEntryArray
  90. {
  91. SPropMapEntryArray(
  92. DWORD dwSizeIn,
  93. SPropMapEntry * pArrayIn
  94. )
  95. : m_dwSize( dwSizeIn )
  96. , m_pArray( pArrayIn )
  97. {
  98. }
  99. LPCWSTR PwszLookup( LPCWSTR pwszIn ) const;
  100. DWORD m_dwSize;
  101. SPropMapEntry * m_pArray;
  102. };
  103. struct SGetSetControl
  104. {
  105. DWORD dwGetControl;
  106. DWORD dwSetControl;
  107. BOOL fPrivate;
  108. };
  109. struct SGetControl
  110. {
  111. DWORD dwControl;
  112. BOOL fPrivate;
  113. };
  114. void CreateClass(
  115. const WCHAR * pwszClassNameIn,
  116. CWbemServices * pNamespaceIn,
  117. auto_ptr<CProvBase>& rNewClassInout
  118. );
  119. // CLUSTER
  120. extern const WCHAR * const PVD_CLASS_CLUSTER;
  121. extern const WCHAR * const PVD_CLASS_CLUSTERTONETWORKS;
  122. extern const WCHAR * const PVD_CLASS_CLUSTERTONETINTERFACE;
  123. extern const WCHAR * const PVD_CLASS_CLUSTERTONODE;
  124. extern const WCHAR * const PVD_CLASS_CLUSTERTOQUORUMRES;
  125. extern const WCHAR * const PVD_CLASS_CLUSTERTORES;
  126. extern const WCHAR * const PVD_CLASS_CLUSTERTORESTYPE;
  127. extern const WCHAR * const PVD_CLASS_CLUSTERTOGROUP;
  128. extern const WCHAR * const PVD_PROP_CLUSTER_SECURITY;
  129. extern const WCHAR * const PVD_PROP_CLUSTER_SECURITYDESCRIPTOR;
  130. extern const WCHAR * const PVD_PROP_CLUSTER_NAME;
  131. extern const WCHAR * const PVD_PROP_CLUSTER_GROUPADMIN;
  132. extern const WCHAR * const PVD_PROP_CLUSTER_NODEADMIN;
  133. extern const WCHAR * const PVD_PROP_CLUSTER_RESADMIN;
  134. extern const WCHAR * const PVD_PROP_CLUSTER_RESTYPEADMIN;
  135. extern const WCHAR * const PVD_PROP_CLUSTER_NETWORKADMIN;
  136. extern const WCHAR * const PVD_PROP_CLUSTER_NETINTFACEADMIN;
  137. extern const WCHAR * const PVD_PROP_CLUSTER_FILE;
  138. extern const WCHAR * const PVD_PROP_CLUSTER_LOGSIZE;
  139. extern const WCHAR * const PVD_PROP_CLUSTER_NETWORK;
  140. extern const WCHAR * const CLUS_CLUS_GROUPADMIN;
  141. extern const WCHAR * const CLUS_CLUS_NETWORKADMIN;
  142. extern const WCHAR * const CLUS_CLUS_NETINTERFACEADMIN;
  143. extern const WCHAR * const CLUS_CLUS_NODEADMIN;
  144. extern const WCHAR * const CLUS_CLUS_RESADMIN;
  145. extern const WCHAR * const CLUS_CLUS_RESTYPEADMIN;
  146. extern const WCHAR * const PVD_MTH_CLUSTER_RENAME;
  147. extern const WCHAR * const PVD_MTH_CLUSTER_SETQUORUM;
  148. extern const WCHAR * const PVD_MTH_CLUSTER_PARM_NEWNAME;
  149. extern const WCHAR * const PVD_MTH_CLUSTER_PARM_RESOURCE;
  150. // NODE
  151. extern const WCHAR * const PVD_CLASS_NODE;
  152. extern const WCHAR * const PVD_CLASS_NODEACTIVEGROUP;
  153. extern const WCHAR * const PVD_CLASS_NODETONETINTERFACE;
  154. extern const WCHAR * const PVD_CLASS_NODEACTIVERES;
  155. extern const WCHAR * const PVD_PROP_NODE_NAME;
  156. // RESOURCE
  157. extern const WCHAR * const PVD_CLASS_RESOURCE;
  158. extern const WCHAR * const PVD_CLASS_RESDEPRES;
  159. extern const WCHAR * const PVD_CLASS_RESRESOURCETYPE;
  160. extern const WCHAR * const PVD_PROP_RES_NAME;
  161. extern const WCHAR * const PVD_PROP_RES_STATE;
  162. extern const WCHAR * const PVD_PROP_RES_PRIVATE;
  163. extern const WCHAR * const PVD_PROP_RES_CHECKPOINTS;
  164. extern const WCHAR * const PVD_PROP_RES_CRYPTO_CHECKPOINTS;
  165. extern const WCHAR * const PVD_PROP_RES_CORE_RESOURCE;
  166. extern const WCHAR * const PVD_MTH_RES_ONLINE;
  167. extern const WCHAR * const PVD_MTH_RES_OFFLINE;
  168. extern const WCHAR * const PVD_MTH_RES_ADD_DEPENDENCY;
  169. extern const WCHAR * const PVD_MTH_RES_CHANGE_GROUP;
  170. extern const WCHAR * const PVD_MTH_RES_CREATE_RESOURCE;
  171. extern const WCHAR * const PVD_MTH_RES_FAIL_RESOURCE;
  172. extern const WCHAR * const PVD_MTH_RES_REMOVE_DEPENDENCY;
  173. extern const WCHAR * const PVD_MTH_RES_RENAME;
  174. extern const WCHAR * const PVD_MTH_RES_DELETE;
  175. extern const WCHAR * const PVD_MTH_RES_ADD_REG_CHECKPOINT;
  176. extern const WCHAR * const PVD_MTH_RES_DEL_REG_CHECKPOINT;
  177. extern const WCHAR * const PVD_MTH_RES_ADD_CRYPTO_CHECKPOINT;
  178. extern const WCHAR * const PVD_MTH_RES_DEL_CRYPTO_CHECKPOINT;
  179. extern const WCHAR * const PVD_MTH_PARM_RESOURCE;
  180. extern const WCHAR * const PVD_MTH_PARM_GROUP;
  181. extern const WCHAR * const PVD_MTH_PARM_NEWNAME;
  182. extern const WCHAR * const PVD_MTH_PARM_RES_NAME;
  183. extern const WCHAR * const PVD_MTH_PARM_RES_TYPE;
  184. extern const WCHAR * const PVD_MTH_PARM_SEP_MONITOR;
  185. extern const WCHAR * const PVD_MTH_PARM_RES_CHECKPOINT_NAME;
  186. // RESOURCETYPE
  187. extern const WCHAR * const PVD_CLASS_RESOURCETYPE;
  188. extern const WCHAR * const PVD_PROP_RESTYPE_NAME;
  189. extern const WCHAR * const PVD_PROP_RESTYPE_DLLNAME;
  190. extern const WCHAR * const PVD_PROP_RESTYPE_ADMINEXTENSIONS;
  191. extern const WCHAR * const PVD_PROP_RESTYPE_ISALIVE;
  192. extern const WCHAR * const PVD_PROP_RESTYPE_LOOKSALIVE;
  193. extern const WCHAR * const PVD_PROP_RESTYPE_DESCRIPTION;
  194. extern const WCHAR * const PVD_PROP_RESTYPE_QUORUM_CAPABLE;
  195. extern const WCHAR * const PVD_PROP_RESTYPE_LOCALQUORUM_CAPABLE;
  196. extern const WCHAR * const PVD_PROP_RESTYPE_DELETE_REQUIRES_ALL_NODES;
  197. // GROUP
  198. extern const WCHAR * const PVD_CLASS_GROUP;
  199. extern const WCHAR * const PVD_CLASS_GROUPTORES;
  200. extern const WCHAR * const PVD_PROP_GROUP_NAME;
  201. extern const WCHAR* const PVD_PROP_NODELIST;
  202. extern const WCHAR * const PVD_MTH_GROUP_CREATEGROUP;
  203. extern const WCHAR * const PVD_MTH_GROUP_TAKEOFFLINE;
  204. extern const WCHAR * const PVD_MTH_GROUP_BRINGONLINE;
  205. extern const WCHAR * const PVD_MTH_GROUP_MOVETONEWNODE;
  206. extern const WCHAR * const PVD_MTH_GROUP_DELETE;
  207. extern const WCHAR * const PVD_MTH_GROUP_RENAME;
  208. extern const WCHAR * const PVD_MTH_GROUP_PARM_GROUPNAME;
  209. extern const WCHAR * const PVD_MTH_GROUP_PARM_NODENAME;
  210. extern const WCHAR * const PVD_MTH_GROUP_PARM_NEWNAME;
  211. // NetworkInterface
  212. extern const WCHAR * const PVD_CLASS_NETWORKSINTERFACE;
  213. extern const WCHAR * const PVD_PROP_NETINTERFACE_DEVICEID;
  214. extern const WCHAR * const PVD_PROP_NETINTERFACE_SYSTEMNAME;
  215. extern const WCHAR * const PVD_PROP_NETINTERFACE_STATE;
  216. // NetworkName
  217. extern const WCHAR * const PVD_CLASS_NETWORKNAME;
  218. // networks
  219. extern const WCHAR * const PVD_CLASS_NETWORKS;
  220. extern const WCHAR * const PVD_CLASS_NETTONETINTERFACE;
  221. extern const WCHAR * const PVD_PROP_NETWORK_STATE;
  222. extern const WCHAR * const PVD_MTH_NETWORK_RENAME;
  223. extern const WCHAR * const PVD_MTH_NETWORK_PARM_NEWNAME;
  224. // service
  225. extern const WCHAR * const PVD_CLASS_SERVICES;
  226. extern const WCHAR * const PVD_CLASS_HOSTEDSERVICES;
  227. extern const WCHAR * const PVD_PROP_SERVICE_NAME;
  228. extern const WCHAR * const PVD_PROP_SERVICE_SYSTEMNAME;
  229. extern const WCHAR * const PVD_MTH_SERVICE_PAUSE;
  230. extern const WCHAR * const PVD_MTH_SERVICE_RESUME;
  231. // event
  232. extern const WCHAR * const PVD_CLASS_EVENT;
  233. extern const WCHAR * const PVD_PROP_EVENT_NAME;
  234. extern const WCHAR * const PVD_PROP_EVENT_PATH;
  235. extern const WCHAR * const PVD_PROP_EVENT_TYPE;
  236. extern const WCHAR * const PVD_PROP_EVENT_TYPEMAJOR;
  237. extern const WCHAR * const PVD_PROP_EVENT_TYPEMINOR;
  238. extern const WCHAR * const PVD_PROP_EVENT_NEWSTATE;
  239. extern const WCHAR * const PVD_PROP_EVENT_NODE;
  240. extern const WCHAR * const PVD_PROP_EVENT_GROUP;
  241. extern const WCHAR * const PVD_CLASS_EVENT_ADD;
  242. extern const WCHAR * const PVD_CLASS_EVENT_REMOVE;
  243. extern const WCHAR * const PVD_CLASS_EVENT_STATECHANGE;
  244. extern const WCHAR * const PVD_CLASS_EVENT_GROUPSTATECHANGE;
  245. extern const WCHAR * const PVD_CLASS_EVENT_RESOURCESTATECHANGE;
  246. extern const WCHAR * const PVD_CLASS_EVENT_PROP;
  247. extern const WCHAR * const PVD_CLASS_PROPERTY;
  248. extern const WCHAR * const PVD_PROP_NAME;
  249. extern const WCHAR * const PVD_PROP_STATE;
  250. extern const WCHAR * const PVD_PROP_GROUPCOMPONENT;
  251. extern const WCHAR * const PVD_PROP_PARTCOMPONENT;
  252. extern const WCHAR * const PVD_PROP_CHARACTERISTIC;
  253. extern const WCHAR * const PVD_PROP_FLAGS;
  254. extern const WCHAR * const PVD_WBEM_EXTENDEDSTATUS;
  255. extern const WCHAR * const PVD_WBEM_DESCRIPTION;
  256. extern const WCHAR * const PVD_WBEM_STATUSCODE;
  257. extern const WCHAR * const PVD_WBEM_STATUS;
  258. extern const WCHAR * const PVD_WBEM_CLASS;
  259. extern const WCHAR * const PVD_WBEM_RELPATH;
  260. extern const WCHAR * const PVD_WBEM_PROP_ANTECEDENT;
  261. extern const WCHAR * const PVD_WBEM_PROP_DEPENDENT;
  262. extern const WCHAR * const PVD_WBEM_PROP_DEVICEID;
  263. extern const WCHAR * const PVD_WBEM_QUA_DYNAMIC;
  264. extern const WCHAR * const PVD_WBEM_QUA_CIMTYPE;
  265. extern const WCHAR * const PVD_WBEM_QUA_PROV_VALUE;
  266. extern const WCHAR * const PVD_WBEM_QUA_PROV_NAME;
  267. class CClassData
  268. {
  269. public:
  270. const WCHAR * wszClassName;
  271. FPNEW pfConstruct;
  272. const char * szType;
  273. }; // *** class CClassData
  274. class CClassCreator
  275. {
  276. public:
  277. CClassCreator( void )
  278. : m_pfnConstructor( NULL )
  279. , m_pbstrClassName( L"" )
  280. { };
  281. CClassCreator(
  282. FPNEW pfnIn,
  283. const WCHAR * pwszClassNameIn,
  284. DWORD dwEnumTypeIn
  285. )
  286. : m_pfnConstructor( pfnIn )
  287. , m_pbstrClassName( pwszClassNameIn )
  288. , m_dwEnumType( dwEnumTypeIn )
  289. { };
  290. FPNEW m_pfnConstructor;
  291. _bstr_t m_pbstrClassName;
  292. DWORD m_dwEnumType;
  293. }; //*** class CClassCreator
  294. template< class _Ty >
  295. struct strLessThan : binary_function< _Ty, _Ty, bool >
  296. {
  297. bool operator()( const _Ty& _X, const _Ty& _Y ) const
  298. {
  299. return ( _wcsicmp( _X, _Y ) < 0 );
  300. }
  301. }; //*** struct strLessThan
  302. typedef map< _bstr_t, CClassCreator, strLessThan< _bstr_t > > ClassMap;
  303. typedef map< _bstr_t, _bstr_t, strLessThan< _bstr_t > > TypeNameToClass;
  304. extern TypeNameToClass g_TypeNameToClass;
  305. extern ClassMap g_ClassMap;