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.

166 lines
4.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: datasrc.hxx
  7. //
  8. // Contents: exposes the required DSO interfaces
  9. //
  10. // History: 3-30-97 MohamedN Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <impiunk.hxx>
  15. #include "proputl.hxx" // CMDSProps
  16. #include <parsver.hxx> // CImpIParserVerify
  17. //
  18. // externals
  19. //
  20. extern "C" const GUID CLSID_CiFwDSO;
  21. //+---------------------------------------------------------------------------
  22. //
  23. // Class: CDataSrc
  24. //
  25. // Purpose: exposes the required DSO interfaces.
  26. //
  27. // History: 03-27-97 mohamedn created
  28. // 09-05-97 danleg added IDBInfo & ISupportErrorInfo
  29. //
  30. //----------------------------------------------------------------------------
  31. class CDataSrc : public IDBInitialize,
  32. public IDBProperties,
  33. public IDBCreateSession,
  34. public IPersist,
  35. public IDBInfo
  36. {
  37. public:
  38. CDataSrc( IUnknown * pUnkOuter,
  39. IUnknown ** ppUnkInner);
  40. ~CDataSrc();
  41. //
  42. // IUnknown methods.
  43. //
  44. STDMETHOD(QueryInterface) ( THIS_ REFIID riid, LPVOID *ppiuk )
  45. {
  46. // Delegate to outer unk if aggregated
  47. return _pUnkOuter->QueryInterface( riid, ppiuk );
  48. }
  49. STDMETHOD(RealQueryInterface) ( THIS_ REFIID riid, LPVOID *ppiuk );
  50. STDMETHOD_(ULONG, AddRef) (THIS) { return _pUnkOuter->AddRef(); }
  51. STDMETHOD_(ULONG, Release) (THIS) { return _pUnkOuter->Release(); }
  52. //
  53. // IDBInitialize methods
  54. //
  55. STDMETHOD (Initialize) ( THIS_ );
  56. STDMETHOD (Uninitialize) ( THIS_ );
  57. //
  58. // IDBProperties methods
  59. //
  60. STDMETHOD (GetProperties) ( THIS_
  61. ULONG cPropertySets,
  62. const DBPROPIDSET rgPropertySets[],
  63. ULONG* pcProperties,
  64. DBPROPSET** prgProperties);
  65. STDMETHOD (SetProperties) ( THIS_
  66. ULONG cProperties,
  67. DBPROPSET rgProperties[]);
  68. STDMETHOD (GetPropertyInfo) ( THIS_
  69. ULONG cPropertyIDSets,
  70. const DBPROPIDSET rgPropertyIDSets[],
  71. ULONG * pcPropertyInfoSets,
  72. DBPROPINFOSET ** prgPropertyInfoSets,
  73. OLECHAR ** ppDescBuffer);
  74. //
  75. // IDBCreateSession methods.
  76. //
  77. STDMETHOD (CreateSession) ( THIS_
  78. IUnknown * pUnkOuter,
  79. REFIID riid,
  80. IUnknown ** ppDBSession );
  81. //
  82. // IPersist methods
  83. //
  84. STDMETHODIMP GetClassID ( CLSID *pClassID );
  85. //
  86. // IDBInfo methods
  87. //
  88. STDMETHOD (GetKeywords) ( THIS_
  89. LPOLESTR * ppwszKeywords );
  90. STDMETHOD (GetLiteralInfo) ( THIS_
  91. ULONG cLiterals,
  92. const DBLITERAL rgLiterals[],
  93. ULONG * pcLiteralInfo,
  94. DBLITERALINFO ** prgLiteralInfo,
  95. OLECHAR ** ppCharBuffer );
  96. //
  97. // non-interface methods
  98. //
  99. void IncSessionCount() { InterlockedIncrement( &_cSessionCount ); }
  100. void DecSessionCount() { InterlockedDecrement( &_cSessionCount ); }
  101. void CreateGlobalViews( IParserSession * pIPSession );
  102. //
  103. // Access methods
  104. //
  105. CMDSProps* GetDSPropsPtr() { return &_UtlProps; }
  106. IUnknown * GetOuterUnk() { return _pUnkOuter; }
  107. static void DupImpersonationToken( HANDLE & hToken );
  108. private:
  109. LONG _cSessionCount;
  110. BOOL _fDSOInitialized;
  111. BOOL _fGlobalViewsCreated;
  112. LPUNKNOWN _pUnkOuter;
  113. CImpIUnknown<CDataSrc> _impIUnknown;
  114. CMutexSem _mtxDSO;
  115. //
  116. // SQL Text Parser
  117. //
  118. XInterface<IParser> _xIParser;
  119. XInterface<CImpIParserVerify> _xIPVerify;
  120. //
  121. // Property handlers
  122. //
  123. CMDSPropInfo _UtlPropInfo;
  124. CMDSProps _UtlProps;
  125. //
  126. // ISupportErrorInfo
  127. //
  128. CCIOleDBError _ErrorInfo;
  129. };