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.

128 lines
3.8 KiB

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft WMI OLE DB Provider
  4. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // Enumeration Routines
  7. //
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. #ifndef _ENUMERATOR_
  10. #define _ENUMERATOR_
  11. #include "critsec.h"
  12. class CEnumeratorNameSpace;
  13. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. class CImpISourcesRowset : public ISourcesRowset
  15. {
  16. public:
  17. CImpISourcesRowset(CEnumeratorNameSpace *pCEnumeratorNameSpace)
  18. {
  19. m_pCEnumeratorNameSpace = pCEnumeratorNameSpace;
  20. m_cRef = 0;
  21. }
  22. ~CImpISourcesRowset()
  23. {
  24. }
  25. STDMETHODIMP_(ULONG) AddRef(void);
  26. STDMETHODIMP_(ULONG) Release(void);
  27. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv);
  28. STDMETHODIMP GetSourcesRowset( IUnknown *pUnkOuter, REFIID riid, ULONG cPropertySets, DBPROPSET rgPropertySets[], IUnknown **ppvSourcesRowset );
  29. private:
  30. CEnumeratorNameSpace *m_pCEnumeratorNameSpace;
  31. ULONG m_cRef;
  32. };
  33. typedef CImpISourcesRowset * PIMPISOURCESROWSET;
  34. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  35. //
  36. // Create a moniker with the name passed to it.
  37. //
  38. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  39. class CImpIParseDisplayName : public IParseDisplayName
  40. {
  41. public:
  42. CImpIParseDisplayName(CEnumeratorNameSpace *pCEnumeratorNameSpace)
  43. {
  44. m_pCEnumeratorNameSpace = pCEnumeratorNameSpace;
  45. m_cRef = 0;
  46. }
  47. ~CImpIParseDisplayName()
  48. {
  49. }
  50. STDMETHODIMP_(ULONG) AddRef(void);
  51. STDMETHODIMP_(ULONG) Release(void);
  52. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv);
  53. STDMETHODIMP ParseDisplayName
  54. (
  55. IBindCtx *pbc, //Pointer to bind context
  56. WCHAR *pszDisplayName, //Pointer to string containing display name
  57. ULONG *pchEaten, //Length, in characters, of display name
  58. IMoniker **ppmkOut //Pointer to moniker that results
  59. );
  60. private:
  61. CEnumeratorNameSpace *m_pCEnumeratorNameSpace;
  62. ULONG m_cRef;
  63. };
  64. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  65. //
  66. // Contains a few interfaces and enumerates namespaces
  67. //
  68. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  69. class CEnumeratorNameSpace : public CBaseObj
  70. {
  71. friend CImpISourcesRowset;
  72. friend CImpIParseDisplayName;
  73. friend CImpISupportErrorInfo;
  74. public: //
  75. CEnumeratorNameSpace(LPUNKNOWN);
  76. ~CEnumeratorNameSpace(void);
  77. STDMETHODIMP Initialize(void);
  78. inline CDataSource* GetDataSource() { return (CDataSource *)m_pCDataSource; }
  79. inline CDBSession* GetSession() { return (CDBSession*)m_pCDBSession; }
  80. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  81. STDMETHODIMP_(ULONG) AddRef(void);
  82. STDMETHODIMP_(ULONG) Release(void);
  83. protected:
  84. enum ENK{ ENK_DIDINIT = 0x0001, }; // Values for m_dwStatus.
  85. DWORD m_dwStatus;
  86. LPUNKNOWN m_pCDataSource;
  87. LPUNKNOWN m_pCDBSession;
  88. // Contained interfaces
  89. CImpISourcesRowset m_ISourcesRowset; // Contained ISourcesRowset
  90. CImpIParseDisplayName m_IParseDisplayName; // Contained IParseDisplayName
  91. CImpISupportErrorInfo* m_pISupportErrorInfo; // Contained ISupportErrorInfo
  92. HRESULT CreateDataSource();
  93. HRESULT AddInterfacesForISupportErrorInfo();
  94. }; //CEnumeratorNameSpace
  95. typedef CEnumeratorNameSpace * PCENUMERATOR;
  96. #endif