push 0f15bbd80d260bbd8adf052e820484a405c49375
[wine/hacks.git] / dlls / urlmon / ftp.c
blobb921293b1413279fbc34de551bd4c48988503ff6
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 <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27 #include "urlmon.h"
28 #include "urlmon_main.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
34 typedef struct {
35 const IInternetProtocolVtbl *lpInternetProtocolVtbl;
36 LONG ref;
37 } FtpProtocol;
39 #define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface)
41 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
43 static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
45 FtpProtocol *This = PROTOCOL_THIS(iface);
47 *ppv = NULL;
48 if(IsEqualGUID(&IID_IUnknown, riid)) {
49 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
50 *ppv = PROTOCOL(This);
51 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
52 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
53 *ppv = PROTOCOL(This);
54 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
55 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
56 *ppv = PROTOCOL(This);
59 if(*ppv) {
60 IInternetProtocol_AddRef(iface);
61 return S_OK;
64 WARN("not supported interface %s\n", debugstr_guid(riid));
65 return E_NOINTERFACE;
68 static ULONG WINAPI FtpProtocol_AddRef(IInternetProtocol *iface)
70 FtpProtocol *This = PROTOCOL_THIS(iface);
71 LONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) ref=%d\n", This, ref);
73 return ref;
76 static ULONG WINAPI FtpProtocol_Release(IInternetProtocol *iface)
78 FtpProtocol *This = PROTOCOL_THIS(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 if(!ref) {
84 heap_free(This);
86 URLMON_UnlockModule();
89 return ref;
92 static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
93 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
94 DWORD grfPI, DWORD dwReserved)
96 FtpProtocol *This = PROTOCOL_THIS(iface);
97 FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
98 pOIBindInfo, grfPI, dwReserved);
99 return E_NOTIMPL;
102 static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
104 FtpProtocol *This = PROTOCOL_THIS(iface);
105 FIXME("(%p)->(%p)\n", This, pProtocolData);
106 return E_NOTIMPL;
109 static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
110 DWORD dwOptions)
112 FtpProtocol *This = PROTOCOL_THIS(iface);
113 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
114 return E_NOTIMPL;
117 static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
119 FtpProtocol *This = PROTOCOL_THIS(iface);
120 FIXME("(%p)->(%08x)\n", This, dwOptions);
121 return E_NOTIMPL;
124 static HRESULT WINAPI FtpProtocol_Suspend(IInternetProtocol *iface)
126 FtpProtocol *This = PROTOCOL_THIS(iface);
127 FIXME("(%p)\n", This);
128 return E_NOTIMPL;
131 static HRESULT WINAPI FtpProtocol_Resume(IInternetProtocol *iface)
133 FtpProtocol *This = PROTOCOL_THIS(iface);
134 FIXME("(%p)\n", This);
135 return E_NOTIMPL;
138 static HRESULT WINAPI FtpProtocol_Read(IInternetProtocol *iface, void *pv,
139 ULONG cb, ULONG *pcbRead)
141 FtpProtocol *This = PROTOCOL_THIS(iface);
142 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
143 return E_NOTIMPL;
146 static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
147 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
149 FtpProtocol *This = PROTOCOL_THIS(iface);
150 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
151 return E_NOTIMPL;
154 static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
156 FtpProtocol *This = PROTOCOL_THIS(iface);
157 FIXME("(%p)->(%08x)\n", This, dwOptions);
158 return E_NOTIMPL;
161 static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface)
163 FtpProtocol *This = PROTOCOL_THIS(iface);
164 FIXME("(%p)\n", This);
165 return E_NOTIMPL;
168 #undef PROTOCOL_THIS
170 static const IInternetProtocolVtbl FtpProtocolVtbl = {
171 FtpProtocol_QueryInterface,
172 FtpProtocol_AddRef,
173 FtpProtocol_Release,
174 FtpProtocol_Start,
175 FtpProtocol_Continue,
176 FtpProtocol_Abort,
177 FtpProtocol_Terminate,
178 FtpProtocol_Suspend,
179 FtpProtocol_Resume,
180 FtpProtocol_Read,
181 FtpProtocol_Seek,
182 FtpProtocol_LockRequest,
183 FtpProtocol_UnlockRequest
186 HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
188 FtpProtocol *ret;
190 TRACE("(%p %p)\n", pUnkOuter, ppobj);
192 URLMON_LockModule();
194 ret = heap_alloc(sizeof(FtpProtocol));
196 ret->lpInternetProtocolVtbl = &FtpProtocolVtbl;
197 ret->ref = 1;
199 *ppobj = PROTOCOL(ret);
201 return S_OK;