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.

83 lines
2.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft WMIOLE DB Provider
  4. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // tranoptions.h
  7. // Class declaration for implementing CTranOptions & ITransactionOptions interface
  8. //
  9. //////////////////////////////////////////////////////////////////////////////////////////////////
  10. #ifndef _TRANOPTIONS_H_
  11. #define _TRANOPTIONS_H_
  12. #include "baseobj.h"
  13. class CImpITransactionOptions;
  14. typedef CImpITransactionOptions *PIMPITRANSACTIONOPTIONS;
  15. class CTranOptions : public CBaseObj
  16. {
  17. friend class CImpITransactionOptions;
  18. public:
  19. CTranOptions(IUnknown *pUnkOuter = NULL);
  20. ~CTranOptions();
  21. // IUnknown methods
  22. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  23. STDMETHODIMP_(ULONG) AddRef(void);
  24. STDMETHODIMP_(ULONG) Release(void);
  25. void SetOptions(XACTOPT *pOpt);
  26. XACTOPT * GetOptions();
  27. STDMETHODIMP FInit();
  28. private:
  29. XACTOPT m_xactOptions;
  30. PIMPITRANSACTIONOPTIONS m_pITransOptions;
  31. PIMPISUPPORTERRORINFO m_pISupportErrorInfo; // contained ISupportErrorInfo
  32. HRESULT AddInterfacesForISupportErrorInfo();
  33. };
  34. class CImpITransactionOptions : public ITransactionOptions
  35. {
  36. public:
  37. CImpITransactionOptions(CTranOptions * pObj)
  38. {
  39. m_pObj = pObj;
  40. DEBUGCODE(m_cRef = 0);
  41. }
  42. ~CImpITransactionOptions() {}
  43. STDMETHODIMP_(ULONG) AddRef(void)
  44. {
  45. DEBUGCODE(InterlockedIncrement((long*)&m_cRef));
  46. return m_pObj->GetOuterUnknown()->AddRef();
  47. }
  48. STDMETHODIMP_(ULONG) Release(void)
  49. {
  50. DEBUGCODE(long lRef = InterlockedDecrement((long*)&m_cRef);
  51. if( lRef < 0 ){
  52. ASSERT("Reference count on Object went below 0!")
  53. })
  54. return m_pObj->GetOuterUnknown()->Release();
  55. }
  56. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv)
  57. {
  58. return m_pObj->GetOuterUnknown()->QueryInterface(riid, ppv);
  59. }
  60. STDMETHODIMP SetOptions(XACTOPT * pOptions);
  61. STDMETHODIMP GetOptions(XACTOPT * pOptions);
  62. private:
  63. CTranOptions *m_pObj;
  64. DEBUGCODE(ULONG m_cRef);
  65. };
  66. #endif