Leaked source code of windows server 2003
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.

132 lines
3.3 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. BOOL _fCriticalSectionInitialized;
  67. IMalloc * _pMalloc;
  68. CRowProvider * _pRowProvider;
  69. };
  70. class CAutoBlock {
  71. friend class CRowsetInfo;
  72. friend class CImpIAccessor;
  73. friend class CRowset;
  74. private:
  75. CAutoBlock(CRITICAL_SECTION *pCrit);
  76. ~CAutoBlock();
  77. void UnBlock();
  78. CRITICAL_SECTION *_pCrit;
  79. };
  80. inline CAutoBlock::CAutoBlock(
  81. CRITICAL_SECTION *pCrit ) //@parm IN | The critical section.
  82. {
  83. // It is OK to pass a NULL ptr to this routine. It is a NOOP.
  84. // Note that passing NULL to EnterCriticalSection blows up.
  85. if( pCrit )
  86. ::EnterCriticalSection( pCrit );
  87. _pCrit = pCrit;
  88. };
  89. inline CAutoBlock::~CAutoBlock()
  90. {
  91. if( _pCrit )
  92. ::LeaveCriticalSection( _pCrit );
  93. }
  94. //-----------------------------------------------------------------------------
  95. // @mfunc
  96. // Ends blocking explicitly. Thereafter, the destructor does nothing.
  97. //-----------------------------------------------------------------------------------
  98. inline void CAutoBlock::UnBlock()
  99. {
  100. // Clear the critical-section member,
  101. // so that the destructor doesn't do anything.
  102. if( _pCrit )
  103. ::LeaveCriticalSection( _pCrit );
  104. _pCrit = NULL;
  105. }
  106. #endif //_CRSSINFO_H