inetcomm: Create the root body in IMimeMessage_Load.
[wine] / dlls / shdocvw / tests / webbrowser.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 #define COBJMACROS
20 #define CONST_VTABLE
21
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29 #include "exdisp.h"
30 #include "htiframe.h"
31 #include "mshtmhst.h"
32 #include "idispids.h"
33 #include "olectl.h"
34 #include "mshtmdid.h"
35 #include "shlguid.h"
36 #include "exdispid.h"
37
38 #define DEFINE_EXPECT(func) \
39     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
40
41 #define SET_EXPECT(func) \
42     expect_ ## func = TRUE
43
44 #define CHECK_EXPECT2(func) \
45     do { \
46         ok(expect_ ##func, "unexpected call " #func "\n"); \
47         called_ ## func = TRUE; \
48     }while(0)
49
50 #define CHECK_EXPECT(func) \
51     do { \
52         CHECK_EXPECT2(func); \
53         expect_ ## func = FALSE; \
54     }while(0)
55
56 #define CHECK_CALLED(func) \
57     do { \
58         ok(called_ ## func, "expected " #func "\n"); \
59         expect_ ## func = called_ ## func = FALSE; \
60     }while(0)
61
62 DEFINE_EXPECT(GetContainer);
63 DEFINE_EXPECT(Site_GetWindow);
64 DEFINE_EXPECT(ShowObject);
65 DEFINE_EXPECT(CanInPlaceActivate);
66 DEFINE_EXPECT(OnInPlaceActivate);
67 DEFINE_EXPECT(OnUIActivate);
68 DEFINE_EXPECT(GetWindowContext);
69 DEFINE_EXPECT(Frame_GetWindow);
70 DEFINE_EXPECT(Frame_SetActiveObject);
71 DEFINE_EXPECT(UIWindow_SetActiveObject);
72 DEFINE_EXPECT(SetMenu);
73 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
74 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
75 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
76 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
77 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
78 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
79 DEFINE_EXPECT(Invoke_STATUSTEXTCHANGE);
80 DEFINE_EXPECT(Invoke_PROPERTYCHANGE);
81 DEFINE_EXPECT(Invoke_DOWNLOADBEGIN);
82 DEFINE_EXPECT(Invoke_BEFORENAVIGATE2);
83 DEFINE_EXPECT(Invoke_SETSECURELOCKICON);
84 DEFINE_EXPECT(Invoke_FILEDOWNLOAD);
85 DEFINE_EXPECT(Invoke_COMMANDSTATECHANGE);
86 DEFINE_EXPECT(Invoke_DOWNLOADCOMPLETE);
87 DEFINE_EXPECT(Invoke_ONMENUBAR);
88 DEFINE_EXPECT(Invoke_ONADDRESSBAR);
89 DEFINE_EXPECT(Invoke_ONSTATUSBAR);
90 DEFINE_EXPECT(Invoke_ONTOOLBAR);
91 DEFINE_EXPECT(Invoke_ONFULLSCREEN);
92 DEFINE_EXPECT(Invoke_WINDOWSETRESIZABLE);
93 DEFINE_EXPECT(EnableModeless_TRUE);
94 DEFINE_EXPECT(EnableModeless_FALSE);
95 DEFINE_EXPECT(GetHostInfo);
96 DEFINE_EXPECT(GetOptionKeyPath);
97 DEFINE_EXPECT(GetOverridesKeyPath);
98 DEFINE_EXPECT(SetStatusText);
99 DEFINE_EXPECT(UpdateUI);
100 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
101 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
102 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
103 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
104 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
105
106 static const WCHAR wszItem[] = {'i','t','e','m',0};
107 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
108
109 static VARIANT_BOOL exvb;
110 static IWebBrowser2 *wb;
111
112 static HWND container_hwnd, shell_embedding_hwnd;
113
114 static const char *debugstr_w(LPCWSTR str)
115 {
116     static char buf[1024];
117     if(!str)
118         return "(null)";
119     WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
120     return buf;
121 }
122
123 static const char *debugstr_guid(REFIID riid)
124 {
125     static char buf[50];
126
127     sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
128             riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
129             riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
130             riid->Data4[5], riid->Data4[6], riid->Data4[7]);
131
132     return buf;
133 }
134
135 static HRESULT QueryInterface(REFIID,void**);
136
137 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
138         REFIID riid, void **ppv)
139 {
140     ok(0, "unexpected call\n");
141     return E_NOINTERFACE;
142 }
143
144 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
145 {
146     return 2;
147 }
148
149 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
150 {
151     return 1;
152 }
153
154 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
155         ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
156 {
157     ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
158     ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
159     ok(!pCmdText, "pCmdText != NULL\n");
160
161     switch(prgCmds[0].cmdID) {
162     case OLECMDID_SETPROGRESSTEXT:
163         CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
164         prgCmds[0].cmdf = OLECMDF_ENABLED;
165         return S_OK;
166     default:
167         ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
168     }
169
170     return E_FAIL;
171 }
172
173 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
174         DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
175 {
176     if(!pguidCmdGroup) {
177         switch(nCmdID) {
178         case OLECMDID_SETPROGRESSMAX:
179             CHECK_EXPECT(Exec_SETPROGRESSMAX);
180             ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
181             ok(pvaIn != NULL, "pvaIn == NULL\n");
182             if(pvaIn)
183                 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
184             ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
185             return S_OK;
186         case OLECMDID_SETPROGRESSPOS:
187             CHECK_EXPECT(Exec_SETPROGRESSPOS);
188             ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
189             ok(pvaIn != NULL, "pvaIn == NULL\n");
190             if(pvaIn)
191                 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
192             ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
193             return S_OK;
194         case OLECMDID_SETDOWNLOADSTATE:
195             ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
196             ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
197             ok(pvaIn != NULL, "pvaIn == NULL\n");
198             ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
199             switch(V_I4(pvaIn)) {
200             case 0:
201                 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
202                 break;
203             case 1:
204                 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1);
205                 break;
206             default:
207                 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
208             }
209             return S_OK;
210         default:
211             ok(0, "unexpected nsCmdID %d\n", nCmdID);
212         }
213     }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
214         switch(nCmdID) {
215         case 24:
216             return E_FAIL; /* TODO */
217         case 66:
218             return E_FAIL; /* TODO */
219         default:
220             ok(0, "unexpected nCmdID %d\n", nCmdID);
221         }
222     }else {
223         ok(0, "unepected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
224     }
225
226     return E_FAIL;
227 }
228
229 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
230     OleCommandTarget_QueryInterface,
231     OleCommandTarget_AddRef,
232     OleCommandTarget_Release,
233     OleCommandTarget_QueryStatus,
234     OleCommandTarget_Exec
235 };
236
237 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
238
239 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
240 {
241     if(IsEqualGUID(&IID_ITargetContainer, riid))
242         return E_NOINTERFACE; /* TODO */
243
244     if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
245         *ppv = &OleCommandTarget;
246         return S_OK;
247     }
248
249     ok(0, "unexpected call\n");
250     return E_NOINTERFACE;
251 }
252
253 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
254 {
255     return 2;
256 }
257
258 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
259 {
260     return 1;
261 }
262
263 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
264         LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
265 {
266     ok(0, "unexpected call\n");
267     return E_NOTIMPL;
268 }
269
270 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
271         IEnumUnknown **ppenum)
272 {
273     ok(0, "unexpected call\n");
274     return E_NOTIMPL;
275 }
276
277 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
278 {
279     ok(0, "unexpected call\n");
280     return E_NOTIMPL;
281 }
282
283 static const IOleContainerVtbl OleContainerVtbl = {
284     OleContainer_QueryInterface,
285     OleContainer_AddRef,
286     OleContainer_Release,
287     OleContainer_ParseDisplayName,
288     OleContainer_EnumObjects,
289     OleContainer_LockContainer
290 };
291
292 static IOleContainer OleContainer = { &OleContainerVtbl };
293
294 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
295 {
296     return QueryInterface(riid, ppv);
297 }
298
299 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
300 {
301     return 2;
302 }
303
304 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
305 {
306     return 1;
307 }
308
309 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
310 {
311     ok(0, "unexpected call\n");
312     return E_NOTIMPL;
313 }
314
315 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
316         ITypeInfo **ppTInfo)
317 {
318     ok(0, "unexpected call\n");
319     return E_NOTIMPL;
320 }
321
322 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
323         UINT cNames, LCID lcid, DISPID *rgDispId)
324 {
325     ok(0, "unexpected call\n");
326     return E_NOTIMPL;
327 }
328
329 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
330         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
331         EXCEPINFO *pExcepInfo, UINT *puArgErr)
332 {
333     ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
334     ok(pDispParams != NULL, "pDispParams == NULL\n");
335     ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
336     ok(V_VT(pVarResult) == VT_EMPTY, "V_VT(pVarResult)=%d\n", V_VT(pVarResult));
337     ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
338     ok(pDispParams->rgvarg == NULL, "pDispParams->rgvarg = %p\n", pDispParams->rgvarg);
339     ok(pDispParams->rgdispidNamedArgs == NULL,
340        "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
341     ok(pDispParams->cArgs == 0, "pDispParams->cArgs = %d\n", pDispParams->cArgs);
342     ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
343
344     switch(dispIdMember) {
345     case DISPID_AMBIENT_USERMODE:
346         CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
347         return E_FAIL;
348     case DISPID_AMBIENT_DLCONTROL:
349         CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL);
350         ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
351         return E_FAIL;
352     case DISPID_AMBIENT_USERAGENT:
353        CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
354         ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
355         return E_FAIL;
356     case DISPID_AMBIENT_PALETTE:
357         CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
358         ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
359         return E_FAIL;
360     case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
361         CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
362         ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
363         V_VT(pVarResult) = VT_BOOL;
364         V_BOOL(pVarResult) = VARIANT_FALSE;
365         return S_OK;
366     case DISPID_AMBIENT_SILENT:
367         CHECK_EXPECT(Invoke_AMBIENT_SILENT);
368         ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
369         V_VT(pVarResult) = VT_BOOL;
370         V_BOOL(pVarResult) = VARIANT_FALSE;
371         return S_OK;
372     }
373
374     ok(0, "unexpected dispIdMember %d\n", dispIdMember);
375     return E_NOTIMPL;
376 }
377
378 static IDispatchVtbl DispatchVtbl = {
379     Dispatch_QueryInterface,
380     Dispatch_AddRef,
381     Dispatch_Release,
382     Dispatch_GetTypeInfoCount,
383     Dispatch_GetTypeInfo,
384     Dispatch_GetIDsOfNames,
385     Dispatch_Invoke
386 };
387
388 static IDispatch Dispatch = { &DispatchVtbl };
389
390 static HRESULT WINAPI WebBrowserEvents2_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
391 {
392     *ppv = NULL;
393
394     if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) {
395         *ppv = iface;
396         return S_OK;
397     }
398
399     ok(0, "unexpected riid %s\n", debugstr_guid(riid));
400     return E_NOINTERFACE;
401 }
402
403 #define test_invoke_bool(p) _test_invoke_bool(__LINE__,p)
404 static void _test_invoke_bool(unsigned line, const DISPPARAMS *params)
405 {
406     ok_(__FILE__,line) (params->rgvarg != NULL, "rgvarg == NULL\n");
407     ok_(__FILE__,line) (params->cArgs == 1, "cArgs=%d, expected 1\n", params->cArgs);
408     ok_(__FILE__,line) (V_VT(params->rgvarg) == VT_BOOL, "V_VT(arg)=%d\n", V_VT(params->rgvarg));
409     ok_(__FILE__,line) (V_BOOL(params->rgvarg) == exvb, "V_VT(arg)=%x, expected %x\n",
410                         V_BOOL(params->rgvarg), exvb);
411 }
412
413 static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const VARIANT *flags,
414         const VARIANT *frame, const VARIANT *post_data, const VARIANT *headers, const VARIANT *cancel)
415 {
416     ok(V_VT(disp) == VT_DISPATCH, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp));
417     ok(V_DISPATCH(disp) != NULL, "V_DISPATCH(disp) == NULL\n");
418     ok(V_DISPATCH(disp) == (IDispatch*)wb, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp), wb);
419
420     ok(V_VT(url) == (VT_BYREF|VT_VARIANT), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url));
421     ok(V_VARIANTREF(url) != NULL, "V_VARIANTREF(url) == NULL)\n");
422     if(V_VARIANTREF(url)) {
423         ok(V_VT(V_VARIANTREF(url)) == VT_BSTR, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
424            V_VT(V_VARIANTREF(url)));
425         ok(V_BSTR(V_VARIANTREF(url)) != NULL, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
426         ok(!lstrcmpW(V_BSTR(V_VARIANTREF(url)), about_blankW), "unexpected url %s\n",
427            debugstr_w(V_BSTR(V_VARIANTREF(url))));
428     }
429
430     ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
431        V_VT(flags));
432     ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
433        V_VT(flags));
434     ok(V_VARIANTREF(flags) != NULL, "V_VARIANTREF(flags) == NULL)\n");
435     if(V_VARIANTREF(flags)) {
436         ok(V_VT(V_VARIANTREF(flags)) == VT_I4, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
437            V_VT(V_VARIANTREF(flags)));
438         ok(V_I4(V_VARIANTREF(flags)) == 0, "V_I4(V_VARIANTREF(flags)) = %d, expected 0\n",
439            V_I4(V_VARIANTREF(flags)));
440     }
441
442     ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
443        V_VT(frame));
444     ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
445        V_VT(frame));
446     ok(V_VARIANTREF(frame) != NULL, "V_VARIANTREF(frame) == NULL)\n");
447     if(V_VARIANTREF(frame)) {
448         ok(V_VT(V_VARIANTREF(frame)) == VT_BSTR, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
449            V_VT(V_VARIANTREF(frame)));
450         ok(V_BSTR(V_VARIANTREF(frame)) == NULL, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
451            V_BSTR(V_VARIANTREF(frame)));
452     }
453
454     ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
455        V_VT(post_data));
456     ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
457        V_VT(post_data));
458     ok(V_VARIANTREF(post_data) != NULL, "V_VARIANTREF(post_data) == NULL)\n");
459     if(V_VARIANTREF(post_data)) {
460         ok(V_VT(V_VARIANTREF(post_data)) == (VT_VARIANT|VT_BYREF),
461            "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
462            V_VT(V_VARIANTREF(post_data)));
463         ok(V_VARIANTREF(V_VARIANTREF(post_data)) != NULL,
464            "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
465         if(V_VARIANTREF(V_VARIANTREF(post_data))) {
466             ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == VT_EMPTY,
467                "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
468                V_VT(V_VARIANTREF(V_VARIANTREF(post_data))));
469
470             if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == (VT_UI1|VT_ARRAY)) {
471                 const SAFEARRAY *sa = V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data)));
472
473                 ok(sa->cDims == 1, "sa->cDims = %d, expected 1\n", sa->cDims);
474                 ok(sa->fFeatures == 0, "sa->fFeatures = %d, expected 0\n", sa->fFeatures);
475             }
476         }
477     }
478
479     ok(V_VT(headers) == (VT_BYREF|VT_VARIANT), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
480        V_VT(headers));
481     ok(V_VARIANTREF(headers) != NULL, "V_VARIANTREF(headers) == NULL)\n");
482     if(V_VARIANTREF(headers)) {
483         ok(V_VT(V_VARIANTREF(headers)) == VT_BSTR, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
484            V_VT(V_VARIANTREF(headers)));
485         ok(V_BSTR(V_VARIANTREF(headers)) == NULL, "V_BSTR(V_VARIANTREF(heders)) = %p, expected NULL\n",
486            V_BSTR(V_VARIANTREF(headers)));
487     }
488
489     ok(V_VT(cancel) == (VT_BYREF|VT_BOOL), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
490        V_VT(cancel));
491     ok(V_BOOLREF(cancel) != NULL, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
492     if(V_BOOLREF(cancel))
493         ok(*V_BOOLREF(cancel) == VARIANT_FALSE, "*V_BOOLREF(calcel) = %x, expected VARIANT_FALSE\n",
494            *V_BOOLREF(cancel));
495 }
496
497 static HRESULT WINAPI WebBrowserEvents2_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
498         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
499         EXCEPINFO *pExcepInfo, UINT *puArgErr)
500 {
501     ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
502     ok(pDispParams != NULL, "pDispParams == NULL\n");
503     ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
504     ok(pVarResult == NULL, "pVarResult=%p\n", pVarResult);
505     ok(wFlags == DISPATCH_METHOD, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags);
506     ok(pDispParams->rgdispidNamedArgs == NULL,
507        "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
508     ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
509
510     switch(dispIdMember) {
511     case DISPID_STATUSTEXTCHANGE:
512         CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE);
513
514         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
515         ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
516         ok(V_VT(pDispParams->rgvarg) == VT_BSTR, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
517            V_VT(pDispParams->rgvarg));
518         /* TODO: Check text */
519         break;
520
521     case DISPID_PROPERTYCHANGE:
522         CHECK_EXPECT2(Invoke_PROPERTYCHANGE);
523
524         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
525         ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
526         /* TODO: Check args */
527         break;
528
529     case DISPID_DOWNLOADBEGIN:
530         CHECK_EXPECT(Invoke_DOWNLOADBEGIN);
531
532         ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
533         ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
534         break;
535
536     case DISPID_BEFORENAVIGATE2:
537         CHECK_EXPECT(Invoke_BEFORENAVIGATE2);
538
539         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
540         ok(pDispParams->cArgs == 7, "cArgs=%d, expected 7\n", pDispParams->cArgs);
541         test_OnBeforeNavigate(pDispParams->rgvarg+6, pDispParams->rgvarg+5, pDispParams->rgvarg+4,
542                               pDispParams->rgvarg+3, pDispParams->rgvarg+2, pDispParams->rgvarg+1,
543                               pDispParams->rgvarg);
544         break;
545
546     case DISPID_SETSECURELOCKICON:
547         CHECK_EXPECT(Invoke_SETSECURELOCKICON);
548
549         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
550         ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
551         /* TODO: Check args */
552         break;
553
554     case DISPID_FILEDOWNLOAD:
555         CHECK_EXPECT(Invoke_FILEDOWNLOAD);
556
557         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
558         ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
559         /* TODO: Check args */
560         break;
561
562     case DISPID_COMMANDSTATECHANGE:
563         CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE);
564
565         ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
566         ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
567         /* TODO: Check args */
568         break;
569
570     case DISPID_DOWNLOADCOMPLETE:
571         CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE);
572
573         ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
574         ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
575         break;
576
577     case DISPID_ONMENUBAR:
578         CHECK_EXPECT(Invoke_ONMENUBAR);
579         test_invoke_bool(pDispParams);
580         break;
581
582     case DISPID_ONADDRESSBAR:
583         CHECK_EXPECT(Invoke_ONADDRESSBAR);
584         test_invoke_bool(pDispParams);
585         break;
586
587     case DISPID_ONSTATUSBAR:
588         CHECK_EXPECT(Invoke_ONSTATUSBAR);
589         test_invoke_bool(pDispParams);
590         break;
591
592     case DISPID_ONTOOLBAR:
593         CHECK_EXPECT(Invoke_ONTOOLBAR);
594         test_invoke_bool(pDispParams);
595         break;
596
597     case DISPID_ONFULLSCREEN:
598         CHECK_EXPECT(Invoke_ONFULLSCREEN);
599         test_invoke_bool(pDispParams);
600         break;
601
602     case DISPID_WINDOWSETRESIZABLE:
603         CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE);
604         test_invoke_bool(pDispParams);
605         break;
606
607     default:
608         ok(0, "unexpected dispIdMember %d\n", dispIdMember);
609     }
610
611     return S_OK;
612 }
613
614 static IDispatchVtbl WebBrowserEvents2Vtbl = {
615     WebBrowserEvents2_QueryInterface,
616     Dispatch_AddRef,
617     Dispatch_Release,
618     Dispatch_GetTypeInfoCount,
619     Dispatch_GetTypeInfo,
620     Dispatch_GetIDsOfNames,
621     WebBrowserEvents2_Invoke
622 };
623
624 static IDispatch WebBrowserEvents2 = { &WebBrowserEvents2Vtbl };
625
626 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
627 {
628     return QueryInterface(riid, ppv);
629 }
630
631 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
632 {
633     return 2;
634 }
635
636 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
637 {
638     return 1;
639 }
640
641 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
642 {
643     ok(0, "unexpected call\n");
644     return E_NOTIMPL;
645 }
646
647 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAsign, DWORD dwWhichMoniker,
648         IMoniker **ppmon)
649 {
650     ok(0, "unexpected call\n");
651     return E_NOTIMPL;
652 }
653
654 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
655 {
656     CHECK_EXPECT(GetContainer);
657
658     ok(ppContainer != NULL, "ppContainer == NULL\n");
659     if(ppContainer)
660         *ppContainer = &OleContainer;
661
662     return S_OK;
663 }
664
665 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
666 {
667     CHECK_EXPECT(ShowObject);
668     return S_OK;
669 }
670
671 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
672 {
673     ok(0, "unexpected call\n");
674     return E_NOTIMPL;
675 }
676
677 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
678 {
679     ok(0, "unexpected call\n");
680     return E_NOTIMPL;
681 }
682
683 static const IOleClientSiteVtbl ClientSiteVtbl = {
684     ClientSite_QueryInterface,
685     ClientSite_AddRef,
686     ClientSite_Release,
687     ClientSite_SaveObject,
688     ClientSite_GetMoniker,
689     ClientSite_GetContainer,
690     ClientSite_ShowObject,
691     ClientSite_OnShowWindow,
692     ClientSite_RequestNewObjectLayout
693 };
694
695 static IOleClientSite ClientSite = { &ClientSiteVtbl };
696
697 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceFrame *iface,
698                                                      REFIID riid, void **ppv)
699 {
700     ok(0, "unexpected call\n");
701     return E_NOINTERFACE;
702 }
703
704 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceFrame *iface)
705 {
706     return 2;
707 }
708
709 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceFrame *iface)
710 {
711     return 1;
712 }
713
714 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
715 {
716     ok(0, "unexpected call\n");
717     return E_NOTIMPL;
718 }
719
720 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
721 {
722     CHECK_EXPECT(Frame_GetWindow);
723     ok(phwnd != NULL, "phwnd == NULL\n");
724     if(phwnd)
725         *phwnd = container_hwnd;
726     return S_OK;
727 }
728
729 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
730 {
731     ok(0, "unexpected call\n");
732     return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
736 {
737     ok(0, "unexpected call\n");
738     return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame *iface,
742         LPCBORDERWIDTHS pborderwidths)
743 {
744     ok(0, "unexpected call\n");
745     return E_NOTIMPL;
746 }
747
748 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame *iface,
749         LPCBORDERWIDTHS pborderwidths)
750 {
751     ok(0, "unexpected call\n");
752     return E_NOTIMPL;
753 }
754
755 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
756         IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
757 {
758     CHECK_EXPECT(UIWindow_SetActiveObject);
759     ok(pActiveObject != NULL, "pActiveObject = NULL\n");
760     ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
761     return S_OK;
762 }
763
764 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
765         IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
766 {
767     CHECK_EXPECT(Frame_SetActiveObject);
768     ok(pActiveObject != NULL, "pActiveObject = NULL\n");
769     ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
770     return S_OK;
771 }
772
773 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
774         LPOLEMENUGROUPWIDTHS lpMenuWidths)
775 {
776     ok(0, "unexpected call\n");
777     return E_NOTIMPL;
778 }
779
780 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
781         HOLEMENU holemenu, HWND hwndActiveObject)
782 {
783     CHECK_EXPECT(SetMenu);
784     ok(hmenuShared == NULL, "hmenuShared=%p\n", hmenuShared);
785     ok(holemenu == NULL, "holemenu=%p\n", holemenu);
786     ok(hwndActiveObject == shell_embedding_hwnd, "hwndActiveObject=%p, expected %p\n",
787        hwndActiveObject, shell_embedding_hwnd);
788     return S_OK;
789 }
790
791 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
792 {
793     ok(0, "unexpected call\n");
794     return E_NOTIMPL;
795 }
796
797 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
798 {
799     CHECK_EXPECT2(SetStatusText);
800     /* FIXME: Check pszStatusText */
801     return S_OK;
802 }
803
804 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
805 {
806     if(fEnable)
807         CHECK_EXPECT(EnableModeless_TRUE);
808     else
809         CHECK_EXPECT(EnableModeless_FALSE);
810     return S_OK;
811 }
812
813 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
814 {
815     ok(0, "unexpected call\n");
816     return E_NOTIMPL;
817 }
818
819 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
820     InPlaceUIWindow_QueryInterface,
821     InPlaceUIWindow_AddRef,
822     InPlaceUIWindow_Release,
823     InPlaceUIWindow_GetWindow,
824     InPlaceUIWindow_ContextSensitiveHelp,
825     InPlaceUIWindow_GetBorder,
826     InPlaceUIWindow_RequestBorderSpace,
827     InPlaceUIWindow_SetBorderSpace,
828     InPlaceUIWindow_SetActiveObject,
829 };
830
831 static IOleInPlaceUIWindow InPlaceUIWindow = { (IOleInPlaceUIWindowVtbl*)&InPlaceUIWindowVtbl };
832
833 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
834     InPlaceUIWindow_QueryInterface,
835     InPlaceUIWindow_AddRef,
836     InPlaceUIWindow_Release,
837     InPlaceFrame_GetWindow,
838     InPlaceUIWindow_ContextSensitiveHelp,
839     InPlaceUIWindow_GetBorder,
840     InPlaceUIWindow_RequestBorderSpace,
841     InPlaceUIWindow_SetBorderSpace,
842     InPlaceFrame_SetActiveObject,
843     InPlaceFrame_InsertMenus,
844     InPlaceFrame_SetMenu,
845     InPlaceFrame_RemoveMenus,
846     InPlaceFrame_SetStatusText,
847     InPlaceFrame_EnableModeless,
848     InPlaceFrame_TranslateAccelerator
849 };
850
851 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
852
853 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
854 {
855     return QueryInterface(riid, ppv);
856 }
857
858 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
859 {
860     return 2;
861 }
862
863 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
864 {
865     return 1;
866 }
867
868 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
869 {
870     CHECK_EXPECT(Site_GetWindow);
871     ok(phwnd != NULL, "phwnd == NULL\n");
872     if(phwnd)
873         *phwnd = container_hwnd;
874     return S_OK;
875 }
876
877 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
878 {
879     ok(0, "unexpected call\n");
880     return E_NOTIMPL;
881 }
882
883 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
884 {
885     CHECK_EXPECT(CanInPlaceActivate);
886     return S_OK;
887 }
888
889 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
890 {
891     CHECK_EXPECT(OnInPlaceActivate);
892     return S_OK;
893 }
894
895 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
896 {
897     CHECK_EXPECT(OnUIActivate);
898     return S_OK;
899 }
900
901 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
902         IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
903         LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
904 {
905     static const RECT pos_rect = {2,1,1002,901};
906     static const RECT clip_rect = {10,10,990,890};
907
908     CHECK_EXPECT(GetWindowContext);
909
910     ok(ppFrame != NULL, "ppFrame = NULL\n");
911     if(ppFrame)
912         *ppFrame = &InPlaceFrame;
913
914     ok(ppDoc != NULL, "ppDoc = NULL\n");
915     if(ppDoc)
916         *ppDoc = &InPlaceUIWindow;
917
918     ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
919     if(lprcPosRect)
920         memcpy(lprcPosRect, &pos_rect, sizeof(RECT));
921
922     ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
923     if(lprcClipRect)
924         memcpy(lprcClipRect, &clip_rect, sizeof(RECT));
925
926     ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
927     if(lpFrameInfo) {
928         lpFrameInfo->cb = sizeof(*lpFrameInfo);
929         lpFrameInfo->fMDIApp = FALSE;
930         lpFrameInfo->hwndFrame = container_hwnd;
931         lpFrameInfo->haccel = NULL;
932         lpFrameInfo->cAccelEntries = 0;
933     }
934
935     return S_OK;
936 }
937
938 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtant)
939 {
940     ok(0, "unexpected call\n");
941     return E_NOTIMPL;
942 }
943
944 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
945 {
946     ok(0, "unexpected call\n");
947     return E_NOTIMPL;
948 }
949
950 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
951 {
952     ok(0, "unexpected call\n");
953     return E_NOTIMPL;
954 }
955
956 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
957 {
958     ok(0, "unexpected call\n");
959     return E_NOTIMPL;
960 }
961
962 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
963 {
964     ok(0, "unexpected call\n");
965     return E_NOTIMPL;
966 }
967
968 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface, LPCRECT lprcPosRect)
969 {
970     ok(0, "unexpected call\n");
971     return E_NOTIMPL;
972 }
973
974 static HRESULT WINAPI InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface,
975                                                       BOOL *pNoRedraw, DWORD dwFlags)
976 {
977     ok(0, "unexpected call\n");
978     return E_NOTIMPL;
979 }
980
981 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface,
982                                                         BOOL fNoRedraw)
983 {
984     ok(0, "unexpected call\n");
985     return E_NOTIMPL;
986 }
987
988 static HRESULT WINAPI InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx *iface)
989 {
990     ok(0, "unexpected call\n");
991     return S_OK;
992 }
993
994 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl = {
995     InPlaceSite_QueryInterface,
996     InPlaceSite_AddRef,
997     InPlaceSite_Release,
998     InPlaceSite_GetWindow,
999     InPlaceSite_ContextSensitiveHelp,
1000     InPlaceSite_CanInPlaceActivate,
1001     InPlaceSite_OnInPlaceActivate,
1002     InPlaceSite_OnUIActivate,
1003     InPlaceSite_GetWindowContext,
1004     InPlaceSite_Scroll,
1005     InPlaceSite_OnUIDeactivate,
1006     InPlaceSite_OnInPlaceDeactivate,
1007     InPlaceSite_DiscardUndoState,
1008     InPlaceSite_DeactivateAndUndo,
1009     InPlaceSite_OnPosRectChange,
1010     InPlaceSite_OnInPlaceActivateEx,
1011     InPlaceSite_OnInPlaceDeactivateEx,
1012     InPlaceSite_RequestUIActivate
1013 };
1014
1015 static IOleInPlaceSiteEx InPlaceSite = { &InPlaceSiteExVtbl };
1016
1017 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
1018 {
1019     return QueryInterface(riid, ppv);
1020 }
1021
1022 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
1023 {
1024     return 2;
1025 }
1026
1027 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
1028 {
1029     return 1;
1030 }
1031
1032 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
1033         IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
1034 {
1035     ok(0, "unexpected call %d %p %p %p\n", dwID, ppt, pcmdtReserved, pdicpReserved);
1036     return S_FALSE;
1037 }
1038
1039 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
1040 {
1041     CHECK_EXPECT(GetHostInfo);
1042     ok(pInfo != NULL, "pInfo=NULL\n");
1043     if(pInfo) {
1044         ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
1045         ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
1046         ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
1047         ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
1048         ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
1049     }
1050     return E_FAIL;
1051 }
1052
1053 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
1054         IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
1055         IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
1056 {
1057     ok(0, "unexpected call\n");
1058     return E_NOTIMPL;
1059 }
1060
1061 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
1062 {
1063     ok(0, "unexpected call\n");
1064     return E_NOTIMPL;
1065 }
1066
1067 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
1068 {
1069     CHECK_EXPECT(UpdateUI);
1070     return E_NOTIMPL;
1071 }
1072
1073 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
1074 {
1075     ok(0, "unexpected call\n");
1076     return E_NOTIMPL;
1077 }
1078
1079 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1080 {
1081     ok(0, "unexpected call\n");
1082     return E_NOTIMPL;
1083 }
1084
1085 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1086 {
1087     ok(0, "unexpected call\n");
1088     return E_NOTIMPL;
1089 }
1090
1091 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
1092         IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
1093 {
1094     ok(0, "unexpected call\n");
1095     return E_NOTIMPL;
1096 }
1097
1098 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
1099         const GUID *pguidCmdGroup, DWORD nCmdID)
1100 {
1101     ok(0, "unexpected call\n");
1102     return E_NOTIMPL;
1103 }
1104
1105 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
1106         LPOLESTR *pchKey, DWORD dw)
1107 {
1108     CHECK_EXPECT(GetOptionKeyPath);
1109     ok(pchKey != NULL, "pchKey==NULL\n");
1110     if(pchKey)
1111         ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1112     ok(!dw, "dw=%x\n", dw);
1113     return E_NOTIMPL;
1114 }
1115
1116 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
1117         IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
1118 {
1119     ok(0, "unexpected call\n");
1120     return E_NOTIMPL;
1121 }
1122
1123 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
1124 {
1125     ok(0, "unexpected call\n");
1126     return E_NOTIMPL;
1127 }
1128
1129 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
1130         OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
1131 {
1132     ok(0, "unexpected call\n");
1133     return E_NOTIMPL;
1134 }
1135
1136 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
1137         IDataObject **ppPORet)
1138 {
1139     ok(0, "unexpected call\n");
1140     return E_NOTIMPL;
1141 }
1142
1143 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
1144         LPOLESTR *pchKey, DWORD dw)
1145 {
1146     CHECK_EXPECT(GetOverridesKeyPath);
1147     ok(pchKey != NULL, "pchKey==NULL\n");
1148     if(pchKey)
1149         ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1150     ok(!dw, "dw=%x\n", dw);
1151     return E_NOTIMPL;
1152 }
1153
1154 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
1155     DocHostUIHandler_QueryInterface,
1156     DocHostUIHandler_AddRef,
1157     DocHostUIHandler_Release,
1158     DocHostUIHandler_ShowContextMenu,
1159     DocHostUIHandler_GetHostInfo,
1160     DocHostUIHandler_ShowUI,
1161     DocHostUIHandler_HideUI,
1162     DocHostUIHandler_UpdateUI,
1163     DocHostUIHandler_EnableModeless,
1164     DocHostUIHandler_OnDocWindowActivate,
1165     DocHostUIHandler_OnFrameWindowActivate,
1166     DocHostUIHandler_ResizeBorder,
1167     DocHostUIHandler_TranslateAccelerator,
1168     DocHostUIHandler_GetOptionKeyPath,
1169     DocHostUIHandler_GetDropTarget,
1170     DocHostUIHandler_GetExternal,
1171     DocHostUIHandler_TranslateUrl,
1172     DocHostUIHandler_FilterDataObject,
1173     DocHostUIHandler_GetOverrideKeyPath
1174 };
1175
1176 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
1177
1178 static HRESULT QueryInterface(REFIID riid, void **ppv)
1179 {
1180     *ppv = NULL;
1181
1182     if(IsEqualGUID(&IID_IUnknown, riid)
1183             || IsEqualGUID(&IID_IOleClientSite, riid))
1184         *ppv = &ClientSite;
1185     else if(IsEqualGUID(&IID_IOleWindow, riid)
1186             || IsEqualGUID(&IID_IOleInPlaceSite, riid)
1187             || IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
1188         *ppv = &InPlaceSite;
1189     else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)
1190             || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
1191         *ppv = &DocHostUIHandler;
1192     else if(IsEqualGUID(&IID_IDispatch, riid))
1193         *ppv = &Dispatch;
1194
1195     if(*ppv)
1196         return S_OK;
1197
1198     return E_NOINTERFACE;
1199 }
1200
1201 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1202 {
1203     return DefWindowProcW(hwnd, msg, wParam, lParam);
1204 }
1205
1206 static HWND create_container_window(void)
1207 {
1208     static const WCHAR wszWebBrowserContainer[] =
1209         {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1210     static WNDCLASSEXW wndclass = {
1211         sizeof(WNDCLASSEXW),
1212         0,
1213         wnd_proc,
1214         0, 0, NULL, NULL, NULL, NULL, NULL,
1215         wszWebBrowserContainer,
1216         NULL
1217     };
1218
1219     RegisterClassExW(&wndclass);
1220     return CreateWindowW(wszWebBrowserContainer, wszWebBrowserContainer,
1221             WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
1222             CW_USEDEFAULT, NULL, NULL, NULL, NULL);
1223 }
1224
1225 static void test_DoVerb(IUnknown *unk)
1226 {
1227     IOleObject *oleobj;
1228     RECT rect = {0,0,1000,1000};
1229     HRESULT hres;
1230
1231     hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1232     ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1233     if(FAILED(hres))
1234         return;
1235
1236     SET_EXPECT(CanInPlaceActivate);
1237     SET_EXPECT(Site_GetWindow);
1238     SET_EXPECT(OnInPlaceActivate);
1239     SET_EXPECT(GetWindowContext);
1240     SET_EXPECT(ShowObject);
1241     SET_EXPECT(GetContainer);
1242     SET_EXPECT(Frame_GetWindow);
1243     SET_EXPECT(OnUIActivate);
1244     SET_EXPECT(Frame_SetActiveObject);
1245     SET_EXPECT(UIWindow_SetActiveObject);
1246     SET_EXPECT(SetMenu);
1247
1248     hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1249                              0, (HWND)0xdeadbeef, &rect);
1250     ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1251
1252     CHECK_CALLED(CanInPlaceActivate);
1253     CHECK_CALLED(Site_GetWindow);
1254     CHECK_CALLED(OnInPlaceActivate);
1255     CHECK_CALLED(GetWindowContext);
1256     CHECK_CALLED(ShowObject);
1257     CHECK_CALLED(GetContainer);
1258     CHECK_CALLED(Frame_GetWindow);
1259     CHECK_CALLED(OnUIActivate);
1260     CHECK_CALLED(Frame_SetActiveObject);
1261     CHECK_CALLED(UIWindow_SetActiveObject);
1262     CHECK_CALLED(SetMenu);
1263
1264     hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1265                            0, (HWND)0xdeadbeef, &rect);
1266     ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1267
1268     IOleObject_Release(oleobj);
1269 }
1270
1271 static void test_GetMiscStatus(IOleObject *oleobj)
1272 {
1273     DWORD st, i;
1274     HRESULT hres;
1275
1276     for(i=0; i<10; i++) {
1277         st = 0xdeadbeef;
1278         hres = IOleObject_GetMiscStatus(oleobj, i, &st);
1279         ok(hres == S_OK, "GetMiscStatus failed: %08x\n", hres);
1280         ok(st == (OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
1281                   |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE),
1282            "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1283            "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st);
1284     }
1285 }
1286
1287 static void test_SetHostNames(IOleObject *oleobj)
1288 {
1289     HRESULT hres;
1290
1291     static const WCHAR test_appW[] =  {'t','e','s','t',' ','a','p','p',0};
1292
1293     hres = IOleObject_SetHostNames(oleobj, test_appW, (void*)0xdeadbeef);
1294     ok(hres == S_OK, "SetHostNames failed: %08x\n", hres);
1295 }
1296
1297 static void test_ClientSite(IUnknown *unk, IOleClientSite *client)
1298 {
1299     IOleObject *oleobj;
1300     IOleInPlaceObject *inplace;
1301     HWND hwnd;
1302     HRESULT hres;
1303
1304     hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1305     ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1306     if(FAILED(hres))
1307         return;
1308
1309     test_GetMiscStatus(oleobj);
1310     test_SetHostNames(oleobj);
1311
1312     hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObject, (void**)&inplace);
1313     ok(hres == S_OK, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres);
1314     if(FAILED(hres)) {
1315         IOleObject_Release(oleobj);
1316         return;
1317     }
1318
1319     hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1320     ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1321     ok((hwnd == NULL) ^ (client == NULL), "unexpected hwnd %p\n", hwnd);
1322
1323     if(client) {
1324         SET_EXPECT(GetContainer);
1325         SET_EXPECT(Site_GetWindow);
1326         SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1327         SET_EXPECT(Invoke_AMBIENT_SILENT);
1328     }else {
1329         SET_EXPECT(Invoke_DOWNLOADCOMPLETE);
1330         SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1331         SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1332     }
1333
1334     hres = IOleObject_SetClientSite(oleobj, client);
1335     ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
1336
1337     if(client) {
1338         CHECK_CALLED(GetContainer);
1339         CHECK_CALLED(Site_GetWindow);
1340         CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1341         CHECK_CALLED(Invoke_AMBIENT_SILENT);
1342     }else {
1343         todo_wine CHECK_CALLED(Invoke_DOWNLOADCOMPLETE);
1344         todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1345         todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1346    }
1347
1348     hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1349     ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1350     ok((hwnd == NULL) == (client == NULL), "unexpected hwnd %p\n", hwnd);
1351
1352     shell_embedding_hwnd = hwnd;
1353
1354     test_SetHostNames(oleobj);
1355
1356     IOleInPlaceObject_Release(inplace);
1357     IOleObject_Release(oleobj);
1358 }
1359
1360 static void test_ClassInfo(IUnknown *unk)
1361 {
1362     IProvideClassInfo2 *class_info;
1363     GUID guid;
1364     HRESULT hres;
1365
1366     hres = IUnknown_QueryInterface(unk, &IID_IProvideClassInfo2, (void**)&class_info);
1367     ok(hres == S_OK, "QueryInterface(IID_IProvideClassInfo)  failed: %08x\n", hres);
1368     if(FAILED(hres))
1369         return;
1370
1371     hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid);
1372     ok(hres == S_OK, "GetGUID failed: %08x\n", hres);
1373     ok(IsEqualGUID(&DIID_DWebBrowserEvents2, &guid), "wrong guid\n");
1374
1375     hres = IProvideClassInfo2_GetGUID(class_info, 0, &guid);
1376     ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1377     ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1378
1379     hres = IProvideClassInfo2_GetGUID(class_info, 2, &guid);
1380     ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1381     ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1382
1383     hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, NULL);
1384     ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1385
1386     hres = IProvideClassInfo2_GetGUID(class_info, 0, NULL);
1387     ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1388
1389     IProvideClassInfo2_Release(class_info);
1390 }
1391
1392 static void test_ie_funcs(IUnknown *unk)
1393 {
1394     IWebBrowser2 *wb;
1395     IDispatch *disp;
1396     VARIANT_BOOL b;
1397     int i;
1398     long hwnd;
1399     HRESULT hres;
1400
1401     hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1402     ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1403     if(FAILED(hres))
1404         return;
1405
1406     /* HWND */
1407
1408     hwnd = 0xdeadbeef;
1409     hres = IWebBrowser2_get_HWND(wb, &hwnd);
1410     ok(hres == E_FAIL, "get_HWND failed: %08x, expected E_FAIL\n", hres);
1411     ok(hwnd == 0, "unexpected hwnd %lx\n", hwnd);
1412
1413     /* MenuBar */
1414
1415     hres = IWebBrowser2_get_MenuBar(wb, &b);
1416     ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1417     ok(b == VARIANT_TRUE, "b=%x\n", b);
1418
1419     SET_EXPECT(Invoke_ONMENUBAR);
1420     hres = IWebBrowser2_put_MenuBar(wb, (exvb = VARIANT_FALSE));
1421     ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1422     CHECK_CALLED(Invoke_ONMENUBAR);
1423
1424     hres = IWebBrowser2_get_MenuBar(wb, &b);
1425     ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1426     ok(b == VARIANT_FALSE, "b=%x\n", b);
1427
1428     SET_EXPECT(Invoke_ONMENUBAR);
1429     hres = IWebBrowser2_put_MenuBar(wb, (exvb = 100));
1430     ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1431     CHECK_CALLED(Invoke_ONMENUBAR);
1432
1433     hres = IWebBrowser2_get_MenuBar(wb, &b);
1434     ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1435     ok(b == VARIANT_TRUE, "b=%x\n", b);
1436
1437     /* AddressBar */
1438
1439     hres = IWebBrowser2_get_AddressBar(wb, &b);
1440     ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1441     ok(b == VARIANT_TRUE, "b=%x\n", b);
1442
1443     SET_EXPECT(Invoke_ONADDRESSBAR);
1444     hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_FALSE));
1445     ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1446     CHECK_CALLED(Invoke_ONADDRESSBAR);
1447
1448     hres = IWebBrowser2_get_AddressBar(wb, &b);
1449     ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1450     ok(b == VARIANT_FALSE, "b=%x\n", b);
1451
1452     SET_EXPECT(Invoke_ONADDRESSBAR);
1453     hres = IWebBrowser2_put_AddressBar(wb, (exvb = 100));
1454     ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1455     CHECK_CALLED(Invoke_ONADDRESSBAR);
1456
1457     hres = IWebBrowser2_get_AddressBar(wb, &b);
1458     ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1459     ok(b == VARIANT_TRUE, "b=%x\n", b);
1460
1461     SET_EXPECT(Invoke_ONADDRESSBAR);
1462     hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_TRUE));
1463     ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1464     CHECK_CALLED(Invoke_ONADDRESSBAR);
1465
1466     /* StatusBar */
1467
1468     hres = IWebBrowser2_get_StatusBar(wb, &b);
1469     ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1470     ok(b == VARIANT_TRUE, "b=%x\n", b);
1471
1472     SET_EXPECT(Invoke_ONSTATUSBAR);
1473     hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_TRUE));
1474     ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1475     CHECK_CALLED(Invoke_ONSTATUSBAR);
1476
1477     hres = IWebBrowser2_get_StatusBar(wb, &b);
1478     ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1479     ok(b == VARIANT_TRUE, "b=%x\n", b);
1480
1481     SET_EXPECT(Invoke_ONSTATUSBAR);
1482     hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_FALSE));
1483     ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1484     CHECK_CALLED(Invoke_ONSTATUSBAR);
1485
1486     hres = IWebBrowser2_get_StatusBar(wb, &b);
1487     ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1488     ok(b == VARIANT_FALSE, "b=%x\n", b);
1489
1490     SET_EXPECT(Invoke_ONSTATUSBAR);
1491     hres = IWebBrowser2_put_StatusBar(wb, (exvb = 100));
1492     ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1493     CHECK_CALLED(Invoke_ONSTATUSBAR);
1494
1495     hres = IWebBrowser2_get_StatusBar(wb, &b);
1496     ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1497     ok(b == VARIANT_TRUE, "b=%x\n", b);
1498
1499     /* ToolBar */
1500
1501     hres = IWebBrowser2_get_ToolBar(wb, &i);
1502     ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1503     ok(i, "i=%x\n", i);
1504
1505     SET_EXPECT(Invoke_ONTOOLBAR);
1506     hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_FALSE));
1507     ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1508     CHECK_CALLED(Invoke_ONTOOLBAR);
1509
1510     hres = IWebBrowser2_get_ToolBar(wb, &i);
1511     ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1512     ok(i == VARIANT_FALSE, "b=%x\n", i);
1513
1514     SET_EXPECT(Invoke_ONTOOLBAR);
1515     hres = IWebBrowser2_put_ToolBar(wb, (exvb = 100));
1516     ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1517     CHECK_CALLED(Invoke_ONTOOLBAR);
1518
1519     hres = IWebBrowser2_get_ToolBar(wb, &i);
1520     ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1521     ok(i, "i=%x\n", i);
1522
1523     SET_EXPECT(Invoke_ONTOOLBAR);
1524     hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_TRUE));
1525     ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1526     CHECK_CALLED(Invoke_ONTOOLBAR);
1527
1528     /* FullScreen */
1529
1530     hres = IWebBrowser2_get_FullScreen(wb, &b);
1531     ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1532     ok(b == VARIANT_FALSE, "b=%x\n", b);
1533
1534     SET_EXPECT(Invoke_ONFULLSCREEN);
1535     hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_TRUE));
1536     ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1537     CHECK_CALLED(Invoke_ONFULLSCREEN);
1538
1539     hres = IWebBrowser2_get_FullScreen(wb, &b);
1540     ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1541     ok(b == VARIANT_TRUE, "b=%x\n", b);
1542
1543     SET_EXPECT(Invoke_ONFULLSCREEN);
1544     hres = IWebBrowser2_put_FullScreen(wb, (exvb = 100));
1545     ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1546     CHECK_CALLED(Invoke_ONFULLSCREEN);
1547
1548     hres = IWebBrowser2_get_FullScreen(wb, &b);
1549     ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1550     ok(b == VARIANT_TRUE, "b=%x\n", b);
1551
1552     SET_EXPECT(Invoke_ONFULLSCREEN);
1553     hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_FALSE));
1554     ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1555     CHECK_CALLED(Invoke_ONFULLSCREEN);
1556
1557     /* Resizable */
1558
1559     b = 0x100;
1560     hres = IWebBrowser2_get_Resizable(wb, &b);
1561     ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1562     ok(b == 0x100, "b=%x\n", b);
1563
1564     SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1565     hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_TRUE));
1566     ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1567     CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1568
1569     SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1570     hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_FALSE));
1571     ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1572     CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1573
1574     hres = IWebBrowser2_get_Resizable(wb, &b);
1575     ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1576     ok(b == 0x100, "b=%x\n", b);
1577
1578     /* Application */
1579
1580     disp = NULL;
1581     hres = IWebBrowser2_get_Application(wb, &disp);
1582     ok(hres == S_OK, "get_Application failed: %08x\n", hres);
1583     ok(disp == (void*)wb, "disp=%p, expected %p\n", disp, wb);
1584     if(disp)
1585         IDispatch_Release(disp);
1586
1587     hres = IWebBrowser2_get_Application(wb, NULL);
1588     ok(hres == E_POINTER, "get_Application failed: %08x, expected E_POINTER\n", hres);
1589
1590     /* Quit */
1591
1592     hres = IWebBrowser2_Quit(wb);
1593     ok(hres == E_FAIL, "Quit failed: %08x, expected E_FAIL\n", hres);
1594
1595     IWebBrowser2_Release(wb);
1596 }
1597
1598 static void test_Silent(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1599 {
1600     VARIANT_BOOL b;
1601     HRESULT hres;
1602
1603     b = 100;
1604     hres = IWebBrowser2_get_Silent(wb, &b);
1605     ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1606     ok(b == VARIANT_FALSE, "b=%x\n", b);
1607
1608     hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1609     ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1610
1611     b = 100;
1612     hres = IWebBrowser2_get_Silent(wb, &b);
1613     ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1614     ok(b == VARIANT_TRUE, "b=%x\n", b);
1615
1616     hres = IWebBrowser2_put_Silent(wb, 100);
1617     ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1618
1619     b = 100;
1620     hres = IWebBrowser2_get_Silent(wb, &b);
1621     ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1622     ok(b == VARIANT_TRUE, "b=%x\n", b);
1623
1624     hres = IWebBrowser2_put_Silent(wb, VARIANT_FALSE);
1625     ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1626
1627     b = 100;
1628     hres = IWebBrowser2_get_Silent(wb, &b);
1629     ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1630     ok(b == VARIANT_FALSE, "b=%x\n", b);
1631
1632     if(is_clientsite) {
1633         hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1634         ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1635
1636         SET_EXPECT(Invoke_AMBIENT_SILENT);
1637     }
1638
1639     hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
1640     ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1641
1642     if(is_clientsite)
1643         CHECK_CALLED(Invoke_AMBIENT_SILENT);
1644
1645     b = 100;
1646     hres = IWebBrowser2_get_Silent(wb, &b);
1647     ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1648     ok(b == VARIANT_FALSE, "b=%x\n", b);
1649 }
1650
1651 static void test_Offline(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1652 {
1653     VARIANT_BOOL b;
1654     HRESULT hres;
1655
1656     b = 100;
1657     hres = IWebBrowser2_get_Offline(wb, &b);
1658     ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1659     ok(b == VARIANT_FALSE, "b=%x\n", b);
1660
1661     hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1662     ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1663
1664     b = 100;
1665     hres = IWebBrowser2_get_Offline(wb, &b);
1666     ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1667     ok(b == VARIANT_TRUE, "b=%x\n", b);
1668
1669     hres = IWebBrowser2_put_Offline(wb, 100);
1670     ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1671
1672     b = 100;
1673     hres = IWebBrowser2_get_Offline(wb, &b);
1674     ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1675     ok(b == VARIANT_TRUE, "b=%x\n", b);
1676
1677     hres = IWebBrowser2_put_Offline(wb, VARIANT_FALSE);
1678     ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1679
1680     b = 100;
1681     hres = IWebBrowser2_get_Offline(wb, &b);
1682     ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1683     ok(b == VARIANT_FALSE, "b=%x\n", b);
1684
1685     if(is_clientsite) {
1686         hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1687         ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1688
1689         SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1690     }
1691
1692     hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
1693     ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1694
1695     if(is_clientsite)
1696         CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1697
1698     b = 100;
1699     hres = IWebBrowser2_get_Offline(wb, &b);
1700     ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1701     ok(b == VARIANT_FALSE, "b=%x\n", b);
1702 }
1703
1704 static void test_wb_funcs(IUnknown *unk, BOOL is_clientsite)
1705 {
1706     IWebBrowser2 *wb;
1707     IOleControl *control;
1708     HRESULT hres;
1709
1710     hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1711     ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1712
1713     hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1714     ok(hres == S_OK, "Could not get IOleControl interface: %08x\n", hres);
1715
1716     test_Silent(wb, control, is_clientsite);
1717     test_Offline(wb, control, is_clientsite);
1718
1719     IWebBrowser_Release(wb);
1720     IOleControl_Release(control);
1721 }
1722
1723 static void test_GetControlInfo(IUnknown *unk)
1724 {
1725     IOleControl *control;
1726     CONTROLINFO info;
1727     HRESULT hres;
1728
1729     hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1730     ok(hres == S_OK, "Could not get IOleControl: %08x\n", hres);
1731     if(FAILED(hres))
1732         return;
1733
1734     hres = IOleControl_GetControlInfo(control, &info);
1735     ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1736     hres = IOleControl_GetControlInfo(control, NULL);
1737     ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1738
1739     IOleControl_Release(control);
1740 }
1741
1742 static void test_Extent(IUnknown *unk)
1743 {
1744     IOleObject *oleobj;
1745     SIZE size;
1746     HRESULT hres;
1747
1748     hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1749     ok(hres == S_OK, "Could not get IOleObkect: %08x\n", hres);
1750     if(FAILED(hres))
1751         return;
1752
1753     size.cx = size.cy = 0xdeadbeef;
1754     hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1755     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1756     ok(size.cx == 1323 && size.cy == 529, "size = {%d %d}\n", size.cx, size.cy);
1757
1758     size.cx = 800;
1759     size.cy = 700;
1760     hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &size);
1761     ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1762
1763     size.cx = size.cy = 0xdeadbeef;
1764     hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1765     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1766     ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1767
1768     size.cx = size.cy = 0xdeadbeef;
1769     hres = IOleObject_GetExtent(oleobj, 0, &size);
1770     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1771     ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1772
1773     size.cx = 900;
1774     size.cy = 800;
1775     hres = IOleObject_SetExtent(oleobj, 0, &size);
1776     ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1777
1778     size.cx = size.cy = 0xdeadbeef;
1779     hres = IOleObject_GetExtent(oleobj, 0, &size);
1780     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1781     ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1782
1783     size.cx = size.cy = 0xdeadbeef;
1784     hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1785     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1786     ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1787
1788     size.cx = 1000;
1789     size.cy = 900;
1790     hres = IOleObject_SetExtent(oleobj, 0xdeadbeef, &size);
1791     ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1792
1793     size.cx = size.cy = 0xdeadbeef;
1794     hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1795     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1796     ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1797
1798     size.cx = size.cy = 0xdeadbeef;
1799     hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1800     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1801     ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1802
1803     IOleObject_Release(oleobj);
1804 }
1805
1806 static void test_ConnectionPoint(IUnknown *unk, BOOL init)
1807 {
1808     IConnectionPointContainer *container;
1809     IConnectionPoint *point;
1810     HRESULT hres;
1811
1812     static DWORD dw = 100;
1813
1814     hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
1815     ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
1816     if(FAILED(hres))
1817         return;
1818
1819     hres = IConnectionPointContainer_FindConnectionPoint(container, &DIID_DWebBrowserEvents2, &point);
1820     IConnectionPointContainer_Release(container);
1821     ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
1822     if(FAILED(hres))
1823         return;
1824
1825     if(init) {
1826         hres = IConnectionPoint_Advise(point, (IUnknown*)&WebBrowserEvents2, &dw);
1827         ok(hres == S_OK, "Advise failed: %08x\n", hres);
1828         ok(dw == 1, "dw=%d, expected 1\n", dw);
1829     }else {
1830         hres = IConnectionPoint_Unadvise(point, dw);
1831         ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
1832     }
1833
1834     IConnectionPoint_Release(point);
1835 }
1836
1837 static void test_Navigate2(IUnknown *unk)
1838 {
1839     IWebBrowser2 *webbrowser;
1840     VARIANT url;
1841     HRESULT hres;
1842
1843     hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&webbrowser);
1844     ok(hres == S_OK, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres);
1845     if(FAILED(hres))
1846         return;
1847
1848     V_VT(&url) = VT_BSTR;
1849     V_BSTR(&url) = SysAllocString(about_blankW);
1850
1851     SET_EXPECT(Invoke_AMBIENT_USERMODE);
1852     SET_EXPECT(Invoke_PROPERTYCHANGE);
1853     SET_EXPECT(Invoke_BEFORENAVIGATE2);
1854     SET_EXPECT(Invoke_DOWNLOADBEGIN);
1855     SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
1856     SET_EXPECT(EnableModeless_FALSE);
1857     SET_EXPECT(Invoke_STATUSTEXTCHANGE);
1858     SET_EXPECT(SetStatusText);
1859     SET_EXPECT(GetHostInfo);
1860     SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
1861     SET_EXPECT(Invoke_AMBIENT_USERAGENT);
1862     SET_EXPECT(Invoke_AMBIENT_PALETTE);
1863     SET_EXPECT(GetOptionKeyPath);
1864     SET_EXPECT(GetOverridesKeyPath);
1865     SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
1866     SET_EXPECT(Exec_SETPROGRESSMAX);
1867     SET_EXPECT(Exec_SETPROGRESSPOS);
1868     SET_EXPECT(Invoke_SETSECURELOCKICON);
1869     SET_EXPECT(Invoke_FILEDOWNLOAD);
1870     SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1871     SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1872     SET_EXPECT(EnableModeless_TRUE);
1873
1874     hres = IWebBrowser2_Navigate2(webbrowser, &url, NULL, NULL, NULL, NULL);
1875     ok(hres == S_OK, "Navigate2 failed: %08x\n", hres);
1876
1877     CHECK_CALLED(Invoke_AMBIENT_USERMODE);
1878     todo_wine CHECK_CALLED(Invoke_PROPERTYCHANGE);
1879     CHECK_CALLED(Invoke_BEFORENAVIGATE2);
1880     todo_wine CHECK_CALLED(Invoke_DOWNLOADBEGIN);
1881     todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
1882     CHECK_CALLED(EnableModeless_FALSE);
1883     CHECK_CALLED(Invoke_STATUSTEXTCHANGE);
1884     CHECK_CALLED(SetStatusText);
1885     CHECK_CALLED(GetHostInfo);
1886     CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
1887     CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
1888     CHECK_CALLED(Invoke_AMBIENT_PALETTE);
1889     CHECK_CALLED(GetOptionKeyPath);
1890     CHECK_CALLED(GetOverridesKeyPath);
1891     todo_wine CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
1892     todo_wine CHECK_CALLED(Exec_SETPROGRESSMAX);
1893     todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
1894     todo_wine CHECK_CALLED(Invoke_SETSECURELOCKICON);
1895     todo_wine CHECK_CALLED(Invoke_FILEDOWNLOAD);
1896     todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1897     todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1898     CHECK_CALLED(EnableModeless_TRUE);
1899
1900     VariantClear(&url);
1901     IWebBrowser2_Release(webbrowser);
1902 }
1903
1904 static void test_QueryInterface(IUnknown *unk)
1905 {
1906     IQuickActivate *qa = (IQuickActivate*)0xdeadbeef;
1907     IRunnableObject *runnable = (IRunnableObject*)0xdeadbeef;
1908     IPerPropertyBrowsing *propbrowse = (void*)0xdeadbeef;
1909     IOleCache *cache = (void*)0xdeadbeef;
1910     HRESULT hres;
1911
1912     hres = IUnknown_QueryInterface(unk, &IID_IQuickActivate, (void**)&qa);
1913     ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1914     ok(qa == NULL, "qa=%p, ezpected NULL\n", qa);
1915
1916     hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&runnable);
1917     ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1918     ok(runnable == NULL, "runnable=%p, ezpected NULL\n", runnable);
1919
1920     hres = IUnknown_QueryInterface(unk, &IID_IPerPropertyBrowsing, (void**)&propbrowse);
1921     ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1922     ok(runnable == NULL, "runnable=%p, ezpected NULL\n", runnable);
1923
1924     hres = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&cache);
1925     ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1926     ok(cache == NULL, "runnable=%p, ezpected NULL\n", runnable);
1927 }
1928
1929 static void test_WebBrowser(void)
1930 {
1931     IUnknown *unk = NULL;
1932     ULONG ref;
1933     HRESULT hres;
1934
1935     hres = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
1936             &IID_IUnknown, (void**)&unk);
1937     ok(hres == S_OK, "CoCreateInterface failed: %08x\n", hres);
1938     if(FAILED(hres))
1939         return;
1940
1941     hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1942     ok(hres == S_OK, "Could not get IWebBrowser2 iface: %08x\n", hres);
1943
1944     test_QueryInterface(unk);
1945     test_ClassInfo(unk);
1946     test_ConnectionPoint(unk, TRUE);
1947     test_ClientSite(unk, &ClientSite);
1948     test_Extent(unk);
1949     test_wb_funcs(unk, TRUE);
1950     test_DoVerb(unk);
1951     test_Navigate2(unk);
1952     test_ClientSite(unk, NULL);
1953     test_ie_funcs(unk);
1954     test_GetControlInfo(unk);
1955     test_wb_funcs(unk, FALSE);
1956     test_ConnectionPoint(unk, FALSE);
1957
1958     IWebBrowser2_Release(wb);
1959     ref = IUnknown_Release(unk);
1960     ok(ref == 0, "ref=%d, expected 0\n", ref);
1961 }
1962
1963 static void gecko_installer_workaround(BOOL disable)
1964 {
1965     HKEY hkey;
1966     DWORD res;
1967
1968     static BOOL has_url = FALSE;
1969     static char url[2048];
1970
1971     if(!disable && !has_url)
1972         return;
1973
1974     res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
1975     if(res != ERROR_SUCCESS)
1976         return;
1977
1978     if(disable) {
1979         DWORD type, size = sizeof(url);
1980
1981         res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
1982         if(res == ERROR_SUCCESS && type == REG_SZ)
1983             has_url = TRUE;
1984
1985         RegDeleteValue(hkey, "GeckoUrl");
1986     }else {
1987         RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
1988     }
1989
1990     RegCloseKey(hkey);
1991 }
1992
1993 START_TEST(webbrowser)
1994 {
1995     gecko_installer_workaround(TRUE);
1996
1997     container_hwnd = create_container_window();
1998
1999     OleInitialize(NULL);
2000
2001     test_WebBrowser();
2002
2003     OleUninitialize();
2004
2005     gecko_installer_workaround(FALSE);
2006 }