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);
27 const IInternetProtocolVtbl *lpInternetProtocolVtbl;
28 const IInternetPriorityVtbl *lpInternetPriorityVtbl;
33 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
34 #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
36 #define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, InternetProtocol, iface)
38 static HRESULT WINAPI GopherProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
40 GopherProtocol *This = PROTOCOL_THIS(iface);
43 if(IsEqualGUID(&IID_IUnknown, riid)) {
44 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
45 *ppv = PROTOCOL(This);
46 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
47 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
48 *ppv = PROTOCOL(This);
49 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
50 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
51 *ppv = PROTOCOL(This);
52 }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
53 TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
54 *ppv = PRIORITY(This);
58 IInternetProtocol_AddRef(iface);
62 WARN("not supported interface %s\n", debugstr_guid(riid));
66 static ULONG WINAPI GopherProtocol_AddRef(IInternetProtocol *iface)
68 GopherProtocol *This = PROTOCOL_THIS(iface);
69 LONG ref = InterlockedIncrement(&This->ref);
70 TRACE("(%p) ref=%d\n", This, ref);
74 static ULONG WINAPI GopherProtocol_Release(IInternetProtocol *iface)
76 GopherProtocol *This = PROTOCOL_THIS(iface);
77 LONG ref = InterlockedDecrement(&This->ref);
79 TRACE("(%p) ref=%d\n", This, ref);
84 URLMON_UnlockModule();
90 static HRESULT WINAPI GopherProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
91 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
92 DWORD grfPI, DWORD dwReserved)
94 GopherProtocol *This = PROTOCOL_THIS(iface);
95 FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
96 pOIBindInfo, grfPI, dwReserved);
100 static HRESULT WINAPI GopherProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
102 GopherProtocol *This = PROTOCOL_THIS(iface);
103 FIXME("(%p)->(%p)\n", This, pProtocolData);
107 static HRESULT WINAPI GopherProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
110 GopherProtocol *This = PROTOCOL_THIS(iface);
111 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
115 static HRESULT WINAPI GopherProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
117 GopherProtocol *This = PROTOCOL_THIS(iface);
118 FIXME("(%p)->(%08x)\n", This, dwOptions);
122 static HRESULT WINAPI GopherProtocol_Suspend(IInternetProtocol *iface)
124 GopherProtocol *This = PROTOCOL_THIS(iface);
125 FIXME("(%p)\n", This);
129 static HRESULT WINAPI GopherProtocol_Resume(IInternetProtocol *iface)
131 GopherProtocol *This = PROTOCOL_THIS(iface);
132 FIXME("(%p)\n", This);
136 static HRESULT WINAPI GopherProtocol_Read(IInternetProtocol *iface, void *pv,
137 ULONG cb, ULONG *pcbRead)
139 GopherProtocol *This = PROTOCOL_THIS(iface);
140 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
144 static HRESULT WINAPI GopherProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
145 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
147 GopherProtocol *This = PROTOCOL_THIS(iface);
148 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
152 static HRESULT WINAPI GopherProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
154 GopherProtocol *This = PROTOCOL_THIS(iface);
155 FIXME("(%p)->(%08x)\n", This, dwOptions);
159 static HRESULT WINAPI GopherProtocol_UnlockRequest(IInternetProtocol *iface)
161 GopherProtocol *This = PROTOCOL_THIS(iface);
162 FIXME("(%p)\n", This);
168 static const IInternetProtocolVtbl GopherProtocolVtbl = {
169 GopherProtocol_QueryInterface,
170 GopherProtocol_AddRef,
171 GopherProtocol_Release,
172 GopherProtocol_Start,
173 GopherProtocol_Continue,
174 GopherProtocol_Abort,
175 GopherProtocol_Terminate,
176 GopherProtocol_Suspend,
177 GopherProtocol_Resume,
180 GopherProtocol_LockRequest,
181 GopherProtocol_UnlockRequest
184 #define PRIORITY_THIS(iface) DEFINE_THIS(GopherProtocol, InternetPriority, iface)
186 static HRESULT WINAPI GopherPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
188 GopherProtocol *This = PRIORITY_THIS(iface);
189 return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
192 static ULONG WINAPI GopherPriority_AddRef(IInternetPriority *iface)
194 GopherProtocol *This = PRIORITY_THIS(iface);
195 return IInternetProtocol_AddRef(PROTOCOL(This));
198 static ULONG WINAPI GopherPriority_Release(IInternetPriority *iface)
200 GopherProtocol *This = PRIORITY_THIS(iface);
201 return IInternetProtocol_Release(PROTOCOL(This));
204 static HRESULT WINAPI GopherPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
206 GopherProtocol *This = PRIORITY_THIS(iface);
208 TRACE("(%p)->(%d)\n", This, nPriority);
210 This->base.priority = nPriority;
214 static HRESULT WINAPI GopherPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
216 GopherProtocol *This = PRIORITY_THIS(iface);
218 TRACE("(%p)->(%p)\n", This, pnPriority);
220 *pnPriority = This->base.priority;
226 static const IInternetPriorityVtbl GopherPriorityVtbl = {
227 GopherPriority_QueryInterface,
228 GopherPriority_AddRef,
229 GopherPriority_Release,
230 GopherPriority_SetPriority,
231 GopherPriority_GetPriority
234 HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
238 TRACE("(%p %p)\n", pUnkOuter, ppobj);
242 ret = heap_alloc_zero(sizeof(GopherProtocol));
244 ret->lpInternetProtocolVtbl = &GopherProtocolVtbl;
245 ret->lpInternetPriorityVtbl = &GopherPriorityVtbl;
248 *ppobj = PROTOCOL(ret);