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
);
25 const IInternetProtocolVtbl
*lpInternetProtocolVtbl
;
26 const IInternetPriorityVtbl
*lpInternetPriorityVtbl
;
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
);
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
);
56 IInternetProtocol_AddRef(iface
);
60 WARN("not supported interface %s\n", debugstr_guid(riid
));
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
);
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
);
82 URLMON_UnlockModule();
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
);
98 static HRESULT WINAPI
FtpProtocol_Continue(IInternetProtocol
*iface
, PROTOCOLDATA
*pProtocolData
)
100 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
101 FIXME("(%p)->(%p)\n", This
, pProtocolData
);
105 static HRESULT WINAPI
FtpProtocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
108 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
109 FIXME("(%p)->(%08x %08x)\n", This
, hrReason
, dwOptions
);
113 static HRESULT WINAPI
FtpProtocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
115 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
116 FIXME("(%p)->(%08x)\n", This
, dwOptions
);
120 static HRESULT WINAPI
FtpProtocol_Suspend(IInternetProtocol
*iface
)
122 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
123 FIXME("(%p)\n", This
);
127 static HRESULT WINAPI
FtpProtocol_Resume(IInternetProtocol
*iface
)
129 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
130 FIXME("(%p)\n", This
);
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
);
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
);
150 static HRESULT WINAPI
FtpProtocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
152 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
153 FIXME("(%p)->(%08x)\n", This
, dwOptions
);
157 static HRESULT WINAPI
FtpProtocol_UnlockRequest(IInternetProtocol
*iface
)
159 FtpProtocol
*This
= PROTOCOL_THIS(iface
);
160 FIXME("(%p)\n", This
);
166 static const IInternetProtocolVtbl FtpProtocolVtbl
= {
167 FtpProtocol_QueryInterface
,
171 FtpProtocol_Continue
,
173 FtpProtocol_Terminate
,
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
);
209 static HRESULT WINAPI
FtpPriority_GetPriority(IInternetPriority
*iface
, LONG
*pnPriority
)
211 FtpProtocol
*This
= PRIORITY_THIS(iface
);
212 FIXME("(%p)->(%p)\n", This
, pnPriority
);
218 static const IInternetPriorityVtbl FtpPriorityVtbl
= {
219 FtpPriority_QueryInterface
,
222 FtpPriority_SetPriority
,
223 FtpPriority_GetPriority
226 HRESULT
FtpProtocol_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
230 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
234 ret
= heap_alloc(sizeof(FtpProtocol
));
236 ret
->lpInternetProtocolVtbl
= &FtpProtocolVtbl
;
237 ret
->lpInternetPriorityVtbl
= &FtpPriorityVtbl
;
240 *ppobj
= PROTOCOL(ret
);