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.

138 lines
4.1 KiB

  1. //
  2. // Common stuff between RPC16.CXX and CPKT.CXX
  3. //
  4. typedef unsigned long RPCOLEDATAREP16;
  5. #define RPCFLG_ASYNCHRONOUS 0x40000000
  6. #define RPCFLG_INPUT_SYNCHRONOUS 0x20000000
  7. typedef struct tagRPCOLEMESSAGE16
  8. {
  9. LPVOID reserved1;
  10. RPCOLEDATAREP16 dataRepresentation;
  11. LPVOID Buffer;
  12. ULONG cbBuffer;
  13. ULONG iMethod;
  14. LPVOID reserved2[5];
  15. ULONG rpcFlags;
  16. } RPCOLEMESSAGE16, FAR *LPRPCOLEMESSAGE16;
  17. typedef struct tagOTHERPKTDATA
  18. {
  19. IID iid;
  20. ULONG cbSize;
  21. } OTHERPKTDATA, FAR *LPOTHERPKTDATA;
  22. interface IRpcChannelBuffer : public IUnknown
  23. {
  24. public:
  25. virtual HRESULT STDMETHODCALLTYPE GetBuffer
  26. (
  27. RPCOLEMESSAGE16 *pMessage,
  28. REFIID riid
  29. ) = 0;
  30. virtual HRESULT STDMETHODCALLTYPE SendReceive
  31. (
  32. RPCOLEMESSAGE16 *pMessage,
  33. ULONG *pStatus
  34. ) = 0;
  35. virtual HRESULT STDMETHODCALLTYPE FreeBuffer
  36. (
  37. RPCOLEMESSAGE16 *pMessage
  38. ) = 0;
  39. virtual HRESULT STDMETHODCALLTYPE GetDestCtx
  40. (
  41. DWORD *pdwDestContext,
  42. void **ppvDestContext
  43. ) = 0;
  44. virtual HRESULT STDMETHODCALLTYPE IsConnected
  45. (
  46. void
  47. ) = 0;
  48. };
  49. //
  50. // 16-bit IRpcChannelBuffer interface, buffer-based
  51. //
  52. // This is the interface that will be seen by the 32-bit proxy implementations
  53. //
  54. class CRpcChannelBuffer : public IRpcChannelBuffer
  55. {
  56. public:
  57. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid,void **ppvObject);
  58. ULONG STDMETHODCALLTYPE AddRef(void);
  59. ULONG STDMETHODCALLTYPE Release(void);
  60. HRESULT STDMETHODCALLTYPE GetBuffer(RPCOLEMESSAGE16 *pMessage,REFIID riid);
  61. HRESULT STDMETHODCALLTYPE SendReceive(RPCOLEMESSAGE16 *pMessage,ULONG *pStatus);
  62. HRESULT STDMETHODCALLTYPE FreeBuffer(RPCOLEMESSAGE16 *pMessage);
  63. HRESULT STDMETHODCALLTYPE GetDestCtx(DWORD *pdwDestContext,void **ppvDestContext);
  64. HRESULT STDMETHODCALLTYPE IsConnected( void);
  65. private:
  66. };
  67. #define IID_CPkt IID_NULL
  68. class FAR CPkt : public IStream // Passed between client, server
  69. {
  70. public:
  71. STDMETHOD(QueryInterface) (REFIID iidInterface, void FAR* FAR* ppvObj);
  72. STDMETHOD_(ULONG,AddRef) (void);
  73. STDMETHOD_(ULONG,Release) (void);
  74. STDMETHOD(Read) (VOID HUGEP* pv, ULONG cb, ULONG FAR* pcbRead);
  75. STDMETHOD(Write) (VOID const HUGEP* pv, ULONG cb, ULONG FAR* pcbWritten);
  76. STDMETHOD(Seek) (LARGE_INTEGER dlibMove, DWORD dwOrigin,
  77. ULARGE_INTEGER FAR* plibNewPosition);
  78. STDMETHOD(SetSize) (ULARGE_INTEGER cb);
  79. STDMETHOD(CopyTo) (IStream FAR* pstm, ULARGE_INTEGER cb,
  80. ULARGE_INTEGER FAR* pcbRead,
  81. ULARGE_INTEGER FAR* pcbWritten);
  82. STDMETHOD(Commit) (DWORD grfCommitFlags);
  83. STDMETHOD(Revert) (void);
  84. STDMETHOD(LockRegion) (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,
  85. DWORD dwLockType);
  86. STDMETHOD(UnlockRegion) (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,
  87. DWORD dwLockType);
  88. STDMETHOD(Stat) (STATSTG FAR* pstatstg, DWORD statflag);
  89. STDMETHOD(Clone)(IStream FAR * FAR *ppstm);
  90. STDMETHOD(SetRpcChannelBuffer) ( CRpcChannelBuffer FAR *pRpcCB );
  91. STDMETHOD(CallRpcChannelBuffer) ( void );
  92. static CPkt FAR* CreateForCall(IUnknown FAR *pUnk, REFIID iid,
  93. int iMethod, BOOL fSend, BOOL fAsync,
  94. DWORD size);
  95. ~CPkt() {}
  96. ctor_dtor:
  97. CPkt()
  98. {
  99. m_refs = 1;
  100. m_pos = 0;
  101. m_prcb = NULL;
  102. memset( &m_rom16, 0, sizeof(m_rom16)); // Zero out RPCOLEMESSAGE16
  103. memset( &m_opd, 0, sizeof(m_opd)); // Zero out OTHERPKTDATA
  104. }
  105. private:
  106. ULONG m_refs; // Number of references to this CPkt
  107. ULONG m_pos; // Seek pointer for Read/Write
  108. CRpcChannelBuffer FAR * m_prcb; // IRpcChannelBuffer to call
  109. RPCOLEMESSAGE16 m_rom16; // For IRpcChannelBuffer transportability
  110. OTHERPKTDATA m_opd; // Saving of other info
  111. // uninitialized CPkt
  112. static CPkt FAR* Create(IUnknown FAR *pUnk, DWORD cbExt);
  113. };