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.

131 lines
3.2 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: CRSembed.hxx
  7. //
  8. // Contents: IRowsetInfo and IGetRow methods
  9. //
  10. // Functions:
  11. //
  12. // Notes:
  13. //
  14. //
  15. // History: 08/30/96 | RenatoB | Created
  16. //----------------------------------------------------------------------------
  17. #ifndef _CRSINFO_H_
  18. #define _CRSINFO_H_
  19. //-----------------------------------------------------------------------------
  20. // @class CRowsetInfo | ADSI embedding of Rowset,
  21. // to give our IrowsetInfo interface
  22. //
  23. //
  24. //-----------------------------------------------------------------------------
  25. class CRowProvider;
  26. class CRowsetInfo;
  27. class CCommandObject;
  28. class CSessionObject;
  29. class CRowsetInfo : INHERIT_TRACKING,
  30. public IRowsetInfo
  31. {
  32. public:
  33. DECLARE_STD_REFCOUNTING
  34. DECLARE_IRowsetInfo_METHODS
  35. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  36. STDMETHOD(GetRowFromHROW)(
  37. IUnknown *pUnkOuter,
  38. HROW hRow, REFIID riid,
  39. IUnknown * *ppUnk,
  40. BOOL fIsTearOff,
  41. BOOL fAllAttrs
  42. );
  43. STDMETHOD(GetURLFromHROW)(HROW hRow,LPOLESTR *ppwszURL);
  44. CRowsetInfo(
  45. IUnknown * pUnkOuter,
  46. IUnknown * pParentObject,
  47. CSessionObject * pCSession,
  48. CCommandObject * pCCommand,
  49. CRowProvider * pRowProvider
  50. );
  51. ~CRowsetInfo();
  52. STDMETHODIMP FInit(
  53. IUnknown * pRowset //@parm IN| rowset interface
  54. );
  55. private:
  56. //Helper function to get credentials from INIT properties.
  57. STDMETHODIMP GetCredentials(
  58. IGetDataSource *pSession,
  59. CCredentials &refCreds);
  60. IUnknown * _pUnkOuter;
  61. IUnknown * _pRowset;
  62. IUnknown * _pParentObject;
  63. CSessionObject * _pCSession;
  64. CCommandObject * _pCCommand;
  65. CRITICAL_SECTION _csRowsetInfo;
  66. IMalloc * _pMalloc;
  67. CRowProvider * _pRowProvider;
  68. };
  69. class CAutoBlock {
  70. friend class CRowsetInfo;
  71. friend class CImpIAccessor;
  72. friend class CRowset;
  73. private:
  74. CAutoBlock(CRITICAL_SECTION *pCrit);
  75. ~CAutoBlock();
  76. void UnBlock();
  77. CRITICAL_SECTION *_pCrit;
  78. };
  79. inline CAutoBlock::CAutoBlock(
  80. CRITICAL_SECTION *pCrit ) //@parm IN | The critical section.
  81. {
  82. // It is OK to pass a NULL ptr to this routine. It is a NOOP.
  83. // Note that passing NULL to EnterCriticalSection blows up.
  84. if( pCrit )
  85. ::EnterCriticalSection( pCrit );
  86. _pCrit = pCrit;
  87. };
  88. inline CAutoBlock::~CAutoBlock()
  89. {
  90. if( _pCrit )
  91. ::LeaveCriticalSection( _pCrit );
  92. }
  93. //-----------------------------------------------------------------------------
  94. // @mfunc
  95. // Ends blocking explicitly. Thereafter, the destructor does nothing.
  96. //-----------------------------------------------------------------------------------
  97. inline void CAutoBlock::UnBlock()
  98. {
  99. // Clear the critical-section member,
  100. // so that the destructor doesn't do anything.
  101. if( _pCrit )
  102. ::LeaveCriticalSection( _pCrit );
  103. _pCrit = NULL;
  104. }
  105. #endif //_CRSSINFO_H