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.

239 lines
7.6 KiB

  1. // Protocol.h -- Declaration for CProtocol object
  2. #ifndef __PROTOCOL_H__
  3. #define __PROTOCOL_H__
  4. class CIOITnetProtocol : public CITUnknown
  5. {
  6. public:
  7. // Destructor:
  8. ~CIOITnetProtocol();
  9. // Creation:
  10. static HRESULT Create(IUnknown *punkOuter, REFIID riid, PPVOID ppv);
  11. private:
  12. // Constructor:
  13. CIOITnetProtocol(IUnknown *pUnkOuter);
  14. class CImpIOITnetProtocol : public IOITnetProtocol, public IOITnetProtocolInfo
  15. {
  16. public:
  17. // Constructor and Destructor:
  18. CImpIOITnetProtocol(CIOITnetProtocol *pBackObj, IUnknown *punkOuter);
  19. ~CImpIOITnetProtocol(void);
  20. // Initialing routine:
  21. HRESULT Init();
  22. // IOITnetProtocolRoot interfaces:
  23. HRESULT STDMETHODCALLTYPE Start(
  24. /* [in] */ LPCWSTR szUrl,
  25. /* [in] */ IOInetProtocolSink __RPC_FAR *pOIProtSink,
  26. /* [in] */ IOInetBindInfo __RPC_FAR *pOIBindInfo,
  27. /* [in] */ DWORD grfSTI,
  28. /* [in] */ DWORD dwReserved);
  29. HRESULT STDMETHODCALLTYPE Continue(
  30. /* [in] */ PROTOCOLDATA __RPC_FAR *pProtocolData);
  31. HRESULT STDMETHODCALLTYPE Abort(
  32. /* [in] */ HRESULT hrReason,
  33. /* [in] */ DWORD dwOptions);
  34. HRESULT STDMETHODCALLTYPE Terminate(
  35. /* [in] */ DWORD dwOptions);
  36. HRESULT STDMETHODCALLTYPE Suspend( void);
  37. HRESULT STDMETHODCALLTYPE Resume( void);
  38. // IOITnetProtocol interfaces:
  39. HRESULT STDMETHODCALLTYPE Read(
  40. /* [length_is][size_is][out] */ void __RPC_FAR *pv,
  41. /* [in] */ ULONG cb,
  42. /* [out] */ ULONG __RPC_FAR *pcbRead);
  43. HRESULT STDMETHODCALLTYPE Seek(
  44. /* [in] */ LARGE_INTEGER dlibMove,
  45. /* [in] */ DWORD dwOrigin,
  46. /* [out] */ ULARGE_INTEGER __RPC_FAR *plibNewPosition);
  47. HRESULT STDMETHODCALLTYPE LockRequest(
  48. /* [in] */ DWORD dwOptions);
  49. HRESULT STDMETHODCALLTYPE UnlockRequest( void);
  50. // IOITnetProtocolInfo interfaces:
  51. HRESULT STDMETHODCALLTYPE ParseUrl(
  52. /* [in] */ LPCWSTR pwzUrl,
  53. /* [in] */ PARSEACTION ParseAction,
  54. /* [in] */ DWORD dwParseFlags,
  55. /* [out] */ LPWSTR pwzResult,
  56. /* [in] */ DWORD cchResult,
  57. /* [out] */ DWORD __RPC_FAR *pcchResult,
  58. /* [in] */ DWORD dwReserved);
  59. HRESULT STDMETHODCALLTYPE CombineUrl(
  60. /* [in] */ LPCWSTR pwzBaseUrl,
  61. /* [in] */ LPCWSTR pwzRelativeUrl,
  62. /* [in] */ DWORD dwCombineFlags,
  63. /* [out] */ LPWSTR pwzResult,
  64. /* [in] */ DWORD cchResult,
  65. /* [out] */ DWORD __RPC_FAR *pcchResult,
  66. /* [in] */ DWORD dwReserved);
  67. HRESULT STDMETHODCALLTYPE CompareUrl(
  68. /* [in] */ LPCWSTR pwzUrl1,
  69. /* [in] */ LPCWSTR pwzUrl2,
  70. /* [in] */ DWORD dwCompareFlags);
  71. HRESULT STDMETHODCALLTYPE QueryInfo(
  72. /* [in] */ LPCWSTR pwzUrl,
  73. /* [in] */ QUERYOPTION OueryOption,
  74. /* [in] */ DWORD dwQueryFlags,
  75. /* [size_is][out][in] */ LPVOID pBuffer,
  76. /* [in] */ DWORD cbBuffer,
  77. /* [out][in] */ DWORD __RPC_FAR *pcbBuf,
  78. /* [in] */ DWORD dwReserved);
  79. private:
  80. // Wrapprers for IOINetProtocolSink:
  81. HRESULT STDMETHODCALLTYPE Switch(PROTOCOLDATA __RPC_FAR *pProtocolData);
  82. HRESULT STDMETHODCALLTYPE ReportProgress(ULONG ulStatusCode, LPCWSTR szStatusText);
  83. HRESULT STDMETHODCALLTYPE ReportData(DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax);
  84. HRESULT STDMETHODCALLTYPE ReportResult(HRESULT hrResult, DWORD dwError, LPCWSTR szResult);
  85. // Wrappers for IOINetBindInfo:
  86. HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD __RPC_FAR *grfBINDF,
  87. BINDINFO __RPC_FAR *pbindinfo
  88. );
  89. HRESULT STDMETHODCALLTYPE GetBindString(ULONG ulStringType, LPOLESTR __RPC_FAR *ppwzStr,
  90. ULONG cEl, ULONG __RPC_FAR *pcElFetched
  91. );
  92. enum { ITS_BIND_DATA = 0, CB_SAMPLE = 256};
  93. HRESULT STDMETHODCALLTYPE ParseAndBind(BOOL fBind);
  94. WCHAR *m_pwcsURL;
  95. IOInetProtocolSink *m_pOIProtSink;
  96. IOInetBindInfo *m_pOIBindInfo;
  97. IStream *m_pStream;
  98. DWORD m_grfSTI;
  99. DWORD m_grfBINDF;
  100. BINDINFO m_BindInfo;
  101. char *m_pcsDisplayName;
  102. char m_szTempPath[MAX_PATH];
  103. };
  104. CImpIOITnetProtocol m_ImpIOITnetProtocol;
  105. IUnknown *m_apIUnknown[3];
  106. };
  107. extern GUID aIID_CIOITnetProtocol[];
  108. extern UINT cInterfaces_CIOITnetProtocol;
  109. inline CIOITnetProtocol::CIOITnetProtocol(IUnknown *pUnkOuter)
  110. : m_ImpIOITnetProtocol(this, pUnkOuter),
  111. CITUnknown(aIID_CIOITnetProtocol,
  112. cInterfaces_CIOITnetProtocol,
  113. m_apIUnknown
  114. )
  115. {
  116. RonM_ASSERT(cInterfaces_CIOITnetProtocol == 3);
  117. m_apIUnknown[0] = (IUnknown *) (IOITnetProtocolRoot *) &m_ImpIOITnetProtocol;
  118. m_apIUnknown[1] = (IUnknown *) (IOITnetProtocol *) &m_ImpIOITnetProtocol;
  119. m_apIUnknown[2] = (IUnknown *) (IOITnetProtocolInfo *) &m_ImpIOITnetProtocol;
  120. }
  121. inline CIOITnetProtocol::~CIOITnetProtocol(void)
  122. {
  123. }
  124. #ifndef PROFILING
  125. // When we're not profiling the code we want these wrappers to be
  126. // vanish a separate functions. When we're makeing profile runs we want
  127. // to see how much time is consumed by these callbacks.
  128. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::Switch
  129. (PROTOCOLDATA __RPC_FAR *pProtocolData)
  130. {
  131. return m_pOIProtSink->Switch(pProtocolData);
  132. }
  133. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::ReportProgress
  134. (ULONG ulStatusCode, LPCWSTR szStatusText)
  135. {
  136. return m_pOIProtSink->ReportProgress(ulStatusCode, szStatusText);
  137. }
  138. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::ReportData
  139. (DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
  140. {
  141. return m_pOIProtSink->ReportData(grfBSCF, ulProgress, ulProgressMax);
  142. }
  143. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::ReportResult
  144. (HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
  145. {
  146. return m_pOIProtSink->ReportResult(hrResult, dwError, szResult);
  147. }
  148. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::GetBindInfo
  149. (DWORD __RPC_FAR *grfBINDF, BINDINFO __RPC_FAR *pbindinfo)
  150. {
  151. return m_pOIBindInfo->GetBindInfo(grfBINDF, pbindinfo);
  152. }
  153. inline HRESULT STDMETHODCALLTYPE CIOITnetProtocol::CImpIOITnetProtocol::GetBindString
  154. (ULONG ulStringType, LPOLESTR __RPC_FAR *ppwzStr,
  155. ULONG cEl, ULONG __RPC_FAR *pcElFetched
  156. )
  157. {
  158. return m_pOIBindInfo->GetBindString(ulStringType, ppwzStr, cEl, pcElFetched);
  159. }
  160. #endif // PROFILING
  161. void STDMETHODCALLTYPE MapSurrogateCharacters(PWCHAR pwcsBuffer);
  162. HRESULT STDMETHODCALLTYPE DisectUrl
  163. (PWCHAR pwcsUrlBuffer, PWCHAR *ppwcProtocolName,
  164. PWCHAR *ppwcExternalPath,
  165. PWCHAR *ppwcInternalPath
  166. );
  167. HRESULT STDMETHODCALLTYPE AssembleUrl
  168. (PWCHAR pwcsResult, DWORD cwcBuffer, DWORD *pcwcRequired,
  169. PWCHAR pwcsProtocolName, PWCHAR pwcsExternalPath, PWCHAR pwcsInternalPath
  170. );
  171. HRESULT STDMETHODCALLTYPE CopyStreamToFile(const WCHAR *pwcsFilePath, IStream *pStreamSrc);
  172. HRESULT STDMETHODCALLTYPE StreamToIEFile
  173. (IStream *pStreamSrc, PWCHAR pwcsDisplayName, PCHAR &pcsDisplayName,
  174. PCHAR pcsFileName, PWCHAR pwcsFileName, PCHAR pcsTempFile,
  175. IMoniker *pmk, BOOL fNoWriteCache, BOOL fNoReadCache
  176. );
  177. #endif // __PROTOCOL_H__