mshtml: Don't use dynamic allocation for connection points.
[wine] / dlls / mshtml / htmlwindow.c
1 /*
2  * Copyright 2006 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 "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
31
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
34
35 #include "mshtml_private.h"
36 #include "resource.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39
40 #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
41
42 static struct list window_list = LIST_INIT(window_list);
43
44 static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
45 {
46     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
47
48     *ppv = NULL;
49
50     if(IsEqualGUID(&IID_IUnknown, riid)) {
51         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
52         *ppv = HTMLWINDOW2(This);
53     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
54         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
55         *ppv = HTMLWINDOW2(This);
56     }else if(IsEqualGUID(&IID_IHTMLFramesCollection2, riid)) {
57         TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This, ppv);
58         *ppv = HTMLWINDOW2(This);
59     }else if(IsEqualGUID(&IID_IHTMLWindow2, riid)) {
60         TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv);
61         *ppv = HTMLWINDOW2(This);
62     }
63
64     if(*ppv) {
65         IUnknown_AddRef((IUnknown*)*ppv);
66         return S_OK;
67     }
68
69     WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
70     return E_NOINTERFACE;
71 }
72
73 static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface)
74 {
75     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
76     LONG ref = InterlockedIncrement(&This->ref);
77
78     TRACE("(%p) ref=%d\n", This, ref);
79
80     return ref;
81 }
82
83 static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
84 {
85     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
86     LONG ref = InterlockedDecrement(&This->ref);
87
88     TRACE("(%p) ref=%d\n", This, ref);
89
90     if(!ref) {
91         list_remove(&This->entry);
92         mshtml_free(This);
93     }
94
95     return ref;
96 }
97
98 static HRESULT WINAPI HTMLWindow2_GetTypeInfoCount(IHTMLWindow2 *iface, UINT *pctinfo)
99 {
100     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
101     FIXME("(%p)->(%p)\n", This, pctinfo);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLWindow2_GetTypeInfo(IHTMLWindow2 *iface, UINT iTInfo,
106                                               LCID lcid, ITypeInfo **ppTInfo)
107 {
108     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
109     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
110     return E_NOTIMPL;
111 }
112
113 static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid,
114                                                 LPOLESTR *rgszNames, UINT cNames,
115                                                 LCID lcid, DISPID *rgDispId)
116 {
117     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
118     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
119                                         lcid, rgDispId);
120     return E_NOTIMPL;
121 }
122
123 static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMember,
124                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
125                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
126 {
127     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
128     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
129             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
134 {
135     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
136     FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, long *p)
141 {
142     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
143     FIXME("(%p)->(%p)\n", This, p);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
148 {
149     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
150     FIXME("(%p)->(%p)\n", This, p);
151     return E_NOTIMPL;
152 }
153
154 static HRESULT WINAPI HTMLWindow2_put_defaultStatus(IHTMLWindow2 *iface, BSTR v)
155 {
156     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
157     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI HTMLWindow2_get_defaultStatus(IHTMLWindow2 *iface, BSTR *p)
162 {
163     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
164     FIXME("(%p)->(%p)\n", This, p);
165     return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI HTMLWindow2_put_status(IHTMLWindow2 *iface, BSTR v)
169 {
170     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
171     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
172     return E_NOTIMPL;
173 }
174
175 static HRESULT WINAPI HTMLWindow2_get_status(IHTMLWindow2 *iface, BSTR *p)
176 {
177     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
178     FIXME("(%p)->(%p)\n", This, p);
179     return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expression,
183         long msec, VARIANT *language, long *timerID)
184 {
185     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
186     FIXME("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
187     return E_NOTIMPL;
188 }
189
190 static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, long timerID)
191 {
192     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
193     FIXME("(%p)->(%ld)\n", This, timerID);
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
198 {
199     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
200     WCHAR wszTitle[100];
201
202     TRACE("(%p)->(%s)\n", This, debugstr_w(message));
203
204     if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
205                     sizeof(wszTitle)/sizeof(WCHAR))) {
206         WARN("Could not load message box title: %d\n", GetLastError());
207         return S_OK;
208     }
209
210     MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING);
211     return S_OK;
212 }
213
214 static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
215         VARIANT_BOOL *confirmed)
216 {
217     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
218     FIXME("(%p)->(%s %p)\n", This, debugstr_w(message), confirmed);
219     return E_NOTIMPL;
220 }
221
222 static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
223         BSTR dststr, VARIANT *textdata)
224 {
225     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
226     FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata);
227     return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p)
231 {
232     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
233     FIXME("(%p)->(%p)\n", This, p);
234     return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
238 {
239     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
240     FIXME("(%p)->(%p)\n", This, p);
241     return E_NOTIMPL;
242 }
243
244 static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p)
245 {
246     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
247     FIXME("(%p)->(%p)\n", This, p);
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI HTMLWindow2_close(IHTMLWindow2 *iface)
252 {
253     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
254     FIXME("(%p)->()\n", This);
255     return E_NOTIMPL;
256 }
257
258 static HRESULT WINAPI HTMLWindow2_put_opener(IHTMLWindow2 *iface, VARIANT v)
259 {
260     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
261     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
262     return E_NOTIMPL;
263 }
264
265 static HRESULT WINAPI HTMLWindow2_get_opener(IHTMLWindow2 *iface, VARIANT *p)
266 {
267     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
268     FIXME("(%p)->(%p)\n", This, p);
269     return E_NOTIMPL;
270 }
271
272 static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigator **p)
273 {
274     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
275     FIXME("(%p)->(%p)\n", This, p);
276     return E_NOTIMPL;
277 }
278
279 static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
280 {
281     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
282     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
283     return E_NOTIMPL;
284 }
285
286 static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
287 {
288     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
289     FIXME("(%p)->(%p)\n", This, p);
290     return E_NOTIMPL;
291 }
292
293 static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
294 {
295     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
296     FIXME("(%p)->(%p)\n", This, p);
297     return E_NOTIMPL;
298 }
299
300 static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
301          BSTR features, VARIANT_BOOL replace, IHTMLWindow2 **pomWindowResult)
302 {
303     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
304     FIXME("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
305           debugstr_w(features), replace, pomWindowResult);
306     return E_NOTIMPL;
307 }
308
309 static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p)
310 {
311     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
312     FIXME("(%p)->(%p)\n", This, p);
313     return E_NOTIMPL;
314 }
315
316 static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p)
317 {
318     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
319     FIXME("(%p)->(%p)\n", This, p);
320     return E_NOTIMPL;
321 }
322
323 static HRESULT WINAPI HTMLWindow2_get_window(IHTMLWindow2 *iface, IHTMLWindow2 **p)
324 {
325     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
326     FIXME("(%p)->(%p)\n", This, p);
327     return E_NOTIMPL;
328 }
329
330 static HRESULT WINAPI HTMLWindow2_navigate(IHTMLWindow2 *iface, BSTR url)
331 {
332     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
333     FIXME("(%p)->(%s)\n", This, debugstr_w(url));
334     return E_NOTIMPL;
335 }
336
337 static HRESULT WINAPI HTMLWindow2_put_onfocus(IHTMLWindow2 *iface, VARIANT v)
338 {
339     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
340     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
341     return E_NOTIMPL;
342 }
343
344 static HRESULT WINAPI HTMLWindow2_get_onfocus(IHTMLWindow2 *iface, VARIANT *p)
345 {
346     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
347     FIXME("(%p)->(%p)\n", This, p);
348     return E_NOTIMPL;
349 }
350
351 static HRESULT WINAPI HTMLWindow2_put_onblur(IHTMLWindow2 *iface, VARIANT v)
352 {
353     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
354     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
355     return E_NOTIMPL;
356 }
357
358 static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p)
359 {
360     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
361     FIXME("(%p)->(%p)\n", This, p);
362     return E_NOTIMPL;
363 }
364
365 static HRESULT WINAPI HTMLWindow2_put_onload(IHTMLWindow2 *iface, VARIANT v)
366 {
367     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
368     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
369     return E_NOTIMPL;
370 }
371
372 static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
373 {
374     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
375     FIXME("(%p)->(%p)\n", This, p);
376     return E_NOTIMPL;
377 }
378
379 static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
380 {
381     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
382     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
383     return E_NOTIMPL;
384 }
385
386 static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
387 {
388     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
389     FIXME("(%p)->(%p)\n", This, p);
390     return E_NOTIMPL;
391 }
392
393 static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)
394 {
395     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
396     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
397     return E_NOTIMPL;
398 }
399
400 static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
401 {
402     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
403     FIXME("(%p)->(%p)\n", This, p);
404     return E_NOTIMPL;
405 }
406
407 static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v)
408 {
409     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
410     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
411     return E_NOTIMPL;
412 }
413
414 static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p)
415 {
416     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
417     FIXME("(%p)->(%p)\n", This, p);
418     return E_NOTIMPL;
419 }
420
421 static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v)
422 {
423     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
424     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
425     return E_NOTIMPL;
426 }
427
428 static HRESULT WINAPI HTMLWindow2_get_onerror(IHTMLWindow2 *iface, VARIANT *p)
429 {
430     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
431     FIXME("(%p)->(%p)\n", This, p);
432     return E_NOTIMPL;
433 }
434
435 static HRESULT WINAPI HTMLWindow2_put_onresize(IHTMLWindow2 *iface, VARIANT v)
436 {
437     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
438     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
439     return E_NOTIMPL;
440 }
441
442 static HRESULT WINAPI HTMLWindow2_get_onresize(IHTMLWindow2 *iface, VARIANT *p)
443 {
444     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
445     FIXME("(%p)->(%p)\n", This, p);
446     return E_NOTIMPL;
447 }
448
449 static HRESULT WINAPI HTMLWindow2_put_onscroll(IHTMLWindow2 *iface, VARIANT v)
450 {
451     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
452     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
453     return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p)
457 {
458     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
459     FIXME("(%p)->(%p)\n", This, p);
460     return E_NOTIMPL;
461 }
462
463 static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p)
464 {
465     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
466     FIXME("(%p)->(%p)\n", This, p);
467     return E_NOTIMPL;
468 }
469
470 static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p)
471 {
472     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
473     FIXME("(%p)->(%p)\n", This, p);
474     return E_NOTIMPL;
475 }
476
477 static HRESULT WINAPI HTMLWindow2_get__newEnum(IHTMLWindow2 *iface, IUnknown **p)
478 {
479     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
480     FIXME("(%p)->(%p)\n", This, p);
481     return E_NOTIMPL;
482 }
483
484 static HRESULT WINAPI HTMLWindow2_showModalDialog(IHTMLWindow2 *iface, BSTR dialog,
485         VARIANT *varArgIn, VARIANT *varOptions, VARIANT *varArgOut)
486 {
487     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
488     FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(dialog), varArgIn, varOptions, varArgOut);
489     return E_NOTIMPL;
490 }
491
492 static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VARIANT helpArg,
493         BSTR features)
494 {
495     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
496     FIXME("(%p)->(%s v(%d) %s)\n", This, debugstr_w(helpURL), V_VT(&helpArg), debugstr_w(features));
497     return E_NOTIMPL;
498 }
499
500 static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p)
501 {
502     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
503     FIXME("(%p)->(%p)\n", This, p);
504     return E_NOTIMPL;
505 }
506
507 static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p)
508 {
509     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
510     FIXME("(%p)->(%p)\n", This, p);
511     return E_NOTIMPL;
512 }
513
514 static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface)
515 {
516     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
517     FIXME("(%p)->()\n", This);
518     return E_NOTIMPL;
519 }
520
521 static HRESULT WINAPI HTMLWindow2_get_closed(IHTMLWindow2 *iface, VARIANT_BOOL *p)
522 {
523     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
524     FIXME("(%p)->(%p)\n", This, p);
525     return E_NOTIMPL;
526 }
527
528 static HRESULT WINAPI HTMLWindow2_blur(IHTMLWindow2 *iface)
529 {
530     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
531     FIXME("(%p)->()\n", This);
532     return E_NOTIMPL;
533 }
534
535 static HRESULT WINAPI HTMLWindow2_scroll(IHTMLWindow2 *iface, long x, long y)
536 {
537     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
538     FIXME("(%p)->(%ld %ld)\n", This, x, y);
539     return E_NOTIMPL;
540 }
541
542 static HRESULT WINAPI HTMLWindow2_get_clientInformation(IHTMLWindow2 *iface, IOmNavigator **p)
543 {
544     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
545     FIXME("(%p)->(%p)\n", This, p);
546     return E_NOTIMPL;
547 }
548
549 static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expression,
550         long msec, VARIANT *language, long *timerID)
551 {
552     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
553     FIXME("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
554     return E_NOTIMPL;
555 }
556
557 static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, long timerID)
558 {
559     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
560     FIXME("(%p)->(%ld)\n", This, timerID);
561     return E_NOTIMPL;
562 }
563
564 static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
565 {
566     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
567     FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
568     return E_NOTIMPL;
569 }
570
571 static HRESULT WINAPI HTMLWindow2_get_offscreenBuffering(IHTMLWindow2 *iface, VARIANT *p)
572 {
573     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
574     FIXME("(%p)->(%p)\n", This, p);
575     return E_NOTIMPL;
576 }
577
578 static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BSTR language,
579         VARIANT *pvarRet)
580 {
581     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
582     FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
583     return E_NOTIMPL;
584 }
585
586 static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
587 {
588     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
589     FIXME("(%p)->(%p)\n", This, String);
590     return E_NOTIMPL;
591 }
592
593 static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, long x, long y)
594 {
595     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
596     FIXME("(%p)->(%ld %ld)\n", This, x, y);
597     return E_NOTIMPL;
598 }
599
600 static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, long x, long y)
601 {
602     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
603     FIXME("(%p)->(%ld %ld)\n", This, x, y);
604     return E_NOTIMPL;
605 }
606
607 static HRESULT WINAPI HTMLWindow2_moveTo(IHTMLWindow2 *iface, long x, long y)
608 {
609     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
610     FIXME("(%p)->(%ld %ld)\n", This, x, y);
611     return E_NOTIMPL;
612 }
613
614 static HRESULT WINAPI HTMLWindow2_moveBy(IHTMLWindow2 *iface, long x, long y)
615 {
616     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
617     FIXME("(%p)->(%ld %ld)\n", This, x, y);
618     return E_NOTIMPL;
619 }
620
621 static HRESULT WINAPI HTMLWindow2_resizeTo(IHTMLWindow2 *iface, long x, long y)
622 {
623     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
624     FIXME("(%p)->(%ld %ld)\n", This, x, y);
625     return E_NOTIMPL;
626 }
627
628 static HRESULT WINAPI HTMLWindow2_resizeBy(IHTMLWindow2 *iface, long x, long y)
629 {
630     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
631     FIXME("(%p)->(%ld %ld)\n", This, x, y);
632     return E_NOTIMPL;
633 }
634
635 static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **p)
636 {
637     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
638     FIXME("(%p)->(%p)\n", This, p);
639     return E_NOTIMPL;
640 }
641
642 #undef HTMLWINDOW2_THIS
643
644 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = {
645     HTMLWindow2_QueryInterface,
646     HTMLWindow2_AddRef,
647     HTMLWindow2_Release,
648     HTMLWindow2_GetTypeInfoCount,
649     HTMLWindow2_GetTypeInfo,
650     HTMLWindow2_GetIDsOfNames,
651     HTMLWindow2_Invoke,
652     HTMLWindow2_item,
653     HTMLWindow2_get_length,
654     HTMLWindow2_get_frames,
655     HTMLWindow2_put_defaultStatus,
656     HTMLWindow2_get_defaultStatus,
657     HTMLWindow2_put_status,
658     HTMLWindow2_get_status,
659     HTMLWindow2_setTimeout,
660     HTMLWindow2_clearTimeout,
661     HTMLWindow2_alert,
662     HTMLWindow2_confirm,
663     HTMLWindow2_prompt,
664     HTMLWindow2_get_Image,
665     HTMLWindow2_get_location,
666     HTMLWindow2_get_history,
667     HTMLWindow2_close,
668     HTMLWindow2_put_opener,
669     HTMLWindow2_get_opener,
670     HTMLWindow2_get_navigator,
671     HTMLWindow2_put_name,
672     HTMLWindow2_get_name,
673     HTMLWindow2_get_parent,
674     HTMLWindow2_open,
675     HTMLWindow2_get_self,
676     HTMLWindow2_get_top,
677     HTMLWindow2_get_window,
678     HTMLWindow2_navigate,
679     HTMLWindow2_put_onfocus,
680     HTMLWindow2_get_onfocus,
681     HTMLWindow2_put_onblur,
682     HTMLWindow2_get_onblur,
683     HTMLWindow2_put_onload,
684     HTMLWindow2_get_onload,
685     HTMLWindow2_put_onbeforeunload,
686     HTMLWindow2_get_onbeforeunload,
687     HTMLWindow2_put_onunload,
688     HTMLWindow2_get_onunload,
689     HTMLWindow2_put_onhelp,
690     HTMLWindow2_get_onhelp,
691     HTMLWindow2_put_onerror,
692     HTMLWindow2_get_onerror,
693     HTMLWindow2_put_onresize,
694     HTMLWindow2_get_onresize,
695     HTMLWindow2_put_onscroll,
696     HTMLWindow2_get_onscroll,
697     HTMLWindow2_get_document,
698     HTMLWindow2_get_event,
699     HTMLWindow2_get__newEnum,
700     HTMLWindow2_showModalDialog,
701     HTMLWindow2_showHelp,
702     HTMLWindow2_get_screen,
703     HTMLWindow2_get_Option,
704     HTMLWindow2_focus,
705     HTMLWindow2_get_closed,
706     HTMLWindow2_blur,
707     HTMLWindow2_scroll,
708     HTMLWindow2_get_clientInformation,
709     HTMLWindow2_setInterval,
710     HTMLWindow2_clearInterval,
711     HTMLWindow2_put_offscreenBuffering,
712     HTMLWindow2_get_offscreenBuffering,
713     HTMLWindow2_execScript,
714     HTMLWindow2_toString,
715     HTMLWindow2_scrollBy,
716     HTMLWindow2_scrollTo,
717     HTMLWindow2_moveTo,
718     HTMLWindow2_moveBy,
719     HTMLWindow2_resizeTo,
720     HTMLWindow2_resizeBy,
721     HTMLWindow2_get_external
722 };
723
724 HTMLWindow *HTMLWindow_Create(HTMLDocument *doc)
725 {
726     HTMLWindow *ret = mshtml_alloc(sizeof(HTMLWindow));
727
728     ret->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
729     ret->ref = 1;
730     ret->nswindow = NULL;
731     ret->doc = doc;
732
733     if(doc->nscontainer) {
734         nsresult nsres;
735
736         nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &ret->nswindow);
737         if(NS_FAILED(nsres))
738             ERR("GetContentDOMWindow failed: %08x\n", nsres);
739     }
740
741     list_add_head(&window_list, &ret->entry);
742
743     return ret;
744 }
745
746 HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
747 {
748     HTMLWindow *iter;
749
750     LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) {
751         if(iter->nswindow == nswindow)
752             return iter;
753     }
754
755     return NULL;
756 }