- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / dll / win32 / mshtml / htmllocation.c
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #include <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29
30 #include "mshtml_private.h"
31 #include "resource.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 #define HTMLLOCATION_THIS(iface) DEFINE_THIS(HTMLLocation, HTMLLocation, iface)
36
37 static HRESULT WINAPI HTMLLocation_QueryInterface(IHTMLLocation *iface, REFIID riid, void **ppv)
38 {
39 HTMLLocation *This = HTMLLOCATION_THIS(iface);
40
41 *ppv = NULL;
42
43 if(IsEqualGUID(&IID_IUnknown, riid)) {
44 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
45 *ppv = HTMLLOCATION(This);
46 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
47 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
48 *ppv = HTMLLOCATION(This);
49 }else if(IsEqualGUID(&IID_IHTMLLocation, riid)) {
50 TRACE("(%p)->(IID_IHTMLLocation %p)\n", This, ppv);
51 *ppv = HTMLLOCATION(This);
52 }
53
54 if(*ppv) {
55 IUnknown_AddRef((IUnknown*)*ppv);
56 return S_OK;
57 }
58
59 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
60 return E_NOINTERFACE;
61 }
62
63 static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface)
64 {
65 HTMLLocation *This = HTMLLOCATION_THIS(iface);
66 LONG ref = InterlockedIncrement(&This->ref);
67
68 TRACE("(%p) ref=%d\n", This, ref);
69
70 return ref;
71 }
72
73 static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
74 {
75 HTMLLocation *This = HTMLLOCATION_THIS(iface);
76 LONG ref = InterlockedDecrement(&This->ref);
77
78 TRACE("(%p) ref=%d\n", This, ref);
79
80 if(!ref) {
81 if(This->doc && This->doc->location == This)
82 This->doc->location = NULL;
83 heap_free(This);
84 }
85
86 return ref;
87 }
88
89 static HRESULT WINAPI HTMLLocation_GetTypeInfoCount(IHTMLLocation *iface, UINT *pctinfo)
90 {
91 HTMLLocation *This = HTMLLOCATION_THIS(iface);
92 FIXME("(%p)->(%p)\n", This, pctinfo);
93 return E_NOTIMPL;
94 }
95
96 static HRESULT WINAPI HTMLLocation_GetTypeInfo(IHTMLLocation *iface, UINT iTInfo,
97 LCID lcid, ITypeInfo **ppTInfo)
98 {
99 HTMLLocation *This = HTMLLOCATION_THIS(iface);
100 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
101 return E_NOTIMPL;
102 }
103
104 static HRESULT WINAPI HTMLLocation_GetIDsOfNames(IHTMLLocation *iface, REFIID riid,
105 LPOLESTR *rgszNames, UINT cNames,
106 LCID lcid, DISPID *rgDispId)
107 {
108 HTMLLocation *This = HTMLLOCATION_THIS(iface);
109 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
110 lcid, rgDispId);
111 return E_NOTIMPL;
112 }
113
114 static HRESULT WINAPI HTMLLocation_Invoke(IHTMLLocation *iface, DISPID dispIdMember,
115 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
116 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
117 {
118 HTMLLocation *This = HTMLLOCATION_THIS(iface);
119 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
120 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
121 return E_NOTIMPL;
122 }
123
124 static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
125 {
126 HTMLLocation *This = HTMLLOCATION_THIS(iface);
127 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
128 return E_NOTIMPL;
129 }
130
131 static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
132 {
133 HTMLLocation *This = HTMLLOCATION_THIS(iface);
134 FIXME("(%p)->(%p)\n", This, p);
135 return E_NOTIMPL;
136 }
137
138 static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
139 {
140 HTMLLocation *This = HTMLLOCATION_THIS(iface);
141 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
142 return E_NOTIMPL;
143 }
144
145 static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
146 {
147 HTMLLocation *This = HTMLLOCATION_THIS(iface);
148 FIXME("(%p)->(%p)\n", This, p);
149 return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI HTMLLocation_put_host(IHTMLLocation *iface, BSTR v)
153 {
154 HTMLLocation *This = HTMLLOCATION_THIS(iface);
155 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
156 return E_NOTIMPL;
157 }
158
159 static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p)
160 {
161 HTMLLocation *This = HTMLLOCATION_THIS(iface);
162 FIXME("(%p)->(%p)\n", This, p);
163 return E_NOTIMPL;
164 }
165
166 static HRESULT WINAPI HTMLLocation_put_hostname(IHTMLLocation *iface, BSTR v)
167 {
168 HTMLLocation *This = HTMLLOCATION_THIS(iface);
169 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
170 return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
174 {
175 HTMLLocation *This = HTMLLOCATION_THIS(iface);
176 FIXME("(%p)->(%p)\n", This, p);
177 return E_NOTIMPL;
178 }
179
180 static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v)
181 {
182 HTMLLocation *This = HTMLLOCATION_THIS(iface);
183 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
184 return E_NOTIMPL;
185 }
186
187 static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
188 {
189 HTMLLocation *This = HTMLLOCATION_THIS(iface);
190 FIXME("(%p)->(%p)\n", This, p);
191 return E_NOTIMPL;
192 }
193
194 static HRESULT WINAPI HTMLLocation_put_pathname(IHTMLLocation *iface, BSTR v)
195 {
196 HTMLLocation *This = HTMLLOCATION_THIS(iface);
197 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
198 return E_NOTIMPL;
199 }
200
201 static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
202 {
203 HTMLLocation *This = HTMLLOCATION_THIS(iface);
204 FIXME("(%p)->(%p)\n", This, p);
205 return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v)
209 {
210 HTMLLocation *This = HTMLLOCATION_THIS(iface);
211 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
212 return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
216 {
217 HTMLLocation *This = HTMLLOCATION_THIS(iface);
218 FIXME("(%p)->(%p)\n", This, p);
219 return E_NOTIMPL;
220 }
221
222 static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
223 {
224 HTMLLocation *This = HTMLLOCATION_THIS(iface);
225 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
226 return E_NOTIMPL;
227 }
228
229 static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
230 {
231 HTMLLocation *This = HTMLLOCATION_THIS(iface);
232 FIXME("(%p)->(%p)\n", This, p);
233 return E_NOTIMPL;
234 }
235
236 static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL flag)
237 {
238 HTMLLocation *This = HTMLLOCATION_THIS(iface);
239 FIXME("(%p)->(%x)\n", This, flag);
240 return E_NOTIMPL;
241 }
242
243 static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
244 {
245 HTMLLocation *This = HTMLLOCATION_THIS(iface);
246 FIXME("(%p)->(%s)\n", This, debugstr_w(bstr));
247 return E_NOTIMPL;
248 }
249
250 static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr)
251 {
252 HTMLLocation *This = HTMLLOCATION_THIS(iface);
253 FIXME("(%p)->(%s)\n", This, debugstr_w(bstr));
254 return E_NOTIMPL;
255 }
256
257 static HRESULT WINAPI HTMLLocation_toString(IHTMLLocation *iface, BSTR *String)
258 {
259 HTMLLocation *This = HTMLLOCATION_THIS(iface);
260 FIXME("(%p)->(%p)\n", This, String);
261 return E_NOTIMPL;
262 }
263
264 #undef HTMLLOCATION_THIS
265
266 static const IHTMLLocationVtbl HTMLLocationVtbl = {
267 HTMLLocation_QueryInterface,
268 HTMLLocation_AddRef,
269 HTMLLocation_Release,
270 HTMLLocation_GetTypeInfoCount,
271 HTMLLocation_GetTypeInfo,
272 HTMLLocation_GetIDsOfNames,
273 HTMLLocation_Invoke,
274 HTMLLocation_put_href,
275 HTMLLocation_get_href,
276 HTMLLocation_put_protocol,
277 HTMLLocation_get_protocol,
278 HTMLLocation_put_host,
279 HTMLLocation_get_host,
280 HTMLLocation_put_hostname,
281 HTMLLocation_get_hostname,
282 HTMLLocation_put_port,
283 HTMLLocation_get_port,
284 HTMLLocation_put_pathname,
285 HTMLLocation_get_pathname,
286 HTMLLocation_put_search,
287 HTMLLocation_get_search,
288 HTMLLocation_put_hash,
289 HTMLLocation_get_hash,
290 HTMLLocation_reload,
291 HTMLLocation_replace,
292 HTMLLocation_assign,
293 HTMLLocation_toString
294 };
295
296 HTMLLocation *HTMLLocation_Create(HTMLDocument *doc)
297 {
298 HTMLLocation *ret = heap_alloc(sizeof(*ret));
299
300 ret->lpHTMLLocationVtbl = &HTMLLocationVtbl;
301 ret->ref = 1;
302 ret->doc = doc;
303
304 return ret;
305 }