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.

770 lines
30 KiB

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft WMI OLE DB Provider
  4. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // Utility object versions for synthesized rowsets.
  7. //
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. #ifndef __SCHEMA_INCL__
  10. #define __SCHEMA_INCL__
  11. #include "headers.h"
  12. #define SOURCES_ROWSET 10
  13. #define PROVIDER_TYPES_ROWSET 20
  14. #define CATALOGS_ROWSET 30
  15. #define COLUMNS_ROWSET 40
  16. #define TABLES_ROWSET 60
  17. #define PRIMARY_KEYS_ROWSET 70
  18. #define TABLES_INFO_ROWSET 80
  19. #define PROCEDURES_ROWSET 90
  20. #define PROCEDURE_PARAMETERS_ROWSET 100
  21. /////////////////////////////////////////////////////////////////////////////////////////////
  22. // The Schema rowset definitions
  23. /////////////////////////////////////////////////////////////////////////////////////////////
  24. // FOR THE PROVIDER_TYPES ROWSET
  25. typedef struct _CIMTypeInfo
  26. {
  27. WCHAR * wcsTypeName;
  28. short DataType;
  29. unsigned long ColumnSize;
  30. // WCHAR * LiteralPrefix; Same values for all rows, so hardcoded in function
  31. // WCHAR * LiteralSuffix; Same values for all rows, so hardcoded in function
  32. // WCHAR * CreateParams; Same values for all rows, so hardcoded in function
  33. // CIM_BOOLEAN IsNullable; Same values for all rows, so hardcoded in function
  34. // CIM_BOOLEAN CaseSensitive; Same values for all rows, so hardcoded in function
  35. // CIM_UINT32 Searchable; Same values for all rows, so hardcoded in function
  36. BOOL UnsignedAttribute;
  37. // CIM_BOOLEAN FixedPrec; Same values for all rows, so hardcoded in function
  38. // CIM_BOOLEAN AutoUnique; Same values for all rows, so hardcoded in function
  39. // WCHAR * LocalTypeName; Same values for all rows, so hardcoded in function
  40. // CIM_SINT16 MinimumScale; Same values for all rows, so hardcoded in function
  41. // CIM_SINT16 MaximumScale; Same values for all rows, so hardcoded in function
  42. // DBTYPE_GUID Guid;
  43. // WCHAR * TypeLib; Same values for all rows, so hardcoded in function
  44. // WCHAR * Version; Same values for all rows, so hardcoded in function
  45. // CIM_BOOLEAN IsLong; Same values for all rows, so hardcoded in function
  46. // CIM_BOOLEAN BestMatch; Same values for all rows, so hardcoded in function
  47. // CIM_BOOLEAN IsFixedLength; Same values for all rows, so hardcoded in function
  48. }CIMTypeInfo;
  49. typedef struct _SchemaRowsetDefinition
  50. {
  51. LPWSTR wcsColumnName;
  52. CIMTYPE Type;
  53. } SchemaRowsetDefinition;
  54. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  55. // SCHEMA BASE CLASS
  56. //
  57. // This class is used by one of the many CSchema__xxx classes to retrieve schema information.
  58. //
  59. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  60. class CSchema : public CRowset
  61. {
  62. int m_nTableId;
  63. HRESULT GetTableName(WCHAR *pTableName);
  64. public:
  65. STDMETHODIMP FInit( ULONG cPropertySets, // IN Count of properties
  66. DBPROPSET rgProperties[], // IN Properties array
  67. REFIID riid, // IN riid for IRowset object
  68. IUnknown *pUnkOuter, // IN Outer unknown
  69. IUnknown **ppIRowset, // OUT Newly-created IRowset interface
  70. WCHAR * wcsSpecificTable
  71. );
  72. protected:
  73. //=========================================================================
  74. // These are functions a derived class needs to call (only on base).
  75. // Protected so only a derived class can use.
  76. //=========================================================================
  77. CSchema (LPUNKNOWN pUnkOuter, int nTableId,PCDBSESSION pObj );
  78. //=========================================================================
  79. // Sets the rowset property corresponding to the requested interface
  80. // if the requested interface is available on a read-only rowset.
  81. //=========================================================================
  82. HRESULT SetReadOnlyProperty( CUtilProp* pRowsetProps, REFIID riid);
  83. protected:
  84. virtual ~CSchema(); //Clients must use Release().
  85. };
  86. ////////////////////////////////////////////////////////////////////////////////////////////////
  87. //
  88. // Schema Command object for CATALOGS rowset.
  89. //
  90. ////////////////////////////////////////////////////////////////////////////////////////////////
  91. class CSchema_Catalogs: public CSchema
  92. {
  93. public:
  94. CSchema_Catalogs(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,CATALOGS_ROWSET,pObj) {};
  95. };
  96. ////////////////////////////////////////////////////////////////////////////////////////////////
  97. //
  98. // Schema Command object for PROVIDER_TYPES rowset.
  99. //
  100. ////////////////////////////////////////////////////////////////////////////////////////////////
  101. class CSchema_Provider_Types: public CSchema
  102. {
  103. public:
  104. CSchema_Provider_Types(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,PROVIDER_TYPES_ROWSET,pObj) {};
  105. };
  106. ////////////////////////////////////////////////////////////////////////////////////////////////
  107. //
  108. // Schema Command object for COLUMNS rowset.
  109. //
  110. ////////////////////////////////////////////////////////////////////////////////////////////////
  111. class CSchema_Columns: public CSchema
  112. {
  113. public:
  114. CSchema_Columns(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,COLUMNS_ROWSET,pObj) {};
  115. };
  116. ////////////////////////////////////////////////////////////////////////////////////////////////
  117. //
  118. // Schema Command object for TABLES rowset.
  119. //
  120. ////////////////////////////////////////////////////////////////////////////////////////////////
  121. class CSchema_Tables: public CSchema
  122. {
  123. public:
  124. CSchema_Tables(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,TABLES_ROWSET,pObj) {};
  125. };
  126. ////////////////////////////////////////////////////////////////////////////////////////////////
  127. //
  128. // Schema Command object for primary keys rowset.
  129. //
  130. ////////////////////////////////////////////////////////////////////////////////////////////////
  131. class CSchema_Primary_Keys: public CSchema
  132. {
  133. public:
  134. CSchema_Primary_Keys(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,PRIMARY_KEYS_ROWSET,pObj) {};
  135. };
  136. ////////////////////////////////////////////////////////////////////////////////////////////////
  137. //
  138. // Schema Command object for TABLES_INFO rowset.
  139. //
  140. ////////////////////////////////////////////////////////////////////////////////////////////////
  141. class CSchema_Tables_Info: public CSchema
  142. {
  143. public:
  144. CSchema_Tables_Info(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,TABLES_INFO_ROWSET,pObj) {};
  145. };
  146. ////////////////////////////////////////////////////////////////////////////////////////////////
  147. //
  148. // Schema Command object for Sources rowset.
  149. //
  150. ////////////////////////////////////////////////////////////////////////////////////////////////
  151. class CSchema_ISourcesRowset: public CSchema
  152. {
  153. public:
  154. CSchema_ISourcesRowset(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,SOURCES_ROWSET,pObj) {}
  155. };
  156. ////////////////////////////////////////////////////////////////////////////////////////////////
  157. //
  158. // Schema object for Procedures rowset.
  159. //
  160. ////////////////////////////////////////////////////////////////////////////////////////////////
  161. class CSchema_Procedures: public CSchema
  162. {
  163. public:
  164. CSchema_Procedures(LPUNKNOWN pUnkOuter,PCDBSESSION pObj ):CSchema(pUnkOuter,PROCEDURES_ROWSET,pObj) {};
  165. };
  166. ////////////////////////////////////////////////////////////////////////////////////////////////
  167. //
  168. // Schema object for PROCEDURES_PARAMETERS rowset.
  169. //
  170. ////////////////////////////////////////////////////////////////////////////////////////////////
  171. class CSchema_Procedure_Parameters: public CSchema
  172. {
  173. public:
  174. CSchema_Procedure_Parameters(LPUNKNOWN pUnkOuter,PCDBSESSION pObj )
  175. :CSchema(pUnkOuter,PROCEDURE_PARAMETERS_ROWSET,pObj) {};
  176. };
  177. ////////////////////////////////////////////////////////////////////////////////////////////////
  178. class CImpIDBSchemaRowset : public IDBSchemaRowset //@base public | IDBSchemaRowset
  179. {
  180. private:
  181. enum eRestrictionSupport{
  182. eSup_CATALOGS = 0x00, // Allow nothing
  183. eSup_COLUMNS = 0x07, // Allow the first 3 columns as a restriction
  184. eSup_PRIMARY_KEYS = 0x07, // Allow the first 3 columns as a restriction
  185. eSup_PROCEDURE_PARAMETERS = 0x03, // Allow the first 2 columns as a restriction
  186. eSup_PROCEDURES = 0x03, // Allow the first 2 columns as a restriction
  187. eSup_PROVIDER_TYPES = 0x00, // Allow nothing
  188. eSup_TABLES = 0x07, // Allow the first 3 columns as a restriction
  189. eSup_TABLES_INFO = 0x07, // Allow the first 3 columns as a restriction
  190. eSup_LINKEDSERVERS = 0x01, // 1 out of 1
  191. };
  192. public:
  193. CImpIDBSchemaRowset(PCDBSESSION pCDBSession){
  194. DEBUGCODE(m_cRef = 0L);
  195. m_pCDBSession = pCDBSession;
  196. }
  197. ~CImpIDBSchemaRowset() {assert(m_cRef == 0);}
  198. STDMETHODIMP_(ULONG) AddRef(void)
  199. {
  200. DEBUGCODE(InterlockedIncrement((long*)&m_cRef));
  201. return m_pCDBSession->GetOuterUnknown()->AddRef();
  202. }
  203. STDMETHODIMP_(ULONG) Release(void)
  204. {
  205. DEBUGCODE(long lRef = InterlockedDecrement((long*)&m_cRef);
  206. if( lRef < 0 ){
  207. ASSERT("Reference count on Object went below 0!")
  208. })
  209. return m_pCDBSession->GetOuterUnknown()->Release();
  210. }
  211. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv)
  212. {
  213. return m_pCDBSession->GetOuterUnknown()->QueryInterface(riid, ppv);
  214. }
  215. STDMETHODIMP GetRowset( IUnknown *pUnkOuter, REFGUID rguidSchema, ULONG cRestrictions, const VARIANT rgRestrictions[],
  216. REFIID riid, ULONG cProperties, DBPROPSET rgProperties[], IUnknown **ppRowset);
  217. STDMETHODIMP GetSchemas( ULONG *pcSchemas, GUID **ppSchemas, ULONG **prgRestrictionSupport );
  218. private:
  219. DEBUGCODE(ULONG m_cRef);
  220. PCDBSESSION m_pCDBSession;
  221. };
  222. typedef CImpIDBSchemaRowset *PIMPIDBSCHEMAROWSET;
  223. //////////////////////////////////////////////////////////////////////////////////////////////
  224. class CWbemSchemaClassInstanceWrapper : public CWbemClassInstanceWrapper
  225. {
  226. protected:
  227. ULONG m_uCurrentIndex;
  228. int m_nMaxColumns;
  229. public:
  230. CWbemSchemaClassInstanceWrapper(CWbemClassParameters * p);
  231. ~CWbemSchemaClassInstanceWrapper();
  232. void SetIndex(ULONG u) { m_uCurrentIndex = u;}
  233. void AddToKeyList(WCHAR *& pwcsKeyList, WCHAR * wcsKey );
  234. virtual HRESULT ResetInstanceFromKey(CBSTR Key) { return CWbemClassInstanceWrapper::ResetInstanceFromKey(Key); }
  235. virtual HRESULT GetKey(CBSTR & Key) { return CWbemClassInstanceWrapper::GetKey(Key);}
  236. virtual HRESULT RefreshInstance() { return CWbemClassInstanceWrapper::RefreshInstance(); }
  237. virtual WCHAR * GetClassName() { return CWbemClassInstanceWrapper::GetClassName(); }
  238. HRESULT GetClassProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  239. virtual HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor )=0;
  240. };
  241. //////////////////////////////////////////////////////////////////////////////////////////////
  242. // Works with just the schema classes
  243. //////////////////////////////////////////////////////////////////////////////////////////////
  244. class CWbemSchemaClassDefinitionWrapper : public CWbemClassDefinitionWrapper
  245. {
  246. protected:
  247. int m_nSchemaClassIndex;
  248. int m_nMaxColumns;
  249. public:
  250. CWbemSchemaClassDefinitionWrapper(CWbemClassParameters * p);
  251. ~CWbemSchemaClassDefinitionWrapper();
  252. HRESULT ValidClass();
  253. HRESULT TotalPropertiesInClass(ULONG & ulPropCount, ULONG &ulSysPropCount);
  254. HRESULT BeginPropertyEnumeration();
  255. HRESULT EndPropertyEnumeration();
  256. virtual HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue, CIMTYPE * pType ,LONG * plFlavor ) { return CWbemClassDefinitionWrapper::GetNextProperty(pProperty,vValue,pType,plFlavor);}
  257. HRESULT BeginPropertyQualifierEnumeration(BSTR strPropName);
  258. };
  259. ///////////////////////////////////////////////////////////////////////////////////////////////////
  260. class CWbemSchemaInstanceList: public CWbemInstanceList
  261. {
  262. protected:
  263. ULONG m_ulMaxRow;
  264. WCHAR * m_pwcsSpecificClass;
  265. IWbemClassObject * m_pSpecificClass;
  266. BOOL m_fGotThemAll;
  267. public:
  268. CWbemSchemaInstanceList(CWbemClassParameters * p);
  269. CWbemSchemaInstanceList(CWbemClassParameters * p,WCHAR * pSpecific);
  270. ~CWbemSchemaInstanceList();
  271. virtual HRESULT Reset()=0;
  272. virtual HRESULT NextInstance(CBSTR & Key, CWbemClassInstanceWrapper ** p) { return CWbemInstanceList::NextInstance(Key,p);}
  273. virtual HRESULT PrevInstance( CBSTR & Key, CWbemClassInstanceWrapper *& p){ if( !m_pwcsSpecificClass ){ return CWbemInstanceList::PrevInstance(Key,p);} return S_OK;}
  274. HRESULT ResetTheSpecificClass();
  275. HRESULT GetTheSpecificClass();
  276. };
  277. //////////////////////////////////////////////////////////////////////////////////////////////
  278. //********************************************************************************************
  279. //
  280. // Classes for the Sources schema rowset
  281. //
  282. //********************************************************************************************
  283. //////////////////////////////////////////////////////////////////////////////////////////////
  284. class CWbemSchemaSourcesClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  285. {
  286. private:
  287. public:
  288. CWbemSchemaSourcesClassDefinitionWrapper(CWbemClassParameters * p);
  289. ~CWbemSchemaSourcesClassDefinitionWrapper() {}
  290. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  291. };
  292. class CWbemSchemaSourcesInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  293. {
  294. private:
  295. public:
  296. CWbemSchemaSourcesInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  297. { }
  298. ~CWbemSchemaSourcesInstanceWrapper() {}
  299. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  300. };
  301. class CWbemSchemaSourcesInstanceList: public CWbemSchemaInstanceList
  302. {
  303. private:
  304. public:
  305. CWbemSchemaSourcesInstanceList(CWbemClassParameters * p) : CWbemSchemaInstanceList(p) {m_nBaseType = SOURCES_ROWSET;}
  306. ~CWbemSchemaSourcesInstanceList() {}
  307. HRESULT Reset();
  308. };
  309. //////////////////////////////////////////////////////////////////////////////////////////////
  310. //********************************************************************************************
  311. //
  312. // Classes for the Provider Types schema rowset
  313. //
  314. //********************************************************************************************
  315. //////////////////////////////////////////////////////////////////////////////////////////////
  316. class CWbemSchemaProviderTypesClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  317. {
  318. private:
  319. public:
  320. CWbemSchemaProviderTypesClassDefinitionWrapper(CWbemClassParameters * p);
  321. ~CWbemSchemaProviderTypesClassDefinitionWrapper() {}
  322. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  323. HRESULT ResetInstanceFromKey(CBSTR Key);
  324. };
  325. class CWbemSchemaProviderTypesInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  326. {
  327. private:
  328. public:
  329. CWbemSchemaProviderTypesInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  330. { }
  331. ~CWbemSchemaProviderTypesInstanceWrapper() {}
  332. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  333. HRESULT GetKey(CBSTR & Key);
  334. HRESULT ResetInstanceFromKey(CBSTR Key);
  335. HRESULT RefreshInstance();
  336. WCHAR * GetClassName();
  337. };
  338. class CWbemSchemaProviderTypesInstanceList: public CWbemSchemaInstanceList
  339. {
  340. private:
  341. public:
  342. CWbemSchemaProviderTypesInstanceList(CWbemClassParameters * p) : CWbemSchemaInstanceList(p) {m_nBaseType = PROVIDER_TYPES_ROWSET;}
  343. ~CWbemSchemaProviderTypesInstanceList(){}
  344. HRESULT Reset();
  345. HRESULT NextInstance(CBSTR & Key, CWbemClassInstanceWrapper ** p);
  346. };
  347. //////////////////////////////////////////////////////////////////////////////////////////////
  348. //********************************************************************************************
  349. //
  350. // Classes for the Catalogs schema rowset
  351. //
  352. //********************************************************************************************
  353. //////////////////////////////////////////////////////////////////////////////////////////////
  354. class CWbemSchemaCatalogsClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  355. {
  356. private:
  357. public:
  358. CWbemSchemaCatalogsClassDefinitionWrapper(CWbemClassParameters * p);
  359. ~CWbemSchemaCatalogsClassDefinitionWrapper() {}
  360. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  361. };
  362. class CWbemSchemaCatalogsInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  363. {
  364. private:
  365. public:
  366. CWbemSchemaCatalogsInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  367. { }
  368. ~CWbemSchemaCatalogsInstanceWrapper() {}
  369. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  370. };
  371. class CWbemSchemaCatalogsInstanceList: public CWbemSchemaInstanceList
  372. {
  373. private:
  374. public:
  375. CWbemSchemaCatalogsInstanceList(CWbemClassParameters * p) : CWbemSchemaInstanceList(p) { m_nBaseType = CATALOGS_ROWSET; }
  376. ~CWbemSchemaCatalogsInstanceList() {}
  377. HRESULT Reset();
  378. };
  379. //////////////////////////////////////////////////////////////////////////////////////////////
  380. //********************************************************************************************
  381. //
  382. // Classes for the COlumns schema rowset
  383. //
  384. //********************************************************************************************
  385. //////////////////////////////////////////////////////////////////////////////////////////////
  386. class CWbemSchemaColumnsClassDefinitionWrapper : public CWbemSchemaClassDefinitionWrapper
  387. {
  388. private:
  389. public:
  390. CWbemSchemaColumnsClassDefinitionWrapper(CWbemClassParameters * p);
  391. ~CWbemSchemaColumnsClassDefinitionWrapper() {}
  392. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  393. };
  394. class CWbemSchemaColumnsInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  395. {
  396. private:
  397. cRowColumnInfoMemMgr * m_pColumns;
  398. public:
  399. CWbemSchemaColumnsInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p) { m_pColumns=NULL;}
  400. ~CWbemSchemaColumnsInstanceWrapper() {}
  401. void SetColumnsPtr(cRowColumnInfoMemMgr * p) { m_pColumns = p; }
  402. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  403. HRESULT GetKey(CBSTR & Key);
  404. };
  405. class CWbemSchemaColumnsInstanceList: public CWbemSchemaInstanceList
  406. {
  407. private:
  408. LONG m_lColumnIndex;
  409. cRowColumnInfoMemMgr m_Columns;
  410. HRESULT GetColumnInformation(CWbemClassInstanceWrapper * p);
  411. void FreeColumns() { m_Columns.FreeColumnNameList(); m_Columns.FreeColumnInfoList();}
  412. public:
  413. CWbemSchemaColumnsInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaInstanceList(p, pSpecific)
  414. { m_lColumnIndex = -1; m_nBaseType = COLUMNS_ROWSET;}
  415. ~CWbemSchemaColumnsInstanceList() {FreeColumns();}
  416. DBCOUNTITEM GetTotalColumns() { return m_Columns.GetTotalNumberOfColumns(); }
  417. HRESULT Reset();
  418. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  419. };
  420. //////////////////////////////////////////////////////////////////////////////////////////////
  421. //********************************************************************************************
  422. //
  423. // Classes for the Tables schema rowset
  424. //
  425. //********************************************************************************************
  426. //////////////////////////////////////////////////////////////////////////////////////////////
  427. class CWbemSchemaTablesClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  428. {
  429. private:
  430. public:
  431. CWbemSchemaTablesClassDefinitionWrapper(CWbemClassParameters * p);
  432. ~CWbemSchemaTablesClassDefinitionWrapper() {}
  433. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  434. };
  435. class CWbemSchemaTablesInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  436. {
  437. private:
  438. public:
  439. CWbemSchemaTablesInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  440. { }
  441. ~CWbemSchemaTablesInstanceWrapper() {}
  442. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  443. };
  444. class CWbemSchemaTablesInstanceList: public CWbemSchemaInstanceList
  445. {
  446. private:
  447. public:
  448. CWbemSchemaTablesInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaInstanceList(p, pSpecific)
  449. {m_nBaseType = TABLES_ROWSET;}
  450. ~CWbemSchemaTablesInstanceList() {}
  451. HRESULT Reset();
  452. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  453. };
  454. //////////////////////////////////////////////////////////////////////////////////////////////
  455. //********************************************************************************************
  456. //
  457. // Classes for the Primary Keys schema rowset
  458. //
  459. //********************************************************************************************
  460. //////////////////////////////////////////////////////////////////////////////////////////////
  461. class CWbemSchemaPrimaryKeysClassDefinitionWrapper : public CWbemSchemaClassDefinitionWrapper
  462. {
  463. private:
  464. public:
  465. CWbemSchemaPrimaryKeysClassDefinitionWrapper(CWbemClassParameters * p);
  466. ~CWbemSchemaPrimaryKeysClassDefinitionWrapper() {}
  467. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  468. };
  469. class CWbemSchemaPrimaryKeysInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  470. {
  471. private:
  472. public:
  473. CWbemSchemaPrimaryKeysInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  474. { }
  475. ~CWbemSchemaPrimaryKeysInstanceWrapper() {}
  476. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  477. };
  478. class CWbemSchemaPrimaryKeysInstanceList: public CWbemSchemaInstanceList
  479. {
  480. private:
  481. public:
  482. CWbemSchemaPrimaryKeysInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaInstanceList(p, pSpecific) { m_nBaseType = PRIMARY_KEYS_ROWSET;}
  483. ~CWbemSchemaPrimaryKeysInstanceList() {}
  484. HRESULT Reset();
  485. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  486. };
  487. //////////////////////////////////////////////////////////////////////////////////////////////
  488. //********************************************************************************************
  489. //
  490. // Classes for the Tables Info schema rowset
  491. //
  492. //********************************************************************************************
  493. //////////////////////////////////////////////////////////////////////////////////////////////
  494. class CWbemSchemaTablesInfoClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  495. {
  496. private:
  497. public:
  498. CWbemSchemaTablesInfoClassDefinitionWrapper(CWbemClassParameters * p);
  499. ~CWbemSchemaTablesInfoClassDefinitionWrapper() {}
  500. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  501. };
  502. class CWbemSchemaTablesInfoInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  503. {
  504. private:
  505. public:
  506. CWbemSchemaTablesInfoInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p) {}
  507. ~CWbemSchemaTablesInfoInstanceWrapper() {}
  508. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  509. };
  510. class CWbemSchemaTablesInfoInstanceList: public CWbemSchemaInstanceList
  511. {
  512. private:
  513. public:
  514. CWbemSchemaTablesInfoInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaInstanceList(p,pSpecific)
  515. {m_nBaseType = TABLES_INFO_ROWSET;}
  516. ~CWbemSchemaTablesInfoInstanceList() {}
  517. HRESULT Reset();
  518. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  519. };
  520. //////////////////////////////////////////////////////////////////////////////////////////////
  521. //********************************************************************************************
  522. //
  523. // Classes for the Procedures schema rowset
  524. //
  525. //********************************************************************************************
  526. //////////////////////////////////////////////////////////////////////////////////////////////
  527. class CWbemSchemaProceduresClassDefinitionWrapper: public CWbemSchemaClassDefinitionWrapper
  528. {
  529. private:
  530. public:
  531. CWbemSchemaProceduresClassDefinitionWrapper(CWbemClassParameters * p);
  532. ~CWbemSchemaProceduresClassDefinitionWrapper() {}
  533. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  534. };
  535. class CWbemSchemaProceduresInstanceWrapper: public CWbemSchemaClassInstanceWrapper
  536. {
  537. protected:
  538. CBSTR m_bstrCurrentMethodName;
  539. IWbemClassObject * m_pInClass;
  540. IWbemClassObject * m_pOutClass;
  541. public:
  542. CWbemSchemaProceduresInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaClassInstanceWrapper(p)
  543. {
  544. m_pInClass = NULL;
  545. m_pOutClass = NULL;
  546. }
  547. ~CWbemSchemaProceduresInstanceWrapper()
  548. {
  549. m_bstrCurrentMethodName.Clear();
  550. SAFE_RELEASE_PTR(m_pInClass);
  551. SAFE_RELEASE_PTR(m_pOutClass);
  552. }
  553. HRESULT GetKey(CBSTR & Key);
  554. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  555. void SetMethodName(WCHAR * Method) { m_bstrCurrentMethodName.Clear(); m_bstrCurrentMethodName.SetStr(Method);}
  556. void SetInputClass(IWbemClassObject * p) { SAFE_RELEASE_PTR(m_pInClass); m_pInClass = p; if( p ) m_pInClass->AddRef(); }
  557. void SetOutputClass(IWbemClassObject * p) { SAFE_RELEASE_PTR(m_pOutClass); m_pOutClass = p; if( p ) m_pOutClass->AddRef(); }
  558. };
  559. class CWbemSchemaProceduresInstanceList: public CWbemSchemaInstanceList
  560. {
  561. protected:
  562. CBSTR m_bstrCurrentMethodName;
  563. IWbemClassObject * m_pCurrentMethodClass;
  564. IWbemClassObject * m_pCurrentMethodInClass;
  565. IWbemClassObject * m_pCurrentMethodOutClass;
  566. BOOL m_fContinueWithSameClass;
  567. HRESULT GetSpecificNextInstance();
  568. public:
  569. CWbemSchemaProceduresInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaInstanceList(p, pSpecific)
  570. {
  571. m_nBaseType = PROCEDURES_ROWSET;
  572. m_fContinueWithSameClass = FALSE;
  573. m_pCurrentMethodClass = NULL;
  574. m_pCurrentMethodInClass = NULL;
  575. m_pCurrentMethodOutClass = NULL;
  576. }
  577. ~CWbemSchemaProceduresInstanceList()
  578. {
  579. SAFE_RELEASE_PTR(m_pCurrentMethodClass);
  580. SAFE_RELEASE_PTR(m_pCurrentMethodInClass);
  581. SAFE_RELEASE_PTR(m_pCurrentMethodOutClass);
  582. ResetMethodPtrs();
  583. }
  584. HRESULT GetTheNextClassThatHasMethods();
  585. HRESULT Reset();
  586. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  587. void ResetMethodPtrs();
  588. };
  589. //////////////////////////////////////////////////////////////////////////////////////////////
  590. //********************************************************************************************
  591. //
  592. // Classes for the Procedure Parameters schema rowset
  593. //
  594. //********************************************************************************************
  595. //////////////////////////////////////////////////////////////////////////////////////////////
  596. class CWbemSchemaProceduresParametersClassDefinitionWrapper : public CWbemSchemaClassDefinitionWrapper
  597. {
  598. private:
  599. public:
  600. CWbemSchemaProceduresParametersClassDefinitionWrapper(CWbemClassParameters * p);
  601. ~CWbemSchemaProceduresParametersClassDefinitionWrapper() {}
  602. HRESULT GetNextProperty(BSTR * pProperty, VARIANT * vValue,CIMTYPE * pType , LONG * plFlavor );
  603. };
  604. class CWbemSchemaProceduresParametersInstanceWrapper: public CWbemSchemaProceduresInstanceWrapper
  605. {
  606. protected:
  607. CVARIANT m_vProperty;
  608. short m_nOrdinal;
  609. CBSTR m_bstrPropertyName;
  610. public:
  611. CWbemSchemaProceduresParametersInstanceWrapper(CWbemClassParameters * p) : CWbemSchemaProceduresInstanceWrapper(p)
  612. {
  613. m_nOrdinal = 0;
  614. }
  615. ~CWbemSchemaProceduresParametersInstanceWrapper()
  616. {
  617. m_bstrPropertyName.Clear();
  618. }
  619. HRESULT GetSchemaProperty(WCHAR * wcsProperty, VARIANT * v, CIMTYPE * pType , LONG * plFlavor );
  620. HRESULT GetPropertyQualifier(WCHAR * wcsQualifier,VARIANT * v);
  621. void SetPropertyName(WCHAR * Name) { m_bstrPropertyName.Clear(); m_bstrPropertyName.SetStr(Name);}
  622. void SetProperty(CVARIANT v) { m_vProperty = v;}
  623. void SetOrdinal(short n) { m_nOrdinal = n; }
  624. HRESULT GetKey(CBSTR & Key);
  625. };
  626. class CWbemSchemaProceduresParametersInstanceList : public CWbemSchemaProceduresInstanceList
  627. {
  628. private:
  629. BOOL m_fStillWorkingOnTheSameClass;
  630. short m_nOrdinal;
  631. CBSTR m_bstrPropertyName;
  632. CVARIANT m_vProperty;
  633. public:
  634. CWbemSchemaProceduresParametersInstanceList(CWbemClassParameters * p,WCHAR * pSpecific) : CWbemSchemaProceduresInstanceList(p, pSpecific)
  635. {
  636. m_nBaseType = PROCEDURE_PARAMETERS_ROWSET;
  637. m_fStillWorkingOnTheSameClass = FALSE;
  638. m_nOrdinal = 0;
  639. }
  640. ~CWbemSchemaProceduresParametersInstanceList()
  641. {
  642. m_bstrPropertyName.Clear();
  643. }
  644. HRESULT NextInstance( CBSTR & Key, CWbemClassInstanceWrapper ** pInst );
  645. HRESULT GetTheNextParameter();
  646. HRESULT GetTheNextClassThatHasParameters();
  647. };
  648. #endif // __SCHEMA_INCL__