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.

117 lines
3.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: bindctx.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 9-16-96 JohannP (Johann Posch) Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef BINDCTX_HXX
  18. #define BINDCTX_HXX
  19. // These two structures are used to pass data from the inloader callbacks
  20. // to the wndproc of the hidden window in the main thread.
  21. class CTransaction;
  22. class CTransData;
  23. class CBindCtx;
  24. class CBindCtx : public IBindCtx, public IMarshal
  25. {
  26. private:
  27. CBindCtx(IBindCtx * pbcRem);
  28. public:
  29. static HRESULT Create(CBindCtx **ppCBCtx, IBindCtx *pbc = NULL);
  30. ~CBindCtx();
  31. // *** IUnknown methods ***
  32. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  33. STDMETHODIMP_(ULONG) AddRef(void);
  34. STDMETHODIMP_(ULONG) Release(void);
  35. // *** IBindCtx methods ***
  36. STDMETHODIMP RegisterObjectBound(IUnknown *punk)
  37. { return _pbcLocal->RegisterObjectBound(punk); }
  38. STDMETHODIMP RevokeObjectBound(IUnknown *punk)
  39. { return _pbcLocal->RevokeObjectBound(punk); }
  40. STDMETHODIMP ReleaseBoundObjects(void)
  41. { return _pbcLocal->ReleaseBoundObjects(); }
  42. STDMETHODIMP SetBindOptions(BIND_OPTS *pbindopts)
  43. { return _pbcLocal->SetBindOptions(pbindopts); }
  44. STDMETHODIMP GetBindOptions(BIND_OPTS *pbindopts)
  45. { return _pbcLocal->GetBindOptions(pbindopts); }
  46. STDMETHODIMP GetRunningObjectTable(IRunningObjectTable **pprot)
  47. { return _pbcLocal->GetRunningObjectTable(pprot); }
  48. STDMETHODIMP RegisterObjectParam(LPOLESTR pszKey, IUnknown *punk)
  49. { return _pbcLocal->RegisterObjectParam(pszKey, punk); }
  50. STDMETHODIMP GetObjectParam(LPOLESTR pszKey, IUnknown **ppunk);
  51. STDMETHODIMP EnumObjectParam(IEnumString **ppenum);
  52. STDMETHODIMP RevokeObjectParam(LPOLESTR pszKey);
  53. // *** IMarshal methods ***
  54. STDMETHODIMP GetUnmarshalClass(REFIID riid, void *pvInterface, DWORD dwDestContext,
  55. void *pvDestContext, DWORD mshlflags, CLSID *pCid);
  56. STDMETHODIMP GetMarshalSizeMax(REFIID riid, void *pvInterface, DWORD dwDestContext,
  57. void *pvDestContext, DWORD mshlflags, DWORD *pSize);
  58. STDMETHODIMP MarshalInterface(IStream *pStm, REFIID riid, void *pvInteface, DWORD dwDestContext,
  59. void *pvDestContext, DWORD mshlflags);
  60. STDMETHODIMP UnmarshalInterface(IStream *pStm, REFIID riid, void **ppv);
  61. STDMETHODIMP ReleaseMarshalData(IStream *pStm);
  62. STDMETHODIMP DisconnectObject(DWORD dwReserved);
  63. // private method
  64. STDMETHODIMP SetTransactionObject(CTransaction *pCTrans);
  65. STDMETHODIMP GetTransactionObject(CTransaction **ppCTrans);
  66. STDMETHODIMP SetTransactionObjects(CTransaction *pCTrans, CTransData *pCTransData);
  67. STDMETHODIMP GetTransactionObjects(CTransaction **ppCTrans,CTransData **ppCTransData);
  68. STDMETHODIMP SetTransData(CTransData *pCTransData);
  69. STDMETHODIMP GetTransData(CTransData **ppCTransData);
  70. IBindCtx *GetRemBindCtx()
  71. {
  72. return _pbcRem;
  73. }
  74. IBindCtx *GetLocalBindCtx()
  75. {
  76. return _pbcLocal;
  77. }
  78. private:
  79. inline BOOL CanMarshalIID(REFIID riid);
  80. HRESULT ValidateMarshalParams(REFIID riid, void *pvInterface, DWORD dwDestContext,
  81. void *pvDestContext,DWORD mshlflags);
  82. CRefCount _CRefs; // refcount class
  83. IBindCtx * _pbcRem; // the remote bind context
  84. IBindCtx * _pbcLocal; // the local bind context
  85. CTransaction *_pCTrans;
  86. CTransData *_pCTransData;
  87. DWORD _dwThreadId;
  88. };
  89. #endif // BINDCTX_HXX