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
28 #include "urlmon_main.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(urlmon
);
35 const IInternetProtocolVtbl
*lpInternetProtocolVtbl
;
36 const IInternetPriorityVtbl
*lpInternetPriorityVtbl
;
43 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
44 #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
46 #define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface)
48 static HRESULT WINAPI
HttpProtocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
50 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
53 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
55 *ppv
= PROTOCOL(This
);
56 }else if(IsEqualGUID(&IID_IInternetProtocolRoot
, riid
)) {
57 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This
, ppv
);
58 *ppv
= PROTOCOL(This
);
59 }else if(IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
60 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This
, ppv
);
61 *ppv
= PROTOCOL(This
);
62 }else if(IsEqualGUID(&IID_IInternetPriority
, riid
)) {
63 TRACE("(%p)->(IID_IInternetPriority %p)\n", This
, ppv
);
64 *ppv
= PRIORITY(This
);
68 IInternetProtocol_AddRef(iface
);
72 WARN("not supported interface %s\n", debugstr_guid(riid
));
76 static ULONG WINAPI
HttpProtocol_AddRef(IInternetProtocol
*iface
)
78 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
79 LONG ref
= InterlockedIncrement(&This
->ref
);
80 TRACE("(%p) ref=%d\n", This
, ref
);
84 static ULONG WINAPI
HttpProtocol_Release(IInternetProtocol
*iface
)
86 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
87 LONG ref
= InterlockedDecrement(&This
->ref
);
89 TRACE("(%p) ref=%d\n", This
, ref
);
92 HeapFree(GetProcessHeap(), 0, This
);
94 URLMON_UnlockModule();
100 static HRESULT WINAPI
HttpProtocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
101 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
102 DWORD grfPI
, DWORD dwReserved
)
104 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
105 FIXME("(%p)->(%s %p %p %08x %d)\n", This
, debugstr_w(szUrl
), pOIProtSink
,
106 pOIBindInfo
, grfPI
, dwReserved
);
110 static HRESULT WINAPI
HttpProtocol_Continue(IInternetProtocol
*iface
, PROTOCOLDATA
*pProtocolData
)
112 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
113 FIXME("(%p)->(%p)\n", This
, pProtocolData
);
117 static HRESULT WINAPI
HttpProtocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
120 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
121 FIXME("(%p)->(%08x %08x)\n", This
, hrReason
, dwOptions
);
125 static HRESULT WINAPI
HttpProtocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
127 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
128 FIXME("(%p)->(%08x)\n", This
, dwOptions
);
132 static HRESULT WINAPI
HttpProtocol_Suspend(IInternetProtocol
*iface
)
134 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
135 FIXME("(%p)\n", This
);
139 static HRESULT WINAPI
HttpProtocol_Resume(IInternetProtocol
*iface
)
141 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
142 FIXME("(%p)\n", This
);
146 static HRESULT WINAPI
HttpProtocol_Read(IInternetProtocol
*iface
, void *pv
,
147 ULONG cb
, ULONG
*pcbRead
)
149 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
150 FIXME("(%p)->(%p %u %p)\n", This
, pv
, cb
, pcbRead
);
154 static HRESULT WINAPI
HttpProtocol_Seek(IInternetProtocol
*iface
, LARGE_INTEGER dlibMove
,
155 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
157 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
158 FIXME("(%p)->(%d %d %p)\n", This
, dlibMove
.u
.LowPart
, dwOrigin
, plibNewPosition
);
162 static HRESULT WINAPI
HttpProtocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
164 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
165 FIXME("(%p)->(%08x)\n", This
, dwOptions
);
169 static HRESULT WINAPI
HttpProtocol_UnlockRequest(IInternetProtocol
*iface
)
171 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
172 FIXME("(%p)\n", This
);
178 #define PRIORITY_THIS(iface) DEFINE_THIS(HttpProtocol, InternetPriority, iface)
180 static HRESULT WINAPI
HttpPriority_QueryInterface(IInternetPriority
*iface
, REFIID riid
, void **ppv
)
182 HttpProtocol
*This
= PRIORITY_THIS(iface
);
183 return IInternetProtocol_QueryInterface(PROTOCOL(This
), riid
, ppv
);
186 static ULONG WINAPI
HttpPriority_AddRef(IInternetPriority
*iface
)
188 HttpProtocol
*This
= PRIORITY_THIS(iface
);
189 return IInternetProtocol_AddRef(PROTOCOL(This
));
192 static ULONG WINAPI
HttpPriority_Release(IInternetPriority
*iface
)
194 HttpProtocol
*This
= PRIORITY_THIS(iface
);
195 return IInternetProtocol_Release(PROTOCOL(This
));
198 static HRESULT WINAPI
HttpPriority_SetPriority(IInternetPriority
*iface
, LONG nPriority
)
200 HttpProtocol
*This
= PRIORITY_THIS(iface
);
202 TRACE("(%p)->(%d)\n", This
, nPriority
);
204 This
->priority
= nPriority
;
208 static HRESULT WINAPI
HttpPriority_GetPriority(IInternetPriority
*iface
, LONG
*pnPriority
)
210 HttpProtocol
*This
= PRIORITY_THIS(iface
);
212 TRACE("(%p)->(%p)\n", This
, pnPriority
);
214 *pnPriority
= This
->priority
;
220 static const IInternetPriorityVtbl HttpPriorityVtbl
= {
221 HttpPriority_QueryInterface
,
223 HttpPriority_Release
,
224 HttpPriority_SetPriority
,
225 HttpPriority_GetPriority
228 static const IInternetProtocolVtbl HttpProtocolVtbl
= {
229 HttpProtocol_QueryInterface
,
231 HttpProtocol_Release
,
233 HttpProtocol_Continue
,
235 HttpProtocol_Terminate
,
236 HttpProtocol_Suspend
,
240 HttpProtocol_LockRequest
,
241 HttpProtocol_UnlockRequest
244 HRESULT
HttpProtocol_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
248 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
252 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HttpProtocol
));
254 ret
->lpInternetProtocolVtbl
= &HttpProtocolVtbl
;
255 ret
->lpInternetPriorityVtbl
= &HttpPriorityVtbl
;
261 *ppobj
= PROTOCOL(ret
);