webbrowser.c 32.7 KB
Newer Older
1
/*
2
 * Implementation of IWebBrowser interface for WebBrowser control
3 4
 *
 * Copyright 2001 John R. Sheets (for CodeWeavers)
5
 * Copyright 2005 Jacek Caban
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 21 22 23
 */

#include "wine/debug.h"
#include "shdocvw.h"
24
#include "exdispid.h"
25 26 27 28 29 30 31

WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);

/**********************************************************************
 * Implement the IWebBrowser interface
 */

32
#define WEBBROWSER_THIS(iface) DEFINE_THIS(WebBrowser, WebBrowser2, iface)
33

34
static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
35 36 37 38 39 40 41 42 43 44
{
    WebBrowser *This = WEBBROWSER_THIS(iface);

    if (ppv == NULL)
        return E_POINTER;
    *ppv = NULL;

    if(IsEqualGUID(&IID_IUnknown, riid)) {
        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
        *ppv = WEBBROWSER(This);
45
    }else if(IsEqualGUID(&IID_IDispatch, riid)) {
46
        TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
47 48 49 50
        *ppv = WEBBROWSER(This);
    }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
        TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
        *ppv = WEBBROWSER(This);
51 52 53 54 55 56
    }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
        TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
        *ppv = WEBBROWSER(This);
    }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
        TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
        *ppv = WEBBROWSER(This);
57
    }else if(IsEqualGUID(&IID_IOleObject, riid)) {
58
        TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
59
        *ppv = OLEOBJ(This);
60 61 62 63 64 65
    }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
        TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
        *ppv = INPLACEOBJ(This);
    }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
        TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
        *ppv = INPLACEOBJ(This);
66 67
    }else if(IsEqualGUID(&IID_IOleControl, riid)) {
        TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
68
        *ppv = CONTROL(This);
69 70 71 72 73 74
    }else if(IsEqualGUID(&IID_IPersist, riid)) {
        TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
        *ppv = PERSTORAGE(This);
    }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
        TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
        *ppv = PERSTORAGE(This);
75 76 77
    }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
        TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
        *ppv = PERMEMORY(This);
78
    }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
79 80
        TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
        *ppv = PERSTRINIT(This);
81
    }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
82 83
        TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
        *ppv = CLASSINFO(This);
84
    }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
85 86
        TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
        *ppv = CLASSINFO(This);
87
    }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
88
        TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
89
        *ppv = CONPTCONT(&This->doc_host.cps);
90 91 92 93 94 95
    }else if(IsEqualGUID(&IID_IViewObject, riid)) {
        TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
        *ppv = VIEWOBJ(This);
    }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
        TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
        *ppv = VIEWOBJ2(This);
96 97 98
    }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
        TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
        *ppv = ACTIVEOBJ(This);
99 100
    }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
        TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
Jacek Caban's avatar
Jacek Caban committed
101
        *ppv = OLECMD(This);
102 103 104
    }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
        TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
        *ppv = HLINKFRAME(This);
105 106 107
    }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
        *ppv = SERVPROV(This);
        TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
108 109 110 111 112 113
    }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
        TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
        return E_NOINTERFACE;
    }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
        TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
        return E_NOINTERFACE;
114 115 116 117 118 119
    }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
        TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
        return E_NOINTERFACE;
    }else if(IsEqualGUID(&IID_IOleCache, riid)) {
        TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
        return E_NOINTERFACE;
120 121 122 123 124
    }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
        TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
        return E_NOINTERFACE;
    }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
        TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
125 126 127
        return E_NOINTERFACE;
    }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
        TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
128
        return E_NOINTERFACE;
129 130 131 132 133 134 135 136
    }

    if(*ppv) {
        IUnknown_AddRef((IUnknown*)*ppv);
        return S_OK;
    }

    FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
137 138 139
    return E_NOINTERFACE;
}

140
static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
141
{
142 143
    WebBrowser *This = WEBBROWSER_THIS(iface);
    LONG ref = InterlockedIncrement(&This->ref);
144
    TRACE("(%p) ref=%d\n", This, ref);
145
    return ref;
146 147
}

148
static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
149
{
150 151 152
    WebBrowser *This = WEBBROWSER_THIS(iface);
    LONG ref = InterlockedDecrement(&This->ref);

153
    TRACE("(%p) ref=%d\n", This, ref);
154

155
    if(!ref) {
156 157
        if(This->doc_host.document)
            IUnknown_Release(This->doc_host.document);
158

159 160
        DocHost_Release(&This->doc_host);

161 162
        WebBrowser_OleObject_Destroy(This);

163
        heap_free(This);
164 165 166 167
        SHDOCVW_UnlockModule();
    }

    return ref;
168 169 170
}

/* IDispatch methods */
171
static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
172
{
173
    WebBrowser *This = WEBBROWSER_THIS(iface);
174 175 176 177 178

    TRACE("(%p)->(%p)\n", This, pctinfo);

    *pctinfo = 1;
    return S_OK;
179 180
}

181
static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
182 183
                                     LPTYPEINFO *ppTInfo)
{
184
    WebBrowser *This = WEBBROWSER_THIS(iface);
185 186 187 188 189 190 191 192 193 194 195 196
    ITypeInfo *typeinfo;
    HRESULT hres;

    TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);

    hres = get_typeinfo(&typeinfo);
    if(FAILED(hres))
        return hres;

    ITypeInfo_AddRef(typeinfo);
    *ppTInfo = typeinfo;
    return S_OK;
197 198
}

199
static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
200 201 202
                                       LPOLESTR *rgszNames, UINT cNames,
                                       LCID lcid, DISPID *rgDispId)
{
203
    WebBrowser *This = WEBBROWSER_THIS(iface);
204 205 206 207 208 209 210 211 212 213 214
    ITypeInfo *typeinfo;
    HRESULT hres;

    TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
          lcid, rgDispId);

    hres = get_typeinfo(&typeinfo);
    if(FAILED(hres))
        return hres;

    return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
215 216
}

217
static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
218 219 220 221
                                REFIID riid, LCID lcid, WORD wFlags,
                                DISPPARAMS *pDispParams, VARIANT *pVarResult,
                                EXCEPINFO *pExepInfo, UINT *puArgErr)
{
222
    WebBrowser *This = WEBBROWSER_THIS(iface);
223 224 225
    ITypeInfo *typeinfo;
    HRESULT hres;

226
    TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
227
            lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
228 229 230 231 232 233 234

    hres = get_typeinfo(&typeinfo);
    if(FAILED(hres))
        return hres;

    return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
                            pVarResult, pExepInfo, puArgErr);
235 236 237
}

/* IWebBrowser methods */
238
static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
239
{
240 241 242
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
243 244
}

245
static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
246
{
247 248 249
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
250 251
}

252
static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
253
{
254
    WebBrowser *This = WEBBROWSER_THIS(iface);
255 256
    TRACE("(%p)\n", This);
    return go_home(&This->doc_host);
257 258
}

259
static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
260
{
261 262 263
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
264 265
}

266
static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
267 268 269
                                  VARIANT *Flags, VARIANT *TargetFrameName,
                                  VARIANT *PostData, VARIANT *Headers)
{
270
    WebBrowser *This = WEBBROWSER_THIS(iface);
271

272
    TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
273
          PostData, Headers);
274

275
    return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
276 277
}

278
static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
279
{
280 281 282
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
283 284
}

285
static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
286
{
287 288 289
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, Level);
    return E_NOTIMPL;
290 291
}

292
static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
293
{
294 295 296
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
297 298
}

299
static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
300
{
301
    WebBrowser *This = WEBBROWSER_THIS(iface);
302 303 304 305 306 307 308 309 310

    TRACE("(%p)->(%p)\n", This, ppDisp);

    if(!ppDisp)
        return E_POINTER;

    *ppDisp = (IDispatch*)WEBBROWSER2(This);
    IDispatch_AddRef(*ppDisp);
    return S_OK;
311 312
}

313
static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
314
{
315 316 317
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, ppDisp);
    return E_NOTIMPL;
318 319
}

320
static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
321
{
322 323 324
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, ppDisp);
    return E_NOTIMPL;
325 326
}

327
static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
328
{
329
    WebBrowser *This = WEBBROWSER_THIS(iface);
330 331 332 333

    TRACE("(%p)->(%p)\n", This, ppDisp);

    *ppDisp = NULL;
334 335
    if(This->doc_host.document)
        IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
336 337

    return S_OK;
338 339
}

340
static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
341
{
342 343 344
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pBool);
    return E_NOTIMPL;
345 346
}

347
static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
348
{
349 350 351
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, Type);
    return E_NOTIMPL;
352 353
}

354
static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
355
{
356
    WebBrowser *This = WEBBROWSER_THIS(iface);
357 358 359 360 361

    TRACE("(%p)->(%p)\n", This, pl);

    *pl = This->pos_rect.left;
    return S_OK;
362 363
}

364
static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
365
{
366
    WebBrowser *This = WEBBROWSER_THIS(iface);
367 368
    RECT rect;

369
    TRACE("(%p)->(%d)\n", This, Left);
370 371 372 373

    if(!This->inplace)
        return E_UNEXPECTED;

374
    rect = This->pos_rect;
375 376
    rect.left = Left;

377 378
    /* We don't really change the window position here.
     * We just notify the embedder that he should do so. */
379
    return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
380 381
}

382
static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
383
{
384
    WebBrowser *This = WEBBROWSER_THIS(iface);
385 386 387 388 389

    TRACE("(%p)->(%p)\n", This, pl);

    *pl = This->pos_rect.top;
    return S_OK;
390 391
}

392
static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
393
{
394
    WebBrowser *This = WEBBROWSER_THIS(iface);
395 396
    RECT rect;

397
    TRACE("(%p)->(%d)\n", This, Top);
398 399 400 401

    if(!This->inplace)
        return E_UNEXPECTED;

402
    rect = This->pos_rect;
403 404
    rect.top = Top;

405 406
    /* We don't really change the window position here.
     * We just notify the embedder that he should do so. */
407
    return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
408 409
}

410
static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
411
{
412
    WebBrowser *This = WEBBROWSER_THIS(iface);
413 414 415 416 417

    TRACE("(%p)->(%p)\n", This, pl);

    *pl = This->pos_rect.right - This->pos_rect.left;
    return S_OK;
418 419
}

420
static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
421
{
422
    WebBrowser *This = WEBBROWSER_THIS(iface);
423 424
    RECT rect;

425
    TRACE("(%p)->(%d)\n", This, Width);
426 427 428 429

    if(!This->inplace)
        return E_UNEXPECTED;

430
    rect = This->pos_rect;
431
    rect.right = rect.left+Width;
432

433 434 435
    /* We don't really change the window size here.
     * We just notify the embedder that he should do so. */
   return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
436 437
}

438
static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
439
{
440
    WebBrowser *This = WEBBROWSER_THIS(iface);
441 442 443 444 445

    TRACE("(%p)->(%p)\n", This, pl);

    *pl = This->pos_rect.bottom - This->pos_rect.top;
    return S_OK;
446 447
}

448
static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
449
{
450
    WebBrowser *This = WEBBROWSER_THIS(iface);
451 452
    RECT rect;

453
    TRACE("(%p)->(%d)\n", This, Height);
454 455 456 457

    if(!This->inplace)
        return E_UNEXPECTED;

458
    rect = This->pos_rect;
459 460
    rect.bottom = rect.top+Height;

461 462
    /* We don't really change the window size here.
     * We just notify the embedder that he should do so. */
463
    return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
464 465
}

466
static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
467
{
468 469 470
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, LocationName);
    return E_NOTIMPL;
471 472
}

473
static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
474
{
475
    WebBrowser *This = WEBBROWSER_THIS(iface);
476

477
    FIXME("(%p)->(%p)\n", This, LocationURL);
478

479
    if(!This->doc_host.url) {
480 481 482 483 484
        static const WCHAR null_char = 0;
        *LocationURL = SysAllocString(&null_char);
        return S_FALSE;
    }

485
    *LocationURL = SysAllocString(This->doc_host.url);
486
    return S_OK;
487 488
}

489
static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
490
{
491
    WebBrowser *This = WEBBROWSER_THIS(iface);
492 493 494 495 496

    TRACE("(%p)->(%p)\n", This, pBool);

    *pBool = This->doc_host.busy;
    return S_OK;
497 498
}

499 500 501
static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
502 503 504 505 506

    TRACE("(%p)\n", This);

    /* It's a InternetExplorer specific method, we have nothing to do here. */
    return E_FAIL;
507
}
508

509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536
static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, Name);
    return E_NOTIMPL;
}

537
static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, LONG *pHWND)
538 539
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
540 541 542

    TRACE("(%p)->(%p)\n", This, pHWND);

543
    /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
544 545
    *pHWND = 0;
    return E_FAIL;
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
}

static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, FullName);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, Path);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
565 566 567 568 569

    TRACE("(%p)->(%p)\n", This, pBool);

    *pBool = This->visible;
    return S_OK;
570 571 572 573 574
}

static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
575 576 577 578 579 580 581 582 583
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, Value);

    This->visible = Value;

    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = Value;
584
    call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
585 586

    return S_OK;
587 588 589 590 591
}

static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
592 593 594 595 596

    TRACE("(%p)->(%p)\n", This, pBool);

    *pBool = This->status_bar;
    return S_OK;
597 598 599 600 601
}

static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
602 603 604 605 606
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, Value);

607
    This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
608

609 610 611
    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the status bar change. */

612 613
    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = Value;
614
    call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
615 616

    return S_OK;
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
}

static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, StatusText);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
636 637 638 639 640

    TRACE("(%p)->(%p)\n", This, Value);

    *Value = This->tool_bar;
    return S_OK;
641 642 643 644 645
}

static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
646 647 648 649 650 651 652
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, Value);

    This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;

653 654 655
    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the tool bar change. */

656
    V_VT(&arg) = VT_BOOL;
657
    V_BOOL(&arg) = This->tool_bar;
658
    call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
659 660

    return S_OK;
661 662 663 664 665
}

static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
666 667 668 669 670

    TRACE("(%p)->(%p)\n", This, Value);

    *Value = This->menu_bar;
    return S_OK;
671 672 673 674 675
}

static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
676 677 678 679 680
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, Value);

681
    This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
682

683 684 685
    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the menu bar change. */

686 687
    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = Value;
688
    call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
689 690

    return S_OK;
691 692 693 694 695
}

static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
696 697 698 699 700

    TRACE("(%p)->(%p)\n", This, pbFullScreen);

    *pbFullScreen = This->full_screen;
    return S_OK;
701 702 703 704 705
}

static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
706 707 708 709 710
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the fullscreen change. */
711 712 713 714

    TRACE("(%p)->(%x)\n", This, bFullScreen);

    This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
715 716 717 718 719

    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = bFullScreen;
    call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);

720
    return S_OK;
721 722 723 724 725 726
}

static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
        VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
727 728 729 730 731 732

    TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);

    if(!This->client)
        return E_FAIL;

733 734
    if(!URL)
        return S_OK;
735

736 737
    if(V_VT(URL) != VT_BSTR) {
        FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
738
        return E_INVALIDARG;
739 740
    }

741
    return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770
}

static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
        OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
        VARIANT *pvarShow, VARIANT *pvarSize)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, lpReadyState);
771 772 773

    *lpReadyState = READYSTATE_COMPLETE;
    return S_OK;
774 775 776 777 778
}

static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
779 780 781

    TRACE("(%p)->(%p)\n", This, pbOffline);

782
    *pbOffline = This->doc_host.offline;
783
    return S_OK;
784 785 786 787 788
}

static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
789 790 791

    TRACE("(%p)->(%x)\n", This, bOffline);

792
    This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
793
    return S_OK;
794 795 796 797 798
}

static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
799 800 801

    TRACE("(%p)->(%p)\n", This, pbSilent);

802
    *pbSilent = This->doc_host.silent;
803
    return S_OK;
804 805 806 807 808
}

static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
809 810 811

    TRACE("(%p)->(%x)\n", This, bSilent);

812
    This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
813
    return S_OK;
814 815 816 817 818 819
}

static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
        VARIANT_BOOL *pbRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
820

821
    FIXME("(%p)->(%p)\n", This, pbRegister);
822 823 824

    *pbRegister = This->register_browser;
    return S_OK;
825 826 827 828 829 830
}

static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
        VARIANT_BOOL bRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
831

832
    FIXME("(%p)->(%x)\n", This, bRegister);
833 834 835

    This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
    return S_OK;
836 837 838 839 840 841 842
}

static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
        VARIANT_BOOL *pbRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pbRegister);
843 844
    *pbRegister=0;
    return S_OK;
845 846 847 848 849 850 851
}

static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
        VARIANT_BOOL bRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
    FIXME("(%p)->(%x)\n", This, bRegister);
852
    return S_OK;
853 854 855 856 857
}

static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
858 859 860 861 862

    TRACE("(%p)->(%p)\n", This, pbRegister);

    *pbRegister = This->theater_mode;
    return S_OK;
863 864 865 866 867
}

static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, bRegister);

    This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;

    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the theater mode change. */

    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = bRegister;
    call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);

    return S_OK;
883 884 885 886 887
}

static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
888 889 890 891 892

    TRACE("(%p)->(%p)\n", This, Value);

    *Value = This->address_bar;
    return S_OK;
893 894 895 896 897
}

static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
898 899 900 901 902
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};

    TRACE("(%p)->(%x)\n", This, Value);

903
    This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
904

905 906 907
    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the address bar change. */

908 909
    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = Value;
910
    call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
911 912

    return S_OK;
913 914 915 916 917
}

static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
918 919 920 921

    TRACE("(%p)->(%p)\n", This, Value);

    /* It's InternetExplorer object's method. We have nothing to do here. */
922 923 924 925 926 927
    return E_NOTIMPL;
}

static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
{
    WebBrowser *This = WEBBROWSER_THIS(iface);
928 929
    VARIANTARG arg;
    DISPPARAMS dispparams = {&arg, NULL, 1, 0};
930 931 932

    TRACE("(%p)->(%x)\n", This, Value);

933 934 935 936 937 938 939
    /* In opposition to InternetExplorer, all we should do here is
     * inform the embedder about the resizable change. */

    V_VT(&arg) = VT_BOOL;
    V_BOOL(&arg) = Value;
    call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);

940
    return S_OK;
941 942 943
}

#undef WEBBROWSER_THIS
944

945
static const IWebBrowser2Vtbl WebBrowser2Vtbl =
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977
{
    WebBrowser_QueryInterface,
    WebBrowser_AddRef,
    WebBrowser_Release,
    WebBrowser_GetTypeInfoCount,
    WebBrowser_GetTypeInfo,
    WebBrowser_GetIDsOfNames,
    WebBrowser_Invoke,
    WebBrowser_GoBack,
    WebBrowser_GoForward,
    WebBrowser_GoHome,
    WebBrowser_GoSearch,
    WebBrowser_Navigate,
    WebBrowser_Refresh,
    WebBrowser_Refresh2,
    WebBrowser_Stop,
    WebBrowser_get_Application,
    WebBrowser_get_Parent,
    WebBrowser_get_Container,
    WebBrowser_get_Document,
    WebBrowser_get_TopLevelContainer,
    WebBrowser_get_Type,
    WebBrowser_get_Left,
    WebBrowser_put_Left,
    WebBrowser_get_Top,
    WebBrowser_put_Top,
    WebBrowser_get_Width,
    WebBrowser_put_Width,
    WebBrowser_get_Height,
    WebBrowser_put_Height,
    WebBrowser_get_LocationName,
    WebBrowser_get_LocationURL,
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
    WebBrowser_get_Busy,
    WebBrowser_Quit,
    WebBrowser_ClientToWindow,
    WebBrowser_PutProperty,
    WebBrowser_GetProperty,
    WebBrowser_get_Name,
    WebBrowser_get_HWND,
    WebBrowser_get_FullName,
    WebBrowser_get_Path,
    WebBrowser_get_Visible,
    WebBrowser_put_Visible,
    WebBrowser_get_StatusBar,
    WebBrowser_put_StatusBar,
    WebBrowser_get_StatusText,
    WebBrowser_put_StatusText,
    WebBrowser_get_ToolBar,
    WebBrowser_put_ToolBar,
    WebBrowser_get_MenuBar,
    WebBrowser_put_MenuBar,
    WebBrowser_get_FullScreen,
    WebBrowser_put_FullScreen,
    WebBrowser_Navigate2,
    WebBrowser_QueryStatusWB,
    WebBrowser_ExecWB,
    WebBrowser_ShowBrowserBar,
    WebBrowser_get_ReadyState,
    WebBrowser_get_Offline,
    WebBrowser_put_Offline,
    WebBrowser_get_Silent,
    WebBrowser_put_Silent,
    WebBrowser_get_RegisterAsBrowser,
    WebBrowser_put_RegisterAsBrowser,
    WebBrowser_get_RegisterAsDropTarget,
    WebBrowser_put_RegisterAsDropTarget,
    WebBrowser_get_TheaterMode,
    WebBrowser_put_TheaterMode,
    WebBrowser_get_AddressBar,
    WebBrowser_put_AddressBar,
    WebBrowser_get_Resizable,
    WebBrowser_put_Resizable
1018 1019
};

1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091
#define SERVPROV_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
/*
 *  IServiceProvider interface.
 */
static HRESULT WINAPI WebBrowser_IServiceProvider_QueryInterface(IServiceProvider *iface,
            REFIID riid, LPVOID *ppv)
{
    WebBrowser *This = SERVPROV_THIS(iface);

    if (ppv == NULL)
        return E_POINTER;
    *ppv = NULL;

    if(IsEqualGUID(&IID_IUnknown, riid)) {
        *ppv = WEBBROWSER(This);
        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
    }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
        *ppv = WEBBROWSER(This);
        TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
    }

    if(*ppv) {
        IUnknown_AddRef((IUnknown*)*ppv);
        return S_OK;
    }

    FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
    return E_NOINTERFACE;
}

static ULONG WINAPI WebBrowser_IServiceProvider_AddRef(IServiceProvider *iface)
{
    WebBrowser *This = SERVPROV_THIS(iface);
    return IWebBrowser_AddRef(WEBBROWSER(This));
}

static ULONG WINAPI WebBrowser_IServiceProvider_Release(IServiceProvider *iface)
{
    WebBrowser *This = SERVPROV_THIS(iface);
    return IWebBrowser_Release(WEBBROWSER(This));
}

static HRESULT STDMETHODCALLTYPE WebBrowser_IServiceProvider_QueryService(IServiceProvider *iface,
            REFGUID guidService, REFIID riid, void **ppv)
{
    WebBrowser *This = SERVPROV_THIS(iface);
    static const IID IID_IBrowserService2 =
        {0x68BD21CC,0x438B,0x11d2,{0xA5,0x60,0x00,0xA0,0xC,0x2D,0xBF,0xE8}};

    if(*ppv)
        ppv = NULL;

    if(IsEqualGUID(&IID_IBrowserService2, riid)) {
        TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This);
        return E_FAIL;
    }

    FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);

    return E_NOINTERFACE;
}

#undef SERVPROV_THIS

static const IServiceProviderVtbl ServiceProviderVtbl =
{
    WebBrowser_IServiceProvider_QueryInterface,
    WebBrowser_IServiceProvider_AddRef,
    WebBrowser_IServiceProvider_Release,
    WebBrowser_IServiceProvider_QueryService
};

1092
static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
1093 1094 1095 1096
{
    WebBrowser *ret;
    HRESULT hres;

1097
    TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
1098

1099
    ret = heap_alloc(sizeof(WebBrowser));
1100

1101
    ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
1102
    ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
1103
    ret->ref = 0;
1104
    ret->version = version;
1105

1106
    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
1107

1108
    ret->register_browser = VARIANT_FALSE;
1109
    ret->visible = VARIANT_TRUE;
1110
    ret->menu_bar = VARIANT_TRUE;
1111
    ret->address_bar = VARIANT_TRUE;
1112
    ret->status_bar = VARIANT_TRUE;
1113
    ret->tool_bar = VARIANT_TRUE;
1114
    ret->full_screen = VARIANT_FALSE;
1115
    ret->theater_mode = VARIANT_FALSE;
1116

1117
    WebBrowser_OleObject_Init(ret);
1118
    WebBrowser_ViewObject_Init(ret);
1119
    WebBrowser_Persist_Init(ret);
1120
    WebBrowser_ClassInfo_Init(ret);
1121
    WebBrowser_HlinkFrame_Init(ret);
1122 1123 1124 1125 1126

    hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
    if(SUCCEEDED(hres)) {
        SHDOCVW_LockModule();
    }else {
1127
        heap_free(ret);
1128 1129 1130 1131 1132
        return hres;
    }

    return hres;
}
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142

HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
{
    return WebBrowser_Create(1, pOuter, riid, ppv);
}

HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
{
    return WebBrowser_Create(2, pOuter, riid, ppv);
}