push 8724397e7ede0f147b6e05994a72142d44d4fecc
[wine/hacks.git] / dlls / urlmon / ftp.c
blobf79641ee4a106ded630fbd96d22c71cdad347ce8
1 /*
2 * Copyright 2005 Jacek Caban
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 const IInternetProtocolVtbl *lpInternetProtocolVtbl;
26 const IInternetPriorityVtbl *lpInternetPriorityVtbl;
28 LONG ref;
29 } FtpProtocol;
31 #define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface)
33 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
34 #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
36 static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
38 FtpProtocol *This = PROTOCOL_THIS(iface);
40 *ppv = NULL;
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_IInternetPriority, riid)) {
51 TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
52 *ppv = PRIORITY(This);
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 FtpProtocol_AddRef(IInternetProtocol *iface)
66 FtpProtocol *This = PROTOCOL_THIS(iface);
67 LONG ref = InterlockedIncrement(&This->ref);
68 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
72 static ULONG WINAPI FtpProtocol_Release(IInternetProtocol *iface)
74 FtpProtocol *This = PROTOCOL_THIS(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 FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
89 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
90 DWORD grfPI, DWORD dwReserved)
92 FtpProtocol *This = PROTOCOL_THIS(iface);
93 FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
94 pOIBindInfo, grfPI, dwReserved);
95 return E_NOTIMPL;
98 static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
100 FtpProtocol *This = PROTOCOL_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, pProtocolData);
102 return E_NOTIMPL;
105 static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
106 DWORD dwOptions)
108 FtpProtocol *This = PROTOCOL_THIS(iface);
109 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
110 return E_NOTIMPL;
113 static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
115 FtpProtocol *This = PROTOCOL_THIS(iface);
116 FIXME("(%p)->(%08x)\n", This, dwOptions);
117 return E_NOTIMPL;
120 static HRESULT WINAPI FtpProtocol_Suspend(IInternetProtocol *iface)
122 FtpProtocol *This = PROTOCOL_THIS(iface);
123 FIXME("(%p)\n", This);
124 return E_NOTIMPL;
127 static HRESULT WINAPI FtpProtocol_Resume(IInternetProtocol *iface)
129 FtpProtocol *This = PROTOCOL_THIS(iface);
130 FIXME("(%p)\n", This);
131 return E_NOTIMPL;
134 static HRESULT WINAPI FtpProtocol_Read(IInternetProtocol *iface, void *pv,
135 ULONG cb, ULONG *pcbRead)
137 FtpProtocol *This = PROTOCOL_THIS(iface);
138 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
139 return E_NOTIMPL;
142 static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
143 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
145 FtpProtocol *This = PROTOCOL_THIS(iface);
146 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
147 return E_NOTIMPL;
150 static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
152 FtpProtocol *This = PROTOCOL_THIS(iface);
153 FIXME("(%p)->(%08x)\n", This, dwOptions);
154 return E_NOTIMPL;
157 static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface)
159 FtpProtocol *This = PROTOCOL_THIS(iface);
160 FIXME("(%p)\n", This);
161 return E_NOTIMPL;
164 #undef PROTOCOL_THIS
166 static const IInternetProtocolVtbl FtpProtocolVtbl = {
167 FtpProtocol_QueryInterface,
168 FtpProtocol_AddRef,
169 FtpProtocol_Release,
170 FtpProtocol_Start,
171 FtpProtocol_Continue,
172 FtpProtocol_Abort,
173 FtpProtocol_Terminate,
174 FtpProtocol_Suspend,
175 FtpProtocol_Resume,
176 FtpProtocol_Read,
177 FtpProtocol_Seek,
178 FtpProtocol_LockRequest,
179 FtpProtocol_UnlockRequest
182 #define PRIORITY_THIS(iface) DEFINE_THIS(FtpProtocol, InternetPriority, iface)
184 static HRESULT WINAPI FtpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
186 FtpProtocol *This = PRIORITY_THIS(iface);
187 return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
190 static ULONG WINAPI FtpPriority_AddRef(IInternetPriority *iface)
192 FtpProtocol *This = PRIORITY_THIS(iface);
193 return IInternetProtocol_AddRef(PROTOCOL(This));
196 static ULONG WINAPI FtpPriority_Release(IInternetPriority *iface)
198 FtpProtocol *This = PRIORITY_THIS(iface);
199 return IInternetProtocol_Release(PROTOCOL(This));
202 static HRESULT WINAPI FtpPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
204 FtpProtocol *This = PRIORITY_THIS(iface);
205 FIXME("(%p)->(%d)\n", This, nPriority);
206 return E_NOTIMPL;
209 static HRESULT WINAPI FtpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
211 FtpProtocol *This = PRIORITY_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, pnPriority);
213 return E_NOTIMPL;
216 #undef PRIORITY_THIS
218 static const IInternetPriorityVtbl FtpPriorityVtbl = {
219 FtpPriority_QueryInterface,
220 FtpPriority_AddRef,
221 FtpPriority_Release,
222 FtpPriority_SetPriority,
223 FtpPriority_GetPriority
226 HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
228 FtpProtocol *ret;
230 TRACE("(%p %p)\n", pUnkOuter, ppobj);
232 URLMON_LockModule();
234 ret = heap_alloc(sizeof(FtpProtocol));
236 ret->lpInternetProtocolVtbl = &FtpProtocolVtbl;
237 ret->lpInternetPriorityVtbl = &FtpPriorityVtbl;
238 ret->ref = 1;
240 *ppobj = PROTOCOL(ret);
242 return S_OK;