opengl32: glGetString() should return NULL on NULL context.
[wine/hacks.git] / dlls / urlmon / ftp.c
blob7b528adb8e25e412418157abbabc5f4079708fb0
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 LONG ref;
27 } FtpProtocol;
29 #define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, InternetProtocol, iface)
31 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
33 static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
35 FtpProtocol *This = PROTOCOL_THIS(iface);
37 *ppv = NULL;
38 if(IsEqualGUID(&IID_IUnknown, riid)) {
39 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
40 *ppv = PROTOCOL(This);
41 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
42 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
43 *ppv = PROTOCOL(This);
44 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
45 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
46 *ppv = PROTOCOL(This);
49 if(*ppv) {
50 IInternetProtocol_AddRef(iface);
51 return S_OK;
54 WARN("not supported interface %s\n", debugstr_guid(riid));
55 return E_NOINTERFACE;
58 static ULONG WINAPI FtpProtocol_AddRef(IInternetProtocol *iface)
60 FtpProtocol *This = PROTOCOL_THIS(iface);
61 LONG ref = InterlockedIncrement(&This->ref);
62 TRACE("(%p) ref=%d\n", This, ref);
63 return ref;
66 static ULONG WINAPI FtpProtocol_Release(IInternetProtocol *iface)
68 FtpProtocol *This = PROTOCOL_THIS(iface);
69 LONG ref = InterlockedDecrement(&This->ref);
71 TRACE("(%p) ref=%d\n", This, ref);
73 if(!ref) {
74 heap_free(This);
76 URLMON_UnlockModule();
79 return ref;
82 static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
83 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
84 DWORD grfPI, DWORD dwReserved)
86 FtpProtocol *This = PROTOCOL_THIS(iface);
87 FIXME("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
88 pOIBindInfo, grfPI, dwReserved);
89 return E_NOTIMPL;
92 static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
94 FtpProtocol *This = PROTOCOL_THIS(iface);
95 FIXME("(%p)->(%p)\n", This, pProtocolData);
96 return E_NOTIMPL;
99 static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
100 DWORD dwOptions)
102 FtpProtocol *This = PROTOCOL_THIS(iface);
103 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
104 return E_NOTIMPL;
107 static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
109 FtpProtocol *This = PROTOCOL_THIS(iface);
110 FIXME("(%p)->(%08x)\n", This, dwOptions);
111 return E_NOTIMPL;
114 static HRESULT WINAPI FtpProtocol_Suspend(IInternetProtocol *iface)
116 FtpProtocol *This = PROTOCOL_THIS(iface);
117 FIXME("(%p)\n", This);
118 return E_NOTIMPL;
121 static HRESULT WINAPI FtpProtocol_Resume(IInternetProtocol *iface)
123 FtpProtocol *This = PROTOCOL_THIS(iface);
124 FIXME("(%p)\n", This);
125 return E_NOTIMPL;
128 static HRESULT WINAPI FtpProtocol_Read(IInternetProtocol *iface, void *pv,
129 ULONG cb, ULONG *pcbRead)
131 FtpProtocol *This = PROTOCOL_THIS(iface);
132 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
133 return E_NOTIMPL;
136 static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
137 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
139 FtpProtocol *This = PROTOCOL_THIS(iface);
140 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
141 return E_NOTIMPL;
144 static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
146 FtpProtocol *This = PROTOCOL_THIS(iface);
147 FIXME("(%p)->(%08x)\n", This, dwOptions);
148 return E_NOTIMPL;
151 static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface)
153 FtpProtocol *This = PROTOCOL_THIS(iface);
154 FIXME("(%p)\n", This);
155 return E_NOTIMPL;
158 #undef PROTOCOL_THIS
160 static const IInternetProtocolVtbl FtpProtocolVtbl = {
161 FtpProtocol_QueryInterface,
162 FtpProtocol_AddRef,
163 FtpProtocol_Release,
164 FtpProtocol_Start,
165 FtpProtocol_Continue,
166 FtpProtocol_Abort,
167 FtpProtocol_Terminate,
168 FtpProtocol_Suspend,
169 FtpProtocol_Resume,
170 FtpProtocol_Read,
171 FtpProtocol_Seek,
172 FtpProtocol_LockRequest,
173 FtpProtocol_UnlockRequest
176 HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
178 FtpProtocol *ret;
180 TRACE("(%p %p)\n", pUnkOuter, ppobj);
182 URLMON_LockModule();
184 ret = heap_alloc(sizeof(FtpProtocol));
186 ret->lpInternetProtocolVtbl = &FtpProtocolVtbl;
187 ret->ref = 1;
189 *ppobj = PROTOCOL(ret);
191 return S_OK;