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.

296 lines
8.5 KiB

  1. // avifps.h - AVIStream proxy / stub header
  2. #include <ole2.h>
  3. #ifdef CHICAGO
  4. #include "coguid.h"
  5. #endif
  6. #include <cobjps.h>
  7. #ifndef WIN32
  8. #include "olepriv.h"
  9. #endif
  10. enum {
  11. IAVISTREAM_Create = 0,
  12. IAVISTREAM_Info,
  13. IAVISTREAM_FindSample,
  14. IAVISTREAM_ReadFormat,
  15. IAVISTREAM_SetFormat,
  16. IAVISTREAM_Read,
  17. IAVISTREAM_Write,
  18. IAVISTREAM_Delete,
  19. IAVISTREAM_ReadData,
  20. IAVISTREAM_WriteData,
  21. IAVISTREAM_Reserved1,
  22. IAVISTREAM_Reserved2,
  23. IAVISTREAM_Reserved3,
  24. IAVISTREAM_Reserved4,
  25. IAVISTREAM_Reserved5,
  26. IAVISTREAM_SetInfo
  27. };
  28. // interface proxy for IAVIStream; always aggregated
  29. class FAR CPrxAVIStream : public IAVIStream
  30. {
  31. public:
  32. static IRpcProxyBuffer FAR* Create(IUnknown FAR* pUnkOuter);
  33. // IUnknown methods (for external interface(s))
  34. STDMETHOD(QueryInterface) ( REFIID iid, LPVOID FAR* ppvObj);
  35. STDMETHOD_(ULONG,AddRef) (void);
  36. STDMETHOD_(ULONG,Release) (void);
  37. // IAVIStream methods
  38. STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2);
  39. STDMETHOD(Info) (THIS_ AVISTREAMINFO FAR * psi, LONG lSize);
  40. STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags);
  41. STDMETHOD(ReadFormat) (THIS_ LONG lPos,
  42. LPVOID lpFormat, LONG FAR *lpcbFormat);
  43. STDMETHOD(SetFormat) (THIS_ LONG lPos,
  44. LPVOID lpFormat, LONG cbFormat);
  45. STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples,
  46. LPVOID lpBuffer, LONG cbBuffer,
  47. LONG FAR * plBytes, LONG FAR * plSamples);
  48. STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples,
  49. LPVOID lpBuffer, LONG cbBuffer,
  50. DWORD dwFlags,
  51. LONG FAR *plSampWritten,
  52. LONG FAR *plBytesWritten);
  53. STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples);
  54. STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb);
  55. STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb);
  56. #ifdef WIN32
  57. STDMETHODIMP SetInfo(AVISTREAMINFO FAR *lpInfo, LONG cbInfo);
  58. #else
  59. STDMETHOD(Reserved1) (THIS);
  60. STDMETHOD(Reserved2) (THIS);
  61. STDMETHOD(Reserved3) (THIS);
  62. STDMETHOD(Reserved4) (THIS);
  63. STDMETHOD(Reserved5) (THIS);
  64. #endif
  65. private:
  66. CPrxAVIStream(IUnknown FAR* pUnkOuter);
  67. ~CPrxAVIStream();
  68. // IRpcProxyBuffer which is also the controlling unknown
  69. struct CProxyImpl : IRpcProxyBuffer
  70. {
  71. public:
  72. CProxyImpl(CPrxAVIStream FAR* pPrxAVIStream)
  73. { m_pPrxAVIStream = pPrxAVIStream; }
  74. STDMETHOD(QueryInterface)(REFIID iid, LPVOID FAR* ppv);
  75. STDMETHOD_(ULONG,AddRef)(void);
  76. STDMETHOD_(ULONG,Release)(void);
  77. STDMETHOD(Connect)(IRpcChannelBuffer FAR* pRpcChannelBuffer);
  78. STDMETHOD_(void, Disconnect)(void);
  79. private:
  80. CPrxAVIStream FAR* m_pPrxAVIStream;
  81. };
  82. friend CProxyImpl;
  83. CProxyImpl m_Proxy;
  84. // private state:
  85. ULONG m_refs;
  86. IUnknown FAR* m_pUnkOuter;
  87. IRpcChannelBuffer FAR* m_pRpcChannelBuffer;
  88. AVISTREAMINFO m_sh;
  89. };
  90. // interface stub for IAVIStream
  91. class FAR CStubAVIStream : public IRpcStubBuffer
  92. {
  93. public:
  94. static HRESULT Create(IUnknown FAR* pUnkObject, IRpcStubBuffer FAR* FAR* ppStub);
  95. STDMETHOD(QueryInterface) (REFIID iid, LPVOID FAR* ppv);
  96. STDMETHOD_(ULONG,AddRef) (void);
  97. STDMETHOD_(ULONG,Release) (void);
  98. STDMETHOD(Connect)(IUnknown FAR* pUnkObject);
  99. STDMETHOD_(void, Disconnect)(void);
  100. STDMETHOD(Invoke)(RPCOLEMESSAGE FAR *pMessage, IRpcChannelBuffer FAR *pChannel);
  101. STDMETHOD_(IRpcStubBuffer FAR *, IsIIDSupported)(REFIID iid);
  102. STDMETHOD_(ULONG, CountRefs)(void);
  103. STDMETHOD(DebugServerQueryInterface)(LPVOID FAR *ppv);
  104. STDMETHOD_(void, DebugServerRelease)(LPVOID pv);
  105. private:
  106. CStubAVIStream(void);
  107. ~CStubAVIStream(void);
  108. ULONG m_refs;
  109. IAVIStream FAR* m_pAVIStream;
  110. };
  111. // Proxy/Stub Factory for pssamp.dll: supports IPSFactory only.
  112. class FAR CPSFactory : public IPSFactoryBuffer
  113. {
  114. public:
  115. CPSFactory();
  116. STDMETHOD(QueryInterface)(REFIID iid, LPVOID FAR* ppv);
  117. STDMETHOD_(ULONG,AddRef)(void);
  118. STDMETHOD_(ULONG,Release)(void);
  119. STDMETHOD(CreateProxy)(IUnknown FAR* pUnkOuter, REFIID iid,
  120. IRpcProxyBuffer FAR* FAR* ppProxy, LPVOID FAR* ppv);
  121. STDMETHOD(CreateStub)(REFIID iid, IUnknown FAR* pUnkServer,
  122. IRpcStubBuffer FAR* FAR* ppStub);
  123. private:
  124. ULONG m_refs;
  125. };
  126. DEFINE_AVIGUID(CLSID_AVIStreamPS, 0x0002000D, 0, 0);
  127. enum {
  128. IAVIFILE_Open = 0,
  129. IAVIFILE_Info,
  130. IAVIFILE_GetStream,
  131. IAVIFILE_CreateStream,
  132. IAVIFILE_Save,
  133. IAVIFILE_ReadData,
  134. IAVIFILE_WriteData,
  135. IAVIFILE_EndRecord,
  136. IAVIFILE_Reserved1,
  137. IAVIFILE_Reserved2,
  138. IAVIFILE_Reserved3,
  139. IAVIFILE_Reserved4,
  140. IAVIFILE_Reserved5
  141. };
  142. // interface proxy for IAVIFile; always aggregated
  143. class FAR CPrxAVIFile : public IAVIFile
  144. {
  145. public:
  146. static IRpcProxyBuffer FAR* Create(IUnknown FAR* pUnkOuter);
  147. // IUnknown methods (for external interface(s))
  148. STDMETHOD(QueryInterface) ( REFIID iid, LPVOID FAR* ppvObj);
  149. STDMETHOD_(ULONG,AddRef) (void);
  150. STDMETHOD_(ULONG,Release) (void);
  151. // IAVIFile methods
  152. #ifndef WIN32
  153. STDMETHOD(Open) (THIS_
  154. LPCTSTR szFile,
  155. UINT mode);
  156. #endif
  157. STDMETHOD(Info) (THIS_
  158. AVIFILEINFO FAR * pfi,
  159. LONG lSize);
  160. STDMETHOD(GetStream) (THIS_
  161. PAVISTREAM FAR * ppStream,
  162. DWORD fccType,
  163. LONG lParam);
  164. STDMETHOD(CreateStream) (THIS_
  165. PAVISTREAM FAR * ppStream,
  166. AVISTREAMINFO FAR * psi);
  167. #ifndef WIN32
  168. STDMETHOD(Save) (THIS_
  169. LPCTSTR szFile,
  170. AVICOMPRESSOPTIONS FAR *lpOptions,
  171. AVISAVECALLBACK lpfnCallback);
  172. #endif
  173. STDMETHOD(WriteData) (THIS_
  174. DWORD ckid,
  175. LPVOID lpData,
  176. LONG cbData);
  177. STDMETHOD(ReadData) (THIS_
  178. DWORD ckid,
  179. LPVOID lpData,
  180. LONG FAR *lpcbData);
  181. STDMETHOD(EndRecord) (THIS);
  182. #ifdef WIN32
  183. STDMETHODIMP DeleteStream (THIS_
  184. DWORD fccType,
  185. LONG lParam);
  186. #else
  187. STDMETHODIMP Reserved1 (THIS);
  188. STDMETHODIMP Reserved2 (THIS);
  189. STDMETHODIMP Reserved3 (THIS);
  190. STDMETHODIMP Reserved4 (THIS);
  191. STDMETHODIMP Reserved5 (THIS);
  192. #endif
  193. private:
  194. CPrxAVIFile(IUnknown FAR* pUnkOuter);
  195. ~CPrxAVIFile();
  196. // IRpcProxyBuffer which is also the controlling unknown
  197. struct CProxyImpl : IRpcProxyBuffer
  198. {
  199. public:
  200. CProxyImpl(CPrxAVIFile FAR* pPrxAVIFile)
  201. { m_pPrxAVIFile = pPrxAVIFile; }
  202. STDMETHOD(QueryInterface)(REFIID iid, LPVOID FAR* ppv);
  203. STDMETHOD_(ULONG,AddRef)(void);
  204. STDMETHOD_(ULONG,Release)(void);
  205. STDMETHOD(Connect)(IRpcChannelBuffer FAR* pRpcChannelBuffer);
  206. STDMETHOD_(void, Disconnect)(void);
  207. private:
  208. CPrxAVIFile FAR* m_pPrxAVIFile;
  209. };
  210. friend CProxyImpl;
  211. CProxyImpl m_Proxy;
  212. // private state:
  213. ULONG m_refs;
  214. IUnknown FAR* m_pUnkOuter;
  215. IRpcChannelBuffer FAR* m_pRpcChannelBuffer;
  216. AVIFILEINFO m_fi;
  217. };
  218. // interface stub for IAVIFile
  219. class FAR CStubAVIFile : public IRpcStubBuffer
  220. {
  221. public:
  222. static HRESULT Create(IUnknown FAR* pUnkObject, IRpcStubBuffer FAR* FAR* ppStub);
  223. STDMETHOD(QueryInterface) (REFIID iid, LPVOID FAR* ppv);
  224. STDMETHOD_(ULONG,AddRef) (void);
  225. STDMETHOD_(ULONG,Release) (void);
  226. STDMETHOD(Connect)(IUnknown FAR* pUnkObject);
  227. STDMETHOD_(void, Disconnect)(void);
  228. STDMETHOD(Invoke)(RPCOLEMESSAGE FAR *pMessage, IRpcChannelBuffer FAR *pChannel);
  229. STDMETHOD_(IRpcStubBuffer FAR *, IsIIDSupported)(REFIID iid);
  230. STDMETHOD_(ULONG, CountRefs)(void);
  231. STDMETHOD(DebugServerQueryInterface)(LPVOID FAR *ppv);
  232. STDMETHOD_(void, DebugServerRelease)(LPVOID pv);
  233. private:
  234. CStubAVIFile(void);
  235. ~CStubAVIFile(void);
  236. ULONG m_refs;
  237. IAVIFile FAR* m_pAVIFile;
  238. };
  239.