Implement RtlInitAnsiStringEx.
[wine/multimedia.git] / dlls / urlmon / http.c
blobfd69d6bf55cb6915ce95c2e862b2e6db9e65dc6e
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 } HttpProtocol;
39 #define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface)
41 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
43 static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
45 HttpProtocol *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 HttpProtocol_AddRef(IInternetProtocol *iface)
70 HttpProtocol *This = PROTOCOL_THIS(iface);
71 LONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) ref=%ld\n", This, ref);
73 return ref;
76 static ULONG WINAPI HttpProtocol_Release(IInternetProtocol *iface)
78 HttpProtocol *This = PROTOCOL_THIS(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%ld\n", This, ref);
83 if(!ref) {
84 HeapFree(GetProcessHeap(), 0, This);
86 URLMON_UnlockModule();
89 return ref;
92 static HRESULT WINAPI HttpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
93 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
94 DWORD grfPI, DWORD dwReserved)
96 HttpProtocol *This = PROTOCOL_THIS(iface);
97 FIXME("(%p)->(%s %p %p %08lx %ld)\n", This, debugstr_w(szUrl), pOIProtSink,
98 pOIBindInfo, grfPI, dwReserved);
99 return E_NOTIMPL;
102 static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
104 HttpProtocol *This = PROTOCOL_THIS(iface);
105 FIXME("(%p)->(%p)\n", This, pProtocolData);
106 return E_NOTIMPL;
109 static HRESULT WINAPI HttpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
110 DWORD dwOptions)
112 HttpProtocol *This = PROTOCOL_THIS(iface);
113 FIXME("(%p)->(%08lx %08lx)\n", This, hrReason, dwOptions);
114 return E_NOTIMPL;
117 static HRESULT WINAPI HttpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
119 HttpProtocol *This = PROTOCOL_THIS(iface);
120 FIXME("(%p)->(%08lx)\n", This, dwOptions);
121 return E_NOTIMPL;
124 static HRESULT WINAPI HttpProtocol_Suspend(IInternetProtocol *iface)
126 HttpProtocol *This = PROTOCOL_THIS(iface);
127 FIXME("(%p)\n", This);
128 return E_NOTIMPL;
131 static HRESULT WINAPI HttpProtocol_Resume(IInternetProtocol *iface)
133 HttpProtocol *This = PROTOCOL_THIS(iface);
134 FIXME("(%p)\n", This);
135 return E_NOTIMPL;
138 static HRESULT WINAPI HttpProtocol_Read(IInternetProtocol *iface, void *pv,
139 ULONG cb, ULONG *pcbRead)
141 HttpProtocol *This = PROTOCOL_THIS(iface);
142 FIXME("(%p)->(%p %lu %p)\n", This, pv, cb, pcbRead);
143 return E_NOTIMPL;
146 static HRESULT WINAPI HttpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
147 DWORD dwOrgin, ULARGE_INTEGER *plibNewPosition)
149 HttpProtocol *This = PROTOCOL_THIS(iface);
150 FIXME("(%p)->(%ld %ld %p)\n", This, dlibMove.u.LowPart, dwOrgin, plibNewPosition);
151 return E_NOTIMPL;
154 static HRESULT WINAPI HttpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
156 HttpProtocol *This = PROTOCOL_THIS(iface);
157 FIXME("(%p)->(%08lx)\n", This, dwOptions);
158 return E_NOTIMPL;
161 static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface)
163 HttpProtocol *This = PROTOCOL_THIS(iface);
164 FIXME("(%p)\n", This);
165 return E_NOTIMPL;
168 #undef PROTOCOL_THIS
170 static const IInternetProtocolVtbl HttpProtocolVtbl = {
171 HttpProtocol_QueryInterface,
172 HttpProtocol_AddRef,
173 HttpProtocol_Release,
174 HttpProtocol_Start,
175 HttpProtocol_Continue,
176 HttpProtocol_Abort,
177 HttpProtocol_Terminate,
178 HttpProtocol_Suspend,
179 HttpProtocol_Resume,
180 HttpProtocol_Read,
181 HttpProtocol_Seek,
182 HttpProtocol_LockRequest,
183 HttpProtocol_UnlockRequest
186 HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
188 HttpProtocol *ret;
190 TRACE("(%p %p)\n", pUnkOuter, ppobj);
192 URLMON_LockModule();
194 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HttpProtocol));
196 ret->lpInternetProtocolVtbl = &HttpProtocolVtbl;
197 ret->ref = 1;
199 *ppobj = PROTOCOL(ret);
201 return S_OK;