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.

241 lines
5.3 KiB

  1. // VidProt.h : pluggable protocol for tv:
  2. #pragma once
  3. #ifndef VIDPROT_H
  4. #define VIDPROT_H
  5. #include "factoryhelp.h"
  6. // protocol for TV
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CTVProt
  9. class ATL_NO_VTABLE __declspec(uuid("CBD30858-AF45-11d2-B6D6-00C04FBBDE6E")) CTVProt :
  10. public CComObjectRootEx<CComSingleThreadModel>,
  11. public CComCoClass<CTVProt, &__uuidof(CTVProt)>,
  12. public IInternetProtocol {
  13. public:
  14. CTVProt()
  15. {
  16. }
  17. ~CTVProt()
  18. {
  19. }
  20. REGISTER_PROTOCOL(IDS_PROJNAME,
  21. IDS_REG_TVPROTOCOL_DESC,
  22. LIBID_MSVidCtlLib,
  23. __uuidof(CTVProt),
  24. TVPROT_SCHEME_NAME);
  25. DECLARE_PROTECT_FINAL_CONSTRUCT()
  26. BEGIN_COM_MAP(CTVProt)
  27. COM_INTERFACE_ENTRY(IInternetProtocol)
  28. COM_INTERFACE_ENTRY(IInternetProtocolRoot)
  29. END_COM_MAP()
  30. private:
  31. CComPtr<IInternetProtocolSink> m_pSink;
  32. public:
  33. HRESULT GetVidCtl(PQVidCtl &pCtl);
  34. HRESULT GetCachedVidCtl(PQVidCtl &pCtl, PQWebBrowser2& pW2);
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CTVProt -- IInternetProtocol
  37. STDMETHODIMP Read(LPVOID pv, ULONG cb, ULONG* pcbRead)
  38. {
  39. TRACELM(TRACE_DEBUG, "CTVProt::Read()");
  40. *pcbRead = 0;
  41. return S_FALSE;
  42. }
  43. STDMETHODIMP Seek(LARGE_INTEGER /* dlibMove */,
  44. DWORD /* dwOrigin */,
  45. ULARGE_INTEGER* /* plibNewPosition*/)
  46. {
  47. TRACELM(TRACE_DEBUG, "CTVProt::Seek()");
  48. return E_FAIL;
  49. }
  50. STDMETHODIMP LockRequest(DWORD /* dwOptions */)
  51. {
  52. TRACELM(TRACE_DEBUG, "CTVProt::LockRequest()");
  53. return S_OK;
  54. }
  55. STDMETHODIMP UnlockRequest()
  56. {
  57. TRACELM(TRACE_DEBUG, "CTVProt::UnlockRequest()");
  58. return S_OK;
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // CTVProt -- IInternetProtocolRoot
  62. STDMETHOD(Start)(LPCWSTR szUrl,
  63. IInternetProtocolSink* pOIProtSink,
  64. IInternetBindInfo* pOIBindInfo,
  65. DWORD grfPI,
  66. HANDLE_PTR /* dwReserved */);
  67. STDMETHODIMP Continue(PROTOCOLDATA* /* pProtocolData */)
  68. {
  69. TRACELM(TRACE_DEBUG, "CTVProt::Continue()");
  70. return S_OK;
  71. }
  72. STDMETHODIMP Abort(HRESULT /* hrReason */, DWORD /* dwOptions */)
  73. {
  74. TRACELM(TRACE_DEBUG, "CTVProt::Abort()");
  75. if (m_pSink)
  76. {
  77. m_pSink->ReportResult(E_ABORT, 0, 0);
  78. }
  79. return S_OK;
  80. }
  81. STDMETHODIMP Terminate(DWORD dwf/* dwOptions */)
  82. {
  83. TRACELSM(TRACE_DEBUG, (dbgDump << "CTVProt::Terminate() " << hexdump(dwf)), "");
  84. return S_OK;
  85. }
  86. STDMETHODIMP Suspend()
  87. {
  88. TRACELM(TRACE_DEBUG, "CTVProt::Suspend()");
  89. return E_NOTIMPL;
  90. }
  91. STDMETHODIMP Resume()
  92. {
  93. TRACELM(TRACE_DEBUG, "CTVProt::Resume()");
  94. return E_NOTIMPL;
  95. }
  96. };
  97. ////////////////////////////////////////////////////////////////////////////////
  98. //
  99. // protocol for DVD
  100. //
  101. /////////////////////////////////////////////////////////////////////////////////
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CDVDProt
  104. class ATL_NO_VTABLE __declspec(uuid("12D51199-0DB5-46fe-A120-47A3D7D937CC")) CDVDProt :
  105. public CComObjectRootEx<CComSingleThreadModel>,
  106. public CComCoClass<CDVDProt, &__uuidof(CDVDProt)>,
  107. public IInternetProtocol {
  108. public:
  109. CDVDProt()
  110. {
  111. }
  112. ~CDVDProt()
  113. {
  114. }
  115. REGISTER_PROTOCOL(IDS_PROJNAME,
  116. IDS_REG_DVDPROTOCOL_DESC,
  117. LIBID_MSVidCtlLib,
  118. __uuidof(CDVDProt),
  119. DVDPROT_SCHEME_NAME);
  120. DECLARE_PROTECT_FINAL_CONSTRUCT()
  121. BEGIN_COM_MAP(CDVDProt)
  122. COM_INTERFACE_ENTRY(IInternetProtocol)
  123. COM_INTERFACE_ENTRY(IInternetProtocolRoot)
  124. END_COM_MAP()
  125. private:
  126. CComPtr<IInternetProtocolSink> m_pSink;
  127. public:
  128. /////////////////////////////////////////////////////////////////////////////
  129. // CDVDProt -- IInternetProtocol
  130. STDMETHODIMP Read(LPVOID pv, ULONG cb, ULONG* pcbRead)
  131. {
  132. TRACELM(TRACE_DEBUG, "CDVDProt::Read()");
  133. *pcbRead = 0;
  134. return S_FALSE;
  135. }
  136. STDMETHODIMP Seek(LARGE_INTEGER /* dlibMove */,
  137. DWORD /* dwOrigin */,
  138. ULARGE_INTEGER* /* plibNewPosition*/)
  139. {
  140. TRACELM(TRACE_DEBUG, "CDVDProt::Seek()");
  141. return E_FAIL;
  142. }
  143. STDMETHODIMP LockRequest(DWORD /* dwOptions */)
  144. {
  145. TRACELM(TRACE_DEBUG, "CDVDProt::LockRequest()");
  146. return S_OK;
  147. }
  148. STDMETHODIMP UnlockRequest()
  149. {
  150. TRACELM(TRACE_DEBUG, "CDVDProt::UnlockRequest()");
  151. return S_OK;
  152. }
  153. /////////////////////////////////////////////////////////////////////////////
  154. // CDVDProt -- IInternetProtocolRoot
  155. STDMETHOD(Start)(LPCWSTR szUrl,
  156. IInternetProtocolSink* pOIProtSink,
  157. IInternetBindInfo* pOIBindInfo,
  158. DWORD grfPI,
  159. HANDLE_PTR /* dwReserved */);
  160. STDMETHODIMP Continue(PROTOCOLDATA* /* pProtocolData */)
  161. {
  162. TRACELM(TRACE_DEBUG, "CDVDProt::Continue()");
  163. return S_OK;
  164. }
  165. STDMETHODIMP Abort(HRESULT /* hrReason */, DWORD /* dwOptions */)
  166. {
  167. TRACELM(TRACE_DEBUG, "CDVDProt::Abort()");
  168. if (m_pSink)
  169. {
  170. m_pSink->ReportResult(E_ABORT, 0, 0);
  171. }
  172. return S_OK;
  173. }
  174. STDMETHODIMP Terminate(DWORD dwf/* dwOptions */)
  175. {
  176. TRACELSM(TRACE_DEBUG, (dbgDump << "CDVDProt::Terminate() " << hexdump(dwf)), "");
  177. return S_OK;
  178. }
  179. STDMETHODIMP Suspend()
  180. {
  181. TRACELM(TRACE_DEBUG, "CDVDProt::Suspend()");
  182. return E_NOTIMPL;
  183. }
  184. STDMETHODIMP Resume()
  185. {
  186. TRACELM(TRACE_DEBUG, "CDVDProt::Resume()");
  187. return E_NOTIMPL;
  188. }
  189. };
  190. #endif //__VIDPROT_H_