wine.inf: Create a fake dll for the 32-bit iexplore on Wow64.
[wine/multimedia.git] / dlls / urlmon / mimefilter.c
blob1fe5246cbb00b5d1d653f71a5d05c283018ebb23
1 /*
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);
24 typedef struct {
25 IInternetProtocol IInternetProtocol_iface;
26 IInternetProtocolSink IInternetProtocolSink_iface;
28 LONG ref;
29 } MimeFilter;
31 static inline MimeFilter *impl_from_IInternetProtocol(IInternetProtocol *iface)
33 return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocol_iface);
36 static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
38 MimeFilter *This = impl_from_IInternetProtocol(iface);
40 *ppv = NULL;
41 if(IsEqualGUID(&IID_IUnknown, riid)) {
42 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
43 *ppv = &This->IInternetProtocol_iface;
44 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
45 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
46 *ppv = &This->IInternetProtocol_iface;
47 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
48 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
49 *ppv = &This->IInternetProtocol_iface;
50 }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
51 TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
52 *ppv = &This->IInternetProtocolSink_iface;
55 if(*ppv) {
56 IInternetProtocol_AddRef(iface);
57 return S_OK;
60 WARN("not supported interface %s\n", debugstr_guid(riid));
61 return E_NOINTERFACE;
64 static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface)
66 MimeFilter *This = impl_from_IInternetProtocol(iface);
67 LONG ref = InterlockedIncrement(&This->ref);
68 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
72 static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
74 MimeFilter *This = impl_from_IInternetProtocol(iface);
75 LONG ref = InterlockedDecrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 if(!ref) {
80 heap_free(This);
82 URLMON_UnlockModule();
85 return ref;
88 static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
89 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
90 DWORD grfPI, HANDLE_PTR dwReserved)
92 MimeFilter *This = impl_from_IInternetProtocol(iface);
93 FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
94 pOIBindInfo, grfPI, dwReserved);
95 return E_NOTIMPL;
98 static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
100 MimeFilter *This = impl_from_IInternetProtocol(iface);
101 FIXME("(%p)->(%p)\n", This, pProtocolData);
102 return E_NOTIMPL;
105 static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
106 DWORD dwOptions)
108 MimeFilter *This = impl_from_IInternetProtocol(iface);
109 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
110 return E_NOTIMPL;
113 static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
115 MimeFilter *This = impl_from_IInternetProtocol(iface);
116 FIXME("(%p)->(%08x)\n", This, dwOptions);
117 return E_NOTIMPL;
120 static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface)
122 MimeFilter *This = impl_from_IInternetProtocol(iface);
123 FIXME("(%p)\n", This);
124 return E_NOTIMPL;
127 static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface)
129 MimeFilter *This = impl_from_IInternetProtocol(iface);
130 FIXME("(%p)\n", This);
131 return E_NOTIMPL;
134 static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv,
135 ULONG cb, ULONG *pcbRead)
137 MimeFilter *This = impl_from_IInternetProtocol(iface);
138 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
139 return E_NOTIMPL;
142 static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
143 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
145 MimeFilter *This = impl_from_IInternetProtocol(iface);
146 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
147 return E_NOTIMPL;
150 static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
152 MimeFilter *This = impl_from_IInternetProtocol(iface);
153 FIXME("(%p)->(%08x)\n", This, dwOptions);
154 return E_NOTIMPL;
157 static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface)
159 MimeFilter *This = impl_from_IInternetProtocol(iface);
160 FIXME("(%p)\n", This);
161 return E_NOTIMPL;
164 static const IInternetProtocolVtbl MimeFilterProtocolVtbl = {
165 MimeFilterProtocol_QueryInterface,
166 MimeFilterProtocol_AddRef,
167 MimeFilterProtocol_Release,
168 MimeFilterProtocol_Start,
169 MimeFilterProtocol_Continue,
170 MimeFilterProtocol_Abort,
171 MimeFilterProtocol_Terminate,
172 MimeFilterProtocol_Suspend,
173 MimeFilterProtocol_Resume,
174 MimeFilterProtocol_Read,
175 MimeFilterProtocol_Seek,
176 MimeFilterProtocol_LockRequest,
177 MimeFilterProtocol_UnlockRequest
180 static inline MimeFilter *impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
182 return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocolSink_iface);
185 static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface,
186 REFIID riid, void **ppv)
188 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
189 return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv);
192 static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface)
194 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
195 return IInternetProtocol_AddRef(&This->IInternetProtocol_iface);
198 static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface)
200 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
201 return IInternetProtocol_Release(&This->IInternetProtocol_iface);
204 static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface,
205 PROTOCOLDATA *pProtocolData)
207 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
208 FIXME("(%p)->(%p)\n", This, pProtocolData);
209 return E_NOTIMPL;
212 static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface,
213 ULONG ulStatusCode, LPCWSTR szStatusText)
215 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
216 FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
217 return E_NOTIMPL;
220 static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface,
221 DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
223 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
224 FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
225 return E_NOTIMPL;
228 static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface,
229 HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
231 MimeFilter *This = impl_from_IInternetProtocolSink(iface);
232 FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
233 return E_NOTIMPL;
236 static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
237 MimeFilterSink_QueryInterface,
238 MimeFilterSink_AddRef,
239 MimeFilterSink_Release,
240 MimeFilterSink_Switch,
241 MimeFilterSink_ReportProgress,
242 MimeFilterSink_ReportData,
243 MimeFilterSink_ReportResult
246 HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
248 MimeFilter *ret;
250 TRACE("(%p %p)\n", pUnkOuter, ppobj);
252 URLMON_LockModule();
254 ret = heap_alloc_zero(sizeof(MimeFilter));
256 ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl;
257 ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
258 ret->ref = 1;
260 *ppobj = &ret->IInternetProtocol_iface;
261 return S_OK;