2 * Copyright 2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "urlmon_main.h"
20 #include "wine/debug.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
25 const IInternetProtocolVtbl *lpIInternetProtocolVtbl;
26 const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl;
31 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl)
32 #define PROTOCOLSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl)
34 #define PROTOCOL_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocol, iface)
36 static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
38 MimeFilter *This = PROTOCOL_THIS(iface);
41 if(IsEqualGUID(&IID_IUnknown, riid)) {
42 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
43 *ppv = PROTOCOL(This);
44 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
45 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
46 *ppv = PROTOCOL(This);
47 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
48 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
49 *ppv = PROTOCOL(This);
50 }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
51 TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
52 *ppv = PROTOCOLSINK(This);
56 IInternetProtocol_AddRef(iface);
60 WARN("not supported interface %s\n", debugstr_guid(riid));
64 static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface)
66 MimeFilter *This = PROTOCOL_THIS(iface);
67 LONG ref = InterlockedIncrement(&This->ref);
68 TRACE("(%p) ref=%d\n", This, ref);
72 static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
74 MimeFilter *This = PROTOCOL_THIS(iface);
75 LONG ref = InterlockedDecrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
82 URLMON_UnlockModule();
88 static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
89 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
90 DWORD grfPI, HANDLE_PTR dwReserved)
92 MimeFilter *This = PROTOCOL_THIS(iface);
93 FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
94 pOIBindInfo, grfPI, dwReserved);
98 static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
100 MimeFilter *This = PROTOCOL_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, pProtocolData);
105 static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
108 MimeFilter *This = PROTOCOL_THIS(iface);
109 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
113 static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
115 MimeFilter *This = PROTOCOL_THIS(iface);
116 FIXME("(%p)->(%08x)\n", This, dwOptions);
120 static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface)
122 MimeFilter *This = PROTOCOL_THIS(iface);
123 FIXME("(%p)\n", This);
127 static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface)
129 MimeFilter *This = PROTOCOL_THIS(iface);
130 FIXME("(%p)\n", This);
134 static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv,
135 ULONG cb, ULONG *pcbRead)
137 MimeFilter *This = PROTOCOL_THIS(iface);
138 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
142 static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
143 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
145 MimeFilter *This = PROTOCOL_THIS(iface);
146 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
150 static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
152 MimeFilter *This = PROTOCOL_THIS(iface);
153 FIXME("(%p)->(%08x)\n", This, dwOptions);
157 static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface)
159 MimeFilter *This = PROTOCOL_THIS(iface);
160 FIXME("(%p)\n", This);
166 static const IInternetProtocolVtbl MimeFilterProtocolVtbl = {
167 MimeFilterProtocol_QueryInterface,
168 MimeFilterProtocol_AddRef,
169 MimeFilterProtocol_Release,
170 MimeFilterProtocol_Start,
171 MimeFilterProtocol_Continue,
172 MimeFilterProtocol_Abort,
173 MimeFilterProtocol_Terminate,
174 MimeFilterProtocol_Suspend,
175 MimeFilterProtocol_Resume,
176 MimeFilterProtocol_Read,
177 MimeFilterProtocol_Seek,
178 MimeFilterProtocol_LockRequest,
179 MimeFilterProtocol_UnlockRequest
182 #define PROTSINK_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocolSink, iface)
184 static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface,
185 REFIID riid, void **ppv)
187 MimeFilter *This = PROTSINK_THIS(iface);
188 return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
191 static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface)
193 MimeFilter *This = PROTSINK_THIS(iface);
194 return IInternetProtocol_AddRef(PROTOCOL(This));
197 static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface)
199 MimeFilter *This = PROTSINK_THIS(iface);
200 return IInternetProtocol_Release(PROTOCOL(This));
203 static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface,
204 PROTOCOLDATA *pProtocolData)
206 MimeFilter *This = PROTSINK_THIS(iface);
207 FIXME("(%p)->(%p)\n", This, pProtocolData);
211 static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface,
212 ULONG ulStatusCode, LPCWSTR szStatusText)
214 MimeFilter *This = PROTSINK_THIS(iface);
215 FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
219 static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface,
220 DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
222 MimeFilter *This = PROTSINK_THIS(iface);
223 FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
227 static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface,
228 HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
230 MimeFilter *This = PROTSINK_THIS(iface);
231 FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
237 static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
238 MimeFilterSink_QueryInterface,
239 MimeFilterSink_AddRef,
240 MimeFilterSink_Release,
241 MimeFilterSink_Switch,
242 MimeFilterSink_ReportProgress,
243 MimeFilterSink_ReportData,
244 MimeFilterSink_ReportResult
247 HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
251 TRACE("(%p %p)\n", pUnkOuter, ppobj);
255 ret = heap_alloc_zero(sizeof(MimeFilter));
257 ret->lpIInternetProtocolVtbl = &MimeFilterProtocolVtbl;
258 ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
261 *ppobj = PROTOCOL(ret);