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.

113 lines
2.4 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996
  5. //
  6. // File: cdso.hxx
  7. //
  8. // Contents: Microsoft OleDB/OleDS Data Source Object for ADSI
  9. //
  10. //
  11. // History: 08-01-96 shanksh Created.
  12. //
  13. //----------------------------------------------------------------------------
  14. #ifndef _CDSO_HXX
  15. #define _CDSO_HXX
  16. class CDSOObject;
  17. class CDSOObject : INHERIT_TRACKING,
  18. public IDBInitialize,
  19. public IDBProperties,
  20. public IPersist,
  21. public IDBCreateSession
  22. {
  23. private:
  24. //
  25. // Controlling IUnknown
  26. //
  27. LPUNKNOWN _pUnkOuter;
  28. //
  29. // Utility object to manage properties
  30. //
  31. PCUTILPROP _pUtilProp;
  32. //
  33. // flag == TRUE if this Data Source object is in an initialized
  34. // state
  35. //
  36. BOOL _fDSOInitialized;
  37. //
  38. // No. of active sessions
  39. //
  40. DWORD _cSessionsOpen;
  41. //
  42. // Credentials from the Data Source Object
  43. //
  44. CCredentials _Credentials;
  45. //
  46. // Thread token for impersonation
  47. //
  48. HANDLE _ThreadToken;
  49. public:
  50. CDSOObject::CDSOObject(LPUNKNOWN pUnknown);
  51. CDSOObject::~CDSOObject();
  52. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  53. DECLARE_STD_REFCOUNTING
  54. static HRESULT
  55. CDSOObject::CreateDSOObject(
  56. IUnknown * pUnkOuter,
  57. REFIID riid,
  58. void **ppvObj
  59. );
  60. BOOL FInit(void);
  61. DECLARE_IDBInitialize_METHODS
  62. DECLARE_IDBProperties_METHODS
  63. DECLARE_IPersist_METHODS
  64. DECLARE_IDBCreateSession_METHODS
  65. inline void DecrementOpenSessions()
  66. {
  67. InterlockedDecrement( (LONG*) &_cSessionsOpen );
  68. }
  69. inline void IncrementOpenSessions()
  70. {
  71. InterlockedIncrement( (LONG*) &_cSessionsOpen );
  72. }
  73. inline BOOL IsSessionOpen()
  74. { return (_cSessionsOpen > 0) ? TRUE : FALSE;};
  75. inline HANDLE GetThreadToken()
  76. {
  77. return _ThreadToken;
  78. }
  79. inline BOOL IsIntegratedSecurity()
  80. {
  81. return _pUtilProp->IsIntegratedSecurity();
  82. }
  83. inline BOOL IsInitialized()
  84. {
  85. return _fDSOInitialized;
  86. }
  87. };
  88. typedef CDSOObject *PCDSOObject ;
  89. #endif