urlmon: Added DeCompMimeFilter stub implementation.
[wine] / dlls / urlmon / mimefilter.c
1 /*
2  * Copyright 2009 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "urlmon_main.h"
20 #include "wine/debug.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
23
24 typedef struct {
25     const IInternetProtocolVtbl  *lpIInternetProtocolVtbl;
26
27     LONG ref;
28 } MimeFilter;
29
30 #define PROTOCOL(x)  ((IInternetProtocol*)  &(x)->lpIInternetProtocolVtbl)
31
32 #define PROTOCOL_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocol, iface)
33
34 static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
35 {
36     MimeFilter *This = PROTOCOL_THIS(iface);
37
38     *ppv = NULL;
39     if(IsEqualGUID(&IID_IUnknown, riid)) {
40         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
41         *ppv = PROTOCOL(This);
42     }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
43         TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
44         *ppv = PROTOCOL(This);
45     }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
46         TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
47         *ppv = PROTOCOL(This);
48     }
49
50     if(*ppv) {
51         IInternetProtocol_AddRef(iface);
52         return S_OK;
53     }
54
55     WARN("not supported interface %s\n", debugstr_guid(riid));
56     return E_NOINTERFACE;
57 }
58
59 static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface)
60 {
61     MimeFilter *This = PROTOCOL_THIS(iface);
62     LONG ref = InterlockedIncrement(&This->ref);
63     TRACE("(%p) ref=%d\n", This, ref);
64     return ref;
65 }
66
67 static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
68 {
69     MimeFilter *This = PROTOCOL_THIS(iface);
70     LONG ref = InterlockedDecrement(&This->ref);
71
72     TRACE("(%p) ref=%d\n", This, ref);
73
74     if(!ref) {
75         heap_free(This);
76
77         URLMON_UnlockModule();
78     }
79
80     return ref;
81 }
82
83 static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
84         IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
85         DWORD grfPI, HANDLE_PTR dwReserved)
86 {
87     MimeFilter *This = PROTOCOL_THIS(iface);
88     FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
89           pOIBindInfo, grfPI, dwReserved);
90     return E_NOTIMPL;
91 }
92
93 static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
94 {
95     MimeFilter *This = PROTOCOL_THIS(iface);
96     FIXME("(%p)->(%p)\n", This, pProtocolData);
97     return E_NOTIMPL;
98 }
99
100 static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
101         DWORD dwOptions)
102 {
103     MimeFilter *This = PROTOCOL_THIS(iface);
104     FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
105     return E_NOTIMPL;
106 }
107
108 static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
109 {
110     MimeFilter *This = PROTOCOL_THIS(iface);
111     FIXME("(%p)->(%08x)\n", This, dwOptions);
112     return E_NOTIMPL;
113 }
114
115 static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface)
116 {
117     MimeFilter *This = PROTOCOL_THIS(iface);
118     FIXME("(%p)\n", This);
119     return E_NOTIMPL;
120 }
121
122 static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface)
123 {
124     MimeFilter *This = PROTOCOL_THIS(iface);
125     FIXME("(%p)\n", This);
126     return E_NOTIMPL;
127 }
128
129 static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv,
130         ULONG cb, ULONG *pcbRead)
131 {
132     MimeFilter *This = PROTOCOL_THIS(iface);
133     FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
134     return E_NOTIMPL;
135 }
136
137 static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
138         DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
139 {
140     MimeFilter *This = PROTOCOL_THIS(iface);
141     FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
142     return E_NOTIMPL;
143 }
144
145 static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
146 {
147     MimeFilter *This = PROTOCOL_THIS(iface);
148     FIXME("(%p)->(%08x)\n", This, dwOptions);
149     return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface)
153 {
154     MimeFilter *This = PROTOCOL_THIS(iface);
155     FIXME("(%p)\n", This);
156     return E_NOTIMPL;
157 }
158
159 #undef PROTOCOL_THIS
160
161 static const IInternetProtocolVtbl MimeFilterProtocolVtbl = {
162     MimeFilterProtocol_QueryInterface,
163     MimeFilterProtocol_AddRef,
164     MimeFilterProtocol_Release,
165     MimeFilterProtocol_Start,
166     MimeFilterProtocol_Continue,
167     MimeFilterProtocol_Abort,
168     MimeFilterProtocol_Terminate,
169     MimeFilterProtocol_Suspend,
170     MimeFilterProtocol_Resume,
171     MimeFilterProtocol_Read,
172     MimeFilterProtocol_Seek,
173     MimeFilterProtocol_LockRequest,
174     MimeFilterProtocol_UnlockRequest
175 };
176
177 HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
178 {
179     MimeFilter *ret;
180
181     TRACE("(%p %p)\n", pUnkOuter, ppobj);
182
183     URLMON_LockModule();
184
185     ret = heap_alloc_zero(sizeof(MimeFilter));
186
187     ret->lpIInternetProtocolVtbl = &MimeFilterProtocolVtbl;
188     ret->ref = 1;
189
190     *ppobj = PROTOCOL(ret);
191     return S_OK;
192 }