Index: include/psdk/isguids.h
===================================================================
--- include/psdk/isguids.h	(Revision 31635)
+++ include/psdk/isguids.h	(Arbeitskopie)
@@ -7,7 +7,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern const GUID CLSID_InternetShortcut;
 extern const GUID IID_IUniformResourceLocator;
 #ifdef __cplusplus
 }
Index: dll/win32/shdocvw/navigate.c
===================================================================
--- dll/win32/shdocvw/navigate.c	(Revision 0)
+++ dll/win32/shdocvw/navigate.c	(Revision 0)
@@ -0,0 +1,818 @@
+/*
+ * Copyright 2006-2007 Jacek Caban for CodeWeavers
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+#include "shdocvw.h"
+#include "mshtml.h"
+#include "exdispid.h"
+#include "shellapi.h"
+#include "winreg.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+static const WCHAR emptyW[] = {0};
+
+typedef struct {
+    const IBindStatusCallbackVtbl  *lpBindStatusCallbackVtbl;
+    const IHttpNegotiateVtbl       *lpHttpNegotiateVtbl;
+
+    LONG ref;
+
+    DocHost *doc_host;
+
+    HGLOBAL post_data;
+    LPWSTR headers;
+    ULONG post_data_len;
+} BindStatusCallback;
+
+#define BINDSC(x)  ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
+#define HTTPNEG(x) ((IHttpNegotiate*)      &(x)->lpHttpNegotiateVtbl)
+
+static void dump_BINDINFO(BINDINFO *bi)
+{
+    static const char * const BINDINFOF_str[] = {
+        "#0",
+        "BINDINFOF_URLENCODESTGMEDDATA",
+        "BINDINFOF_URLENCODEDEXTRAINFO"
+    };
+
+    static const char * const BINDVERB_str[] = {
+        "BINDVERB_GET",
+        "BINDVERB_POST",
+        "BINDVERB_PUT",
+        "BINDVERB_CUSTOM"
+    };
+
+    TRACE("\n"
+            "BINDINFO = {\n"
+            "    %d, %s,\n"
+            "    {%d, %p, %p},\n"
+            "    %s,\n"
+            "    %s,\n"
+            "    %s,\n"
+            "    %d, %08x, %d, %d\n"
+            "    {%d %p %x},\n"
+            "    %s\n"
+            "    %p, %d\n"
+            "}\n",
+
+            bi->cbSize, debugstr_w(bi->szExtraInfo),
+            bi->stgmedData.tymed, bi->stgmedData.u.hGlobal, bi->stgmedData.pUnkForRelease,
+            bi->grfBindInfoF > BINDINFOF_URLENCODEDEXTRAINFO
+                ? "unknown" : BINDINFOF_str[bi->grfBindInfoF],
+            bi->dwBindVerb > BINDVERB_CUSTOM
+                ? "unknown" : BINDVERB_str[bi->dwBindVerb],
+            debugstr_w(bi->szCustomVerb),
+            bi->cbstgmedData, bi->dwOptions, bi->dwOptionsFlags, bi->dwCodePage,
+            bi->securityAttributes.nLength,
+            bi->securityAttributes.lpSecurityDescriptor,
+            bi->securityAttributes.bInheritHandle,
+            debugstr_guid(&bi->iid),
+            bi->pUnk, bi->dwReserved
+            );
+}
+
+static void set_status_text(BindStatusCallback *This, LPCWSTR str)
+{
+    if(!This->doc_host || !This->doc_host->frame)
+        return;
+
+    IOleInPlaceFrame_SetStatusText(This->doc_host->frame, str);
+}
+
+#define BINDSC_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
+
+static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
+                                                        REFIID riid, void **ppv)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = BINDSC(This);
+    }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
+        TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
+        *ppv = BINDSC(This);
+    }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
+        TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
+        *ppv = HTTPNEG(This);
+    }
+
+    if(*ppv) {
+        IBindStatusCallback_AddRef(BINDSC(This));
+        return S_OK;
+    }
+
+    WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref) {
+        if(This->doc_host)
+            IOleClientSite_Release(CLIENTSITE(This->doc_host));
+        if(This->post_data)
+            GlobalFree(This->post_data);
+        HeapFree(GetProcessHeap(), 0, This->headers);
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
+       DWORD dwReserved, IBinding *pbind)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+
+    TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
+       LONG *pnPriority)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pnPriority);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface,
+       DWORD reserved)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    FIXME("(%p)->(%d)\n", This, reserved);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
+        ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+
+    TRACE("(%p)->(%d %d %d %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
+          debugstr_w(szStatusText));
+
+    switch(ulStatusCode) {
+    case BINDSTATUS_BEGINDOWNLOADDATA:
+        set_status_text(This, szStatusText); /* FIXME: "Start downloading from site: %s" */
+        return S_OK;
+    case BINDSTATUS_ENDDOWNLOADDATA:
+        set_status_text(This, szStatusText); /* FIXME: "Downloading from site: %s" */
+        return S_OK;
+    case BINDSTATUS_CLASSIDAVAILABLE:
+    case BINDSTATUS_MIMETYPEAVAILABLE:
+    case BINDSTATUS_BEGINSYNCOPERATION:
+    case BINDSTATUS_ENDSYNCOPERATION:
+        return S_OK;
+    default:
+        FIXME("status code %u\n", ulStatusCode);
+    }
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
+        HRESULT hresult, LPCWSTR szError)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+
+    TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
+
+    set_status_text(This, emptyW);
+
+    if(This->doc_host) {
+        IOleClientSite_Release(CLIENTSITE(This->doc_host));
+        This->doc_host = NULL;
+    }
+
+    return S_OK;
+}
+
+static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
+        DWORD *grfBINDF, BINDINFO *pbindinfo)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+
+    TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
+
+    *grfBINDF = BINDF_ASYNCHRONOUS;
+
+    if(This->post_data) {
+        pbindinfo->dwBindVerb = BINDVERB_POST;
+
+        pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
+        pbindinfo->stgmedData.u.hGlobal = This->post_data;
+        pbindinfo->cbstgmedData = This->post_data_len;
+        pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)BINDSC(This);
+        IBindStatusCallback_AddRef(BINDSC(This));
+    }
+
+    return S_OK;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
+        DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    FIXME("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
+        REFIID riid, IUnknown *punk)
+{
+    BindStatusCallback *This = BINDSC_THIS(iface);
+    IOleObject *oleobj;
+    HRESULT hres;
+
+    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
+
+    IUnknown_AddRef(punk);
+    This->doc_host->document = punk;
+
+    hres = IUnknown_QueryInterface(punk, &IID_IOleObject, (void**)&oleobj);
+    if(SUCCEEDED(hres)) {
+        CLSID clsid;
+
+        hres = IOleObject_GetUserClassID(oleobj, &clsid);
+        if(SUCCEEDED(hres))
+            TRACE("Got clsid %s\n",
+                  IsEqualGUID(&clsid, &CLSID_HTMLDocument) ? "CLSID_HTMLDocument" : debugstr_guid(&clsid));
+
+        hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This->doc_host));
+        if(FAILED(hres))
+            FIXME("SetClientSite failed: %08x\n", hres);
+
+        /* FIXME: Call SetAdvise */
+        /* FIXME: Call Invoke(DISPID_READYSTATE) */
+    }else {
+        FIXME("Could not get IOleObject iface: %08x\n", hres);
+    }
+
+    PostMessageW(This->doc_host->hwnd, WB_WM_NAVIGATE2, 0, 0);
+
+    return S_OK;
+}
+
+#undef BSC_THIS
+
+static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
+    BindStatusCallback_QueryInterface,
+    BindStatusCallback_AddRef,
+    BindStatusCallback_Release,
+    BindStatusCallback_OnStartBinding,
+    BindStatusCallback_GetPriority,
+    BindStatusCallback_OnLowResource,
+    BindStatusCallback_OnProgress,
+    BindStatusCallback_OnStopBinding,
+    BindStatusCallback_GetBindInfo,
+    BindStatusCallback_OnDataAvailable,
+    BindStatusCallback_OnObjectAvailable
+};
+
+#define HTTPNEG_THIS(iface) DEFINE_THIS(BindStatusCallback, HttpNegotiate, iface)
+
+static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface,
+                                                   REFIID riid, void **ppv)
+{
+    BindStatusCallback *This = HTTPNEG_THIS(iface);
+    return IBindStatusCallback_QueryInterface(BINDSC(This), riid, ppv);
+}
+
+static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
+{
+    BindStatusCallback *This = HTTPNEG_THIS(iface);
+    return IBindStatusCallback_AddRef(BINDSC(This));
+}
+
+static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
+{
+    BindStatusCallback *This = HTTPNEG_THIS(iface);
+    return IBindStatusCallback_Release(BINDSC(This));
+}
+
+static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
+        LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
+{
+    BindStatusCallback *This = HTTPNEG_THIS(iface);
+
+    FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
+          dwReserved, pszAdditionalHeaders);
+
+    if(This->headers) {
+        int size = (strlenW(This->headers)+1)*sizeof(WCHAR);
+        *pszAdditionalHeaders = CoTaskMemAlloc(size);
+        memcpy(*pszAdditionalHeaders, This->headers, size);
+    }
+
+    return S_OK;
+}
+
+static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface,
+        DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders,
+        LPWSTR *pszAdditionalRequestHeaders)
+{
+    BindStatusCallback *This = HTTPNEG_THIS(iface);
+    FIXME("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
+          debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
+    return E_NOTIMPL;
+}
+
+#undef HTTPNEG_THIS
+
+static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
+    HttpNegotiate_QueryInterface,
+    HttpNegotiate_AddRef,
+    HttpNegotiate_Release,
+    HttpNegotiate_BeginningTransaction,
+    HttpNegotiate_OnResponse
+};
+
+static IBindStatusCallback *create_callback(DocHost *doc_host, PBYTE post_data,
+        ULONG post_data_len, LPWSTR headers)
+{
+    BindStatusCallback *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(BindStatusCallback));
+
+    ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
+    ret->lpHttpNegotiateVtbl      = &HttpNegotiateVtbl;
+
+    ret->ref = 1;
+    ret->post_data = NULL;
+    ret->post_data_len = post_data_len;
+    ret->headers = NULL;
+
+    ret->doc_host = doc_host;
+    IOleClientSite_AddRef(CLIENTSITE(doc_host));
+
+    if(post_data) {
+        ret->post_data = GlobalAlloc(0, post_data_len);
+        memcpy(ret->post_data, post_data, post_data_len);
+    }
+
+    if(headers) {
+        int size = (strlenW(headers)+1)*sizeof(WCHAR);
+        ret->headers = HeapAlloc(GetProcessHeap(), 0, size);
+        memcpy(ret->headers, headers, size);
+    }
+
+    return BINDSC(ret);
+}
+
+static void on_before_navigate2(DocHost *This, LPCWSTR url, const BYTE *post_data,
+                                ULONG post_data_len, LPWSTR headers, VARIANT_BOOL *cancel)
+{
+    VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
+    DISPPARAMS dispparams;
+    VARIANTARG params[7];
+
+    dispparams.cArgs = 7;
+    dispparams.cNamedArgs = 0;
+    dispparams.rgdispidNamedArgs = NULL;
+    dispparams.rgvarg = params;
+
+    V_VT(params) = VT_BOOL|VT_BYREF;
+    V_BOOLREF(params) = cancel;
+
+    V_VT(params+1) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(params+1) = &var_headers;
+    V_VT(&var_headers) = VT_BSTR;
+    V_BSTR(&var_headers) = headers;
+
+    V_VT(params+2) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(params+2) = &var_post_data2;
+    V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(&var_post_data2) = &var_post_data;
+    VariantInit(&var_post_data);
+
+    if(post_data_len) {
+        SAFEARRAYBOUND bound = {post_data_len, 0};
+        void *data;
+
+        V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
+        V_ARRAY(&var_post_data) = SafeArrayCreate(VT_UI1, 1, &bound);
+
+        SafeArrayAccessData(V_ARRAY(&var_post_data), &data);
+        memcpy(data, post_data, post_data_len);
+        SafeArrayUnaccessData(V_ARRAY(&var_post_data));
+    }
+
+    V_VT(params+3) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(params+3) = &var_frame_name;
+    V_VT(&var_frame_name) = VT_BSTR;
+    V_BSTR(&var_frame_name) = NULL;
+
+    V_VT(params+4) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(params+4) = &var_flags;
+    V_VT(&var_flags) = VT_I4;
+    V_I4(&var_flags) = 0;
+
+    V_VT(params+5) = (VT_BYREF|VT_VARIANT);
+    V_VARIANTREF(params+5) = &var_url;
+    V_VT(&var_url) = VT_BSTR;
+    V_BSTR(&var_url) = SysAllocString(url);
+
+    V_VT(params+6) = (VT_DISPATCH);
+    V_DISPATCH(params+6) = This->disp;
+
+    call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
+
+    SysFreeString(V_BSTR(&var_url));
+    if(post_data_len)
+        SafeArrayDestroy(V_ARRAY(&var_post_data));
+}
+
+/* FIXME: urlmon should handle it */
+static BOOL try_application_url(LPCWSTR url)
+{
+    SHELLEXECUTEINFOW exec_info;
+    WCHAR app[64];
+    HKEY hkey;
+    DWORD res, type;
+    HRESULT hres;
+
+    static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
+
+    hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
+    if(FAILED(hres))
+        return FALSE;
+
+    res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
+    if(res != ERROR_SUCCESS)
+        return FALSE;
+
+    res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
+    RegCloseKey(hkey);
+    if(res != ERROR_SUCCESS || type != REG_SZ)
+        return FALSE;
+
+    TRACE("openning application %s\n", debugstr_w(app));
+ 
+    memset(&exec_info, 0, sizeof(exec_info));
+    exec_info.cbSize = sizeof(exec_info);
+    exec_info.lpFile = url;
+    exec_info.nShow = SW_SHOW;
+
+    return ShellExecuteExW(&exec_info);
+}
+
+static HRESULT http_load_hack(DocHost *This, IMoniker *mon, IBindStatusCallback *callback, IBindCtx *bindctx)
+{
+    IPersistMoniker *persist;
+    IUnknown *doc;
+    HRESULT hres;
+
+    /*
+     * FIXME:
+     * We should use URLMoniker's BindToObject instead creating HTMLDocument here.
+     * This should be fixed when mshtml.dll and urlmon.dll will be good enough.
+     */
+
+    hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
+                            CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
+                            &IID_IUnknown, (void**)&doc);
+
+    if(FAILED(hres)) {
+        ERR("Could not create HTMLDocument: %08x\n", hres);
+        return hres;
+    }
+
+    hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist);
+    if(FAILED(hres)) {
+        IUnknown_Release(doc);
+        return hres;
+    }
+
+    hres = IPersistMoniker_Load(persist, FALSE, mon, bindctx, 0);
+    IPersistMoniker_Release(persist);
+
+    if(SUCCEEDED(hres))
+        hres = IBindStatusCallback_OnObjectAvailable(callback, &IID_IUnknown, doc);
+    else
+        WARN("Load failed: %08x\n", hres);
+
+    IUnknown_Release(doc);
+
+    return IBindStatusCallback_OnStopBinding(callback, hres, NULL);
+}
+
+static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
+                              IBindStatusCallback *callback)
+{
+    WCHAR schema[30];
+    DWORD schema_len;
+    HRESULT hres;
+
+    static const WCHAR httpW[] = {'h','t','t','p',0};
+    static const WCHAR httpsW[] = {'h','t','t','p','s',0};
+    static const WCHAR ftpW[]= {'f','t','p',0};
+
+    IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
+                                 (IUnknown*)CLIENTSITE(This));
+
+    if(This->frame)
+        IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
+
+    hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
+            &schema_len, 0);
+    if(SUCCEEDED(hres) &&
+       (!strcmpW(schema, httpW) || !strcmpW(schema, httpsW) || !strcmpW(schema, ftpW))) {
+        hres = http_load_hack(This, mon, callback, bindctx);
+    }else {
+        IUnknown *unk = NULL;
+
+        hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
+        if(SUCCEEDED(hres)) {
+            hres = S_OK;
+            if(unk)
+                IUnknown_Release(unk);
+        }else if(try_application_url(This->url)) {
+            hres = S_OK;
+        }else {
+            FIXME("BindToObject failed: %08x\n", hres);
+        }
+    }
+
+    if(This->frame)
+        IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
+
+    return S_OK;
+}
+
+static HRESULT navigate_mon(DocHost *This, IMoniker *mon, PBYTE post_data, ULONG post_data_len,
+                     LPWSTR headers)
+{
+    IBindStatusCallback *callback;
+    IBindCtx *bindctx;
+    VARIANT_BOOL cancel = VARIANT_FALSE;
+    LPWSTR url;
+    HRESULT hres;
+
+    IMoniker_GetDisplayName(mon, NULL, NULL, &url);
+    TRACE("navigating to %s\n", debugstr_w(url));
+
+    on_before_navigate2(This, url, post_data, post_data_len, headers, &cancel);
+    if(cancel) {
+        FIXME("Navigation canceled\n");
+        CoTaskMemFree(url);
+        return S_OK;
+    }
+
+    if(This->document)
+        deactivate_document(This);
+    CoTaskMemFree(This->url);
+    This->url = url;
+
+    callback = create_callback(This, post_data, post_data_len, (LPWSTR)headers);
+    CreateAsyncBindCtx(0, callback, 0, &bindctx);
+
+    hres = bind_to_object(This, mon, This->url, bindctx, callback);
+
+    IBindStatusCallback_Release(callback);
+    IBindCtx_Release(bindctx);
+
+    return hres;
+}
+
+HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
+                     const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
+{
+    IMoniker *mon;
+    PBYTE post_data = NULL;
+    ULONG post_data_len = 0;
+    LPWSTR headers = NULL;
+    HRESULT hres;
+
+    TRACE("navigating to %s\n", debugstr_w(url));
+
+    hres = CreateURLMoniker(NULL, url, &mon);
+    if(FAILED(hres)) {
+        WARN("CreateURLMoniker failed: %08x\n", hres);
+        return hres;
+    }
+
+    if((Flags && V_VT(Flags) != VT_EMPTY) 
+       || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
+        FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
+                Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
+                TargetFrameName ? V_VT(TargetFrameName) : -1);
+
+    if(PostData) {
+        TRACE("PostData vt=%d\n", V_VT(PostData));
+
+        if(V_VT(PostData) == (VT_ARRAY | VT_UI1)) {
+            SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
+            post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
+        }
+    }
+
+    if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
+        if(V_VT(Headers) != VT_BSTR)
+            return E_INVALIDARG;
+
+        headers = V_BSTR(Headers);
+        TRACE("Headers: %s\n", debugstr_w(headers));
+    }
+
+    if(!This->hwnd)
+        create_doc_view_hwnd(This);
+
+    hres = navigate_mon(This, mon, post_data, post_data_len, headers);
+
+    IMoniker_Release(mon);
+    if(post_data)
+        SafeArrayUnaccessData(V_ARRAY(PostData));
+
+    return hres;
+}
+
+static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
+                              IBindStatusCallback *callback)
+{
+    IHttpNegotiate *http_negotiate;
+    PBYTE post_data = NULL;
+    ULONG post_data_len = 0;
+    LPWSTR headers = NULL;
+    BINDINFO bindinfo;
+    DWORD bindf = 0;
+    HRESULT hres;
+
+    hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
+                                              (void**)&http_negotiate);
+    if(SUCCEEDED(hres)) {
+        static const WCHAR null_string[] = {0};
+
+        IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
+                                            &headers);
+        IHttpNegotiate_Release(http_negotiate);
+    }
+
+    memset(&bindinfo, 0, sizeof(bindinfo));
+    bindinfo.cbSize = sizeof(bindinfo);
+
+    hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
+    dump_BINDINFO(&bindinfo);
+    if(bindinfo.dwBindVerb == BINDVERB_POST) {
+        post_data_len = bindinfo.cbstgmedData;
+        if(post_data_len)
+            post_data = bindinfo.stgmedData.u.hGlobal;
+    }
+
+    hres = navigate_mon(This, mon, post_data, post_data_len, headers);
+
+    CoTaskMemFree(headers);
+    ReleaseBindInfo(&bindinfo);
+
+    return hres;
+}
+
+HRESULT go_home(DocHost *This)
+{
+    static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
+
+    FIXME("stub\n");
+
+    return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
+}
+
+#define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface)
+
+static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
+}
+
+static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    return IWebBrowser2_AddRef(WEBBROWSER2(This));
+}
+
+static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    return IWebBrowser2_Release(WEBBROWSER2(This));
+}
+
+static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
+                                                  IHlinkBrowseContext *pihlbc)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pihlbc);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
+                                                  IHlinkBrowseContext **ppihlbc)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppihlbc);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
+                                          IBindStatusCallback *pibsc, IHlink *pihlNavigate)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    IMoniker *mon;
+    LPWSTR location = NULL;
+
+    TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
+
+    if(grfHLNF)
+        FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
+
+    /* Windows calls GetTargetFrameName here. */
+
+    IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
+
+    if(location) {
+        FIXME("location = %s\n", debugstr_w(location));
+        CoTaskMemFree(location);
+    }
+
+    /* Windows calls GetHlinkSite here */
+
+    if(grfHLNF & HLNF_OPENINNEWWINDOW) {
+        FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
+        return E_NOTIMPL;
+    }
+
+    return navigate_hlink(&This->doc_host, mon, pbc, pibsc);
+}
+
+static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
+        IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
+          debugstr_w(pwzFriendlyName), dwreserved);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
+        IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
+{
+    WebBrowser *This = HLINKFRAME_THIS(iface);
+    FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
+          debugstr_w(pwzFriendlyName));
+    return E_NOTIMPL;
+}
+
+#undef HLINKFRAME_THIS
+
+static const IHlinkFrameVtbl HlinkFrameVtbl = {
+    HlinkFrame_QueryInterface,
+    HlinkFrame_AddRef,
+    HlinkFrame_Release,
+    HlinkFrame_SetBrowseContext,
+    HlinkFrame_GetBrowseContext,
+    HlinkFrame_Navigate,
+    HlinkFrame_OnNavigate,
+    HlinkFrame_UpdateHlink
+};
+
+void WebBrowser_HlinkFrame_Init(WebBrowser *This)
+{
+    This->lpHlinkFrameVtbl = &HlinkFrameVtbl;
+}
Index: dll/win32/shdocvw/dochost.c
===================================================================
--- dll/win32/shdocvw/dochost.c	(Revision 31635)
+++ dll/win32/shdocvw/dochost.c	(Arbeitskopie)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 Jacek Caban for CodeWeavers
+ * Copyright 2005-2006 Jacek Caban for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "wine/debug.h"
@@ -25,7 +25,7 @@
 
 static ATOM doc_view_atom = 0;
 
-static void navigate_complete(WebBrowser *This)
+static void navigate_complete(DocHost *This)
 {
     IDispatch *disp = NULL;
     DISPPARAMS dispparams;
@@ -49,16 +49,17 @@
     V_DISPATCH(params+1) = disp;
 
     V_VT(&url) = VT_BSTR;
-    V_BSTR(&url) = This->url;
+    V_BSTR(&url) = SysAllocString(This->url);
 
-    call_sink(This->cp_wbe2, DISPID_NAVIGATECOMPLETE2, &dispparams);
-    call_sink(This->cp_wbe2, DISPID_DOCUMENTCOMPLETE, &dispparams);
+    call_sink(This->cps.wbe2, DISPID_NAVIGATECOMPLETE2, &dispparams);
+    call_sink(This->cps.wbe2, DISPID_DOCUMENTCOMPLETE, &dispparams);
 
+    SysFreeString(V_BSTR(&url));
     if(disp)
         IDispatch_Release(disp);
 }
 
-static LRESULT navigate2(WebBrowser *This)
+static LRESULT navigate2(DocHost *This)
 {
     IHlinkTarget *hlink;
     HRESULT hres;
@@ -88,7 +89,7 @@
     return 0;
 }
 
-static LRESULT resize_document(WebBrowser *This, LONG width, LONG height)
+static LRESULT resize_document(DocHost *This, LONG width, LONG height)
 {
     RECT rect = {0, 0, width, height};
 
@@ -102,12 +103,12 @@
 
 static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    WebBrowser *This;
+    DocHost *This;
 
     static const WCHAR wszTHIS[] = {'T','H','I','S',0};
 
     if(msg == WM_CREATE) {
-        This = *(WebBrowser**)lParam;
+        This = *(DocHost**)lParam;
         SetPropW(hwnd, wszTHIS, This);
     }else {
         This = GetPropW(hwnd, wszTHIS);
@@ -120,10 +121,10 @@
         return navigate2(This);
     }
 
-    return DefWindowProcA(hwnd, msg, wParam, lParam);
+    return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
 
-void create_doc_view_hwnd(WebBrowser *This)
+void create_doc_view_hwnd(DocHost *This)
 {
     RECT rect;
 
@@ -146,60 +147,168 @@
         doc_view_atom = RegisterClassExW(&wndclass);
     }
 
-    GetWindowRect(This->shell_embedding_hwnd, &rect);
-    This->doc_view_hwnd = CreateWindowExW(0, wszShell_DocObject_View,
+    GetClientRect(This->frame_hwnd, &rect); /* FIXME */
+    This->hwnd = CreateWindowExW(0, wszShell_DocObject_View,
          wszShell_DocObject_View,
-         WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
-         rect.left, rect.top, rect.right, rect.bottom, This->shell_embedding_hwnd,
+         WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
+         rect.left, rect.top, rect.right, rect.bottom, This->frame_hwnd,
          NULL, shdocvw_hinstance, This);
 }
 
-#define DOCHOSTUI_THIS(iface) DEFINE_THIS(WebBrowser, DocHostUIHandler, iface)
+void deactivate_document(DocHost *This)
+{
+    IOleInPlaceObjectWindowless *winobj;
+    IOleObject *oleobj = NULL;
+    IHlinkTarget *hlink = NULL;
+    HRESULT hres;
 
+    if(This->view)
+        IOleDocumentView_UIActivate(This->view, FALSE);
+
+    hres = IUnknown_QueryInterface(This->document, &IID_IOleInPlaceObjectWindowless,
+                                   (void**)&winobj);
+    if(SUCCEEDED(hres)) {
+        IOleInPlaceObjectWindowless_InPlaceDeactivate(winobj);
+        IOleInPlaceObjectWindowless_Release(winobj);
+    }
+
+    if(This->view) {
+        IOleDocumentView_Show(This->view, FALSE);
+        IOleDocumentView_CloseView(This->view, 0);
+        IOleDocumentView_SetInPlaceSite(This->view, NULL);
+        IOleDocumentView_Release(This->view);
+        This->view = NULL;
+    }
+
+    hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
+    if(SUCCEEDED(hres))
+        IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
+
+    hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
+    if(SUCCEEDED(hres)) {
+        IHlinkTarget_SetBrowseContext(hlink, NULL);
+        IHlinkTarget_Release(hlink);
+    }
+
+    if(oleobj) {
+        IOleClientSite *client_site = NULL;
+
+        IOleObject_GetClientSite(oleobj, &client_site);
+        if(client_site) {
+            if(client_site == CLIENTSITE(This))
+                IOleObject_SetClientSite(oleobj, NULL);
+            IOleClientSite_Release(client_site);
+        }
+
+        IOleObject_Release(oleobj);
+    }
+
+    IUnknown_Release(This->document);
+    This->document = NULL;
+}
+
+#define OLECMD_THIS(iface) DEFINE_THIS(DocHost, OleCommandTarget, iface)
+
+static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
+        REFIID riid, void **ppv)
+{
+    DocHost *This = OLECMD_THIS(iface);
+    return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
+}
+
+static ULONG WINAPI ClOleCommandTarget_AddRef(IOleCommandTarget *iface)
+{
+    DocHost *This = OLECMD_THIS(iface);
+    return IOleClientSite_AddRef(CLIENTSITE(This));
+}
+
+static ULONG WINAPI ClOleCommandTarget_Release(IOleCommandTarget *iface)
+{
+    DocHost *This = OLECMD_THIS(iface);
+    return IOleClientSite_Release(CLIENTSITE(This));
+}
+
+static HRESULT WINAPI ClOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
+        const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
+{
+    DocHost *This = OLECMD_THIS(iface);
+    FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
+          pCmdText);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface,
+        const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
+        VARIANT *pvaOut)
+{
+    DocHost *This = OLECMD_THIS(iface);
+    FIXME("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
+          nCmdexecopt, pvaIn, pvaOut);
+    return E_NOTIMPL;
+}
+
+#undef OLECMD_THIS
+
+static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
+    ClOleCommandTarget_QueryInterface,
+    ClOleCommandTarget_AddRef,
+    ClOleCommandTarget_Release,
+    ClOleCommandTarget_QueryStatus,
+    ClOleCommandTarget_Exec
+};
+
+#define DOCHOSTUI_THIS(iface) DEFINE_THIS(DocHost, DocHostUIHandler, iface)
+
 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
                                                       REFIID riid, void **ppv)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
 }
 
 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     return IOleClientSite_AddRef(CLIENTSITE(This));
 }
 
 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     return IOleClientSite_Release(CLIENTSITE(This));
 }
 
 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface,
          DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    FIXME("(%p)->(%ld %p %p %p)\n", This, dwID, ppt, pcmdtReserved, pdispReserved);
+    DocHost *This = DOCHOSTUI_THIS(iface);
+    HRESULT hres;
+
+    TRACE("(%p)->(%ld %p %p %p)\n", This, dwID, ppt, pcmdtReserved, pdispReserved);
+
+    if(This->hostui) {
+        hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt, pcmdtReserved,
+                                                 pdispReserved);
+        if(hres == S_OK)
+            return S_OK;
+    }
+
+    FIXME("default action not implemented\n");
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface,
         DOCHOSTUIINFO *pInfo)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    IDocHostUIHandler *handler;
+    DocHost *This = DOCHOSTUI_THIS(iface);
     HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, pInfo);
 
-    if(This->client) {
-        hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler, (void**)&handler);
-        if(SUCCEEDED(hres)) {
-            hres = IDocHostUIHandler_GetHostInfo(handler, pInfo);
-            IDocHostUIHandler_Release(handler);
-            if(SUCCEEDED(hres))
-                return hres;
-        }
+    if(This->hostui) {
+        hres = IDocHostUIHandler_GetHostInfo(This->hostui, pInfo);
+        if(SUCCEEDED(hres))
+            return hres;
     }
 
     pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_OPENNEWWIN
@@ -212,7 +321,7 @@
         IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
         IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%ld %p %p %p %p)\n", This, dwID, pActiveObject, pCommandTarget,
           pFrame, pDoc);
     return E_NOTIMPL;
@@ -220,22 +329,27 @@
 
 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    FIXME("(%p)\n", This);
-    return E_NOTIMPL;
+    DocHost *This = DOCHOSTUI_THIS(iface);
+
+    TRACE("(%p)\n", This);
+
+    if(!This->hostui)
+        return S_FALSE;
+
+    return IDocHostUIHandler_UpdateUI(This->hostui);
 }
 
 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface,
                                                       BOOL fEnable)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fEnable);
     return E_NOTIMPL;
 }
@@ -243,7 +357,7 @@
 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface,
                                                            BOOL fActivate)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fActivate);
     return E_NOTIMPL;
 }
@@ -251,7 +365,7 @@
 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface,
                                                              BOOL fActivate)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fActivate);
     return E_NOTIMPL;
 }
@@ -259,7 +373,7 @@
 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface,
         LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%p %p %X)\n", This, prcBorder, pUIWindow, fRameWindow);
     return E_NOTIMPL;
 }
@@ -267,7 +381,7 @@
 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface,
         LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%p %p %ld)\n", This, lpMsg, pguidCmdGroup, nCmdID);
     return E_NOTIMPL;
 }
@@ -275,30 +389,20 @@
 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
         LPOLESTR *pchKey, DWORD dw)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    IDocHostUIHandler *handler;
-    HRESULT hres;
+    DocHost *This = DOCHOSTUI_THIS(iface);
 
     TRACE("(%p)->(%p %ld)\n", This, pchKey, dw);
 
-    if(!This->client)
-        return S_OK;
+    if(This->hostui)
+        return IDocHostUIHandler_GetOptionKeyPath(This->hostui, pchKey, dw);
 
-    hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
-                                         (void**)&handler);
-    if(SUCCEEDED(hres)) {
-        hres = IDocHostUIHandler_GetOptionKeyPath(handler, pchKey, dw);
-        IDocHostUIHandler_Release(handler);
-        return hres;
-    }
-
     return S_OK;
 }
 
 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
         IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -306,23 +410,35 @@
 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface,
         IDispatch **ppDispatch)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, ppDispatch);
+    DocHost *This = DOCHOSTUI_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, ppDispatch);
+
+    if(This->hostui)
+        return IDocHostUIHandler_GetExternal(This->hostui, ppDispatch);
+
+    FIXME("default action not implemented\n");
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface,
         DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
-    FIXME("(%p)->(%ld %s %p)\n", This, dwTranslate, debugstr_w(pchURLIn), ppchURLOut);
-    return E_NOTIMPL;
+    DocHost *This = DOCHOSTUI_THIS(iface);
+
+    TRACE("(%p)->(%ld %s %p)\n", This, dwTranslate, debugstr_w(pchURLIn), ppchURLOut);
+
+    if(This->hostui)
+        return IDocHostUIHandler_TranslateUrl(This->hostui, dwTranslate,
+                                              pchURLIn, ppchURLOut);
+
+    return S_FALSE;
 }
 
 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface,
         IDataObject *pDO, IDataObject **ppDORet)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     FIXME("(%p)->(%p %p)\n", This, pDO, ppDORet);
     return E_NOTIMPL;
 }
@@ -330,16 +446,16 @@
 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
         LPOLESTR *pchKey, DWORD dw)
 {
-    WebBrowser *This = DOCHOSTUI_THIS(iface);
+    DocHost *This = DOCHOSTUI_THIS(iface);
     IDocHostUIHandler2 *handler;
     HRESULT hres;
 
     TRACE("(%p)->(%p %ld)\n", This, pchKey, dw);
 
-    if(!This->client)
+    if(!This->hostui)
         return S_OK;
 
-    hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler2,
+    hres = IDocHostUIHandler_QueryInterface(This->hostui, &IID_IDocHostUIHandler2,
                                          (void**)&handler);
     if(SUCCEEDED(hres)) {
         hres = IDocHostUIHandler2_GetOverrideKeyPath(handler, pchKey, dw);
@@ -374,9 +490,42 @@
     DocHostUIHandler_GetOverrideKeyPath
 };
 
-void WebBrowser_DocHost_Init(WebBrowser *This)
+void DocHost_Init(DocHost *This, IDispatch *disp)
 {
     This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
+    This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
 
-    This->doc_view_hwnd = NULL;
+    This->disp = disp;
+
+    This->client_disp = NULL;
+
+    This->document = NULL;
+    This->hostui = NULL;
+    This->frame = NULL;
+
+    This->hwnd = NULL;
+    This->frame_hwnd = NULL;
+    This->url = NULL;
+
+    This->silent = VARIANT_FALSE;
+    This->offline = VARIANT_FALSE;
+
+    DocHost_ClientSite_Init(This);
+    DocHost_Frame_Init(This);
+
+    ConnectionPointContainer_Init(&This->cps, (IUnknown*)disp);
 }
+
+void DocHost_Release(DocHost *This)
+{
+    if(This->client_disp)
+        IDispatch_Release(This->client_disp);
+    if(This->frame)
+        IOleInPlaceFrame_Release(This->frame);
+
+    DocHost_ClientSite_Release(This);
+
+    ConnectionPointContainer_Destroy(&This->cps);
+
+    SysFreeString(This->url);
+}
Index: dll/win32/shdocvw/oleobject.c
===================================================================
--- dll/win32/shdocvw/oleobject.c	(Revision 31635)
+++ dll/win32/shdocvw/oleobject.c	(Arbeitskopie)
@@ -20,21 +20,26 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <string.h>
 #include "wine/debug.h"
 #include "shdocvw.h"
+#include "htiframe.h"
+#include "idispids.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
+/* shlwapi.dll */
+HWND WINAPI SHSetParentHwnd(HWND hWnd, HWND hWndParent);
+
 static ATOM shell_embedding_atom = 0;
 
 static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
 {
-    if(This->doc_view_hwnd)
-        SetWindowPos(This->doc_view_hwnd, NULL, 0, 0, width, height,
+    if(This->doc_host.hwnd)
+        SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
                      SWP_NOZORDER | SWP_NOACTIVATE);
 
     return 0;
@@ -58,7 +63,7 @@
         return resize_window(This, LOWORD(lParam), HIWORD(lParam));
     }
 
-    return DefWindowProcA(hwnd, msg, wParam, lParam);
+    return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
 
 static void create_shell_embedding_hwnd(WebBrowser *This)
@@ -91,12 +96,150 @@
         IOleInPlaceSite_Release(inplace);
     }
 
-    This->shell_embedding_hwnd = CreateWindowExW(0, wszShellEmbedding, wszShellEmbedding,
-         WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP | WS_MAXIMIZEBOX,
+    This->doc_host.frame_hwnd = This->shell_embedding_hwnd = CreateWindowExW(
+            WS_EX_WINDOWEDGE,
+            wszShellEmbedding, wszShellEmbedding,
+            WS_CLIPSIBLINGS | WS_CLIPCHILDREN
+            | (parent ? WS_CHILD | WS_TABSTOP : WS_POPUP | WS_MAXIMIZEBOX),
          0, 0, 0, 0, parent,
          NULL, shdocvw_hinstance, This);
+
+    TRACE("parent=%p hwnd=%p\n", parent, This->shell_embedding_hwnd);
 }
 
+static HRESULT activate_inplace(WebBrowser *This, IOleClientSite *active_site)
+{
+    HWND parent_hwnd;
+    HRESULT hres;
+
+    if(This->inplace)
+        return S_OK;
+
+    if(!active_site)
+        return E_INVALIDARG;
+
+    hres = IOleClientSite_QueryInterface(active_site, &IID_IOleInPlaceSite,
+                                         (void**)&This->inplace);
+    if(FAILED(hres)) {
+        WARN("Could not get IOleInPlaceSite\n");
+        return hres;
+    }
+
+    hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
+    if(hres != S_OK) {
+        WARN("CanInPlaceActivate returned: %08x\n", hres);
+        IOleInPlaceSite_Release(This->inplace);
+        return E_FAIL;
+    }
+
+    hres = IOleInPlaceSite_GetWindow(This->inplace, &parent_hwnd);
+    if(SUCCEEDED(hres))
+        SHSetParentHwnd(This->shell_embedding_hwnd, parent_hwnd);
+
+    IOleInPlaceSite_OnInPlaceActivate(This->inplace);
+
+    IOleInPlaceSite_GetWindowContext(This->inplace, &This->doc_host.frame, &This->uiwindow,
+                                     &This->pos_rect, &This->clip_rect,
+                                     &This->frameinfo);
+
+    SetWindowPos(This->shell_embedding_hwnd, NULL,
+                 This->pos_rect.left, This->pos_rect.top,
+                 This->pos_rect.right-This->pos_rect.left,
+                 This->pos_rect.bottom-This->pos_rect.top,
+                 SWP_NOZORDER | SWP_SHOWWINDOW);
+
+    if(This->client) {
+        IOleClientSite_ShowObject(This->client);
+        IOleClientSite_GetContainer(This->client, &This->container);
+    }
+
+    if(This->doc_host.frame)
+        IOleInPlaceFrame_GetWindow(This->doc_host.frame, &This->frame_hwnd);
+
+    return S_OK;
+}
+
+static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site)
+{
+    HRESULT hres;
+
+    static const WCHAR wszitem[] = {'i','t','e','m',0};
+
+    if(This->inplace)
+        return S_OK;
+
+    hres = activate_inplace(This, active_site);
+    if(FAILED(hres))
+        return hres;
+
+    IOleInPlaceSite_OnUIActivate(This->inplace);
+
+    if(This->doc_host.frame)
+        IOleInPlaceFrame_SetActiveObject(This->doc_host.frame, ACTIVEOBJ(This), wszitem);
+    if(This->uiwindow)
+        IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, ACTIVEOBJ(This), wszitem);
+
+    if(This->doc_host.frame)
+        IOleInPlaceFrame_SetMenu(This->doc_host.frame, NULL, NULL, This->shell_embedding_hwnd);
+
+    SetFocus(This->shell_embedding_hwnd);
+
+    return S_OK;
+}
+
+static HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
+{
+    IDispatch *disp = NULL;
+    DISPPARAMS dispparams = {NULL, 0};
+    HRESULT hres;
+
+    VariantInit(res);
+
+    if(!client)
+        return S_OK;
+
+    hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
+    if(FAILED(hres)) {
+        TRACE("Could not get IDispatch\n");
+        return hres;
+    }
+
+    hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
+            DISPATCH_PROPERTYGET, &dispparams, res, NULL, NULL);
+
+    IDispatch_Release(disp);
+
+    return hres;
+}
+
+static HRESULT on_offlineconnected_change(WebBrowser *This)
+{
+    VARIANT offline;
+
+    get_client_disp_property(This->client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
+
+    if(V_VT(&offline) == VT_BOOL)
+        IWebBrowser2_put_Offline(WEBBROWSER2(This), V_BOOL(&offline));
+    else if(V_VT(&offline) != VT_EMPTY)
+        WARN("wrong V_VT(silent) %d\n", V_VT(&offline));
+
+    return S_OK;
+}
+
+static HRESULT on_silent_change(WebBrowser *This)
+{
+    VARIANT silent;
+
+    get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent);
+
+    if(V_VT(&silent) == VT_BOOL)
+        IWebBrowser2_put_Silent(WEBBROWSER2(This), V_BOOL(&silent));
+    else if(V_VT(&silent) != VT_EMPTY)
+        WARN("wrong V_VT(silent) %d\n", V_VT(&silent));
+
+    return S_OK;
+}
+
 /**********************************************************************
  * Implement the IOleObject interface for the WebBrowser control
  */
@@ -124,28 +267,71 @@
 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
+    IOleContainer *container;
+    HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, pClientSite);
 
     if(This->client == pClientSite)
         return S_OK;
 
-    if(This->doc_view_hwnd)
-        DestroyWindow(This->doc_view_hwnd);
-    if(This->shell_embedding_hwnd)
+    if(This->doc_host.hwnd) {
+        DestroyWindow(This->doc_host.hwnd);
+        This->doc_host.hwnd = NULL;
+    }
+    if(This->shell_embedding_hwnd) {
         DestroyWindow(This->shell_embedding_hwnd);
+        This->shell_embedding_hwnd = NULL;
+    }
 
+    if(This->inplace) {
+        IOleInPlaceSite_Release(This->inplace);
+        This->inplace = NULL;
+    }
+
+    if(This->doc_host.hostui) {
+        IDocHostUIHandler_Release(This->doc_host.hostui);
+        This->doc_host.hostui = NULL;
+    }
+
     if(This->client)
         IOleClientSite_Release(This->client);
 
     This->client = pClientSite;
-    if(!pClientSite)
+
+    if(!pClientSite) {
+        if(This->doc_host.document)
+            deactivate_document(&This->doc_host);
         return S_OK;
+    }
 
     IOleClientSite_AddRef(pClientSite);
 
+    IOleClientSite_QueryInterface(This->client, &IID_IDispatch,
+                                  (void**)&This->doc_host.client_disp);
+
+    IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
+                                  (void**)&This->doc_host.hostui);
+
+    hres = IOleClientSite_GetContainer(This->client, &container);
+    if(SUCCEEDED(hres)) {
+        ITargetContainer *target_container;
+
+        hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer,
+                                            (void**)&target_container);
+        if(SUCCEEDED(hres)) {
+            FIXME("Unsupported ITargetContainer\n");
+            ITargetContainer_Release(target_container);
+        }
+
+        IOleContainer_Release(container);
+    }
+
     create_shell_embedding_hwnd(This);
 
+    on_offlineconnected_change(This);
+    on_silent_change(This);
+
     return S_OK;
 }
 
@@ -169,8 +355,11 @@
         LPCOLESTR szContainerObj)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
+
+    /* We have nothing to do here. */
+    return S_OK;
 }
 
 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
@@ -215,81 +404,26 @@
         LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    HRESULT hres;
 
-    static const WCHAR wszitem[] = {'i','t','e','m',0};
-
     TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
             lprcPosRect);
 
     switch (iVerb)
     {
     case OLEIVERB_SHOW:
-    case OLEIVERB_INPLACEACTIVATE: {
-        IOleInPlaceSite *inplace;
-
+        TRACE("OLEIVERB_SHOW\n");
+        return activate_ui(This, pActiveSite);
+    case OLEIVERB_UIACTIVATE:
+        TRACE("OLEIVERB_UIACTIVATE\n");
+        return activate_ui(This, pActiveSite);
+    case OLEIVERB_INPLACEACTIVATE:
         TRACE("OLEIVERB_INPLACEACTIVATE\n");
-
-        if(!pActiveSite)
-            return E_INVALIDARG;
-
-        hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleInPlaceSite, (void**)&inplace);
-        if(FAILED(hres)) {
-            WARN("Could not get IOleInPlaceSite\n");
-            return hres;
-        }
-
-        hres = IOleInPlaceSite_CanInPlaceActivate(inplace);
-        if(hres != S_OK) {
-            WARN("CanInPlaceActivate returned: %08lx\n", hres);
-            IOleInPlaceSite_Release(inplace);
-            return E_FAIL;
-        }
-
-        hres = IOleInPlaceSite_GetWindow(inplace, &This->iphwnd);
-        if(FAILED(hres))
-            This->iphwnd = hwndParent;
-
-        IOleInPlaceSite_OnInPlaceActivate(inplace);
-
-        IOleInPlaceSite_GetWindowContext(inplace, &This->frame, &This->uiwindow,
-                                         &This->pos_rect, &This->clip_rect,
-                                         &This->frameinfo);
-
-
-        if(iVerb == OLEIVERB_INPLACEACTIVATE)
-            IOleInPlaceSite_Release(inplace);
-
-        SetWindowPos(This->shell_embedding_hwnd, NULL,
-                     This->pos_rect.left, This->pos_rect.top,
-                     This->pos_rect.right-This->pos_rect.left,
-                     This->pos_rect.bottom-This->pos_rect.top,
-                     SWP_NOZORDER | SWP_SHOWWINDOW);
-
-        if(This->client) {
-            IOleClientSite_ShowObject(This->client);
-            IOleClientSite_GetContainer(This->client, &This->container);
-        }
-
-        if(This->frame)
-            IOleInPlaceFrame_GetWindow(This->frame, &This->frame_hwnd);
-
-        if(iVerb == OLEIVERB_INPLACEACTIVATE)
-            return S_OK;
-
-        TRACE("OLEIVERB_SHOW\n");
-
-        IOleInPlaceSite_OnUIActivate(inplace);
-        IOleInPlaceSite_Release(inplace);
-
-        IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem);
-
-        /* TODO:
-         * IOleInPlaceFrmae_SetMenu
-         */
-
+        return activate_inplace(This, pActiveSite);
+    case OLEIVERB_HIDE:
+        TRACE("OLEIVERB_HIDE\n");
+        if(This->doc_host.hwnd)
+            ShowWindow(This->doc_host.hwnd, SW_HIDE);
         return S_OK;
-    }
     default:
         FIXME("stub for %ld\n", iVerb);
         break;
@@ -337,15 +471,23 @@
 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
+
+    /* Tests show that dwDrawAspect is ignored */
+    memcpy(&This->extent, psizel, sizeof(SIZEL));
+    return S_OK;
 }
 
 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
+
+    /* Tests show that dwDrawAspect is ignored */
+    memcpy(psizel, &This->extent, sizeof(SIZEL));
+    return S_OK;
 }
 
 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
@@ -373,6 +515,7 @@
 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
+
     HRESULT hres;
 
     TRACE("(%p)->(%lx, %p)\n", This, dwAspect, pdwStatus);
@@ -451,22 +594,9 @@
 {
     WebBrowser *This = INPLACEOBJ_THIS(iface);
 
-    FIXME("(%p)->(%p)\n", This, phwnd);
+    TRACE("(%p)->(%p)\n", This, phwnd);
 
-#if 0
-    /* Create a fake window to fool MFC into believing that we actually
-     * have an implemented browser control.  Avoids the assertion.
-     */
-    HWND hwnd;
-    hwnd = CreateWindowA("BUTTON", "Web Control",
-                        WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
-                        CW_USEDEFAULT, CW_USEDEFAULT, 600,
-                        400, NULL, NULL, NULL, NULL);
-
-    *phwnd = hwnd;
-    TRACE ("Returning hwnd = %d\n", hwnd);
-#endif
-
+    *phwnd = This->shell_embedding_hwnd;
     return S_OK;
 }
 
@@ -499,6 +629,11 @@
 
     TRACE("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
 
+    memcpy(&This->pos_rect, lprcPosRect, sizeof(RECT));
+
+    if(lprcClipRect)
+        memcpy(&This->clip_rect, lprcClipRect, sizeof(RECT));
+
     if(This->shell_embedding_hwnd) {
         SetWindowPos(This->shell_embedding_hwnd, NULL,
                      lprcPosRect->left, lprcPosRect->top,
@@ -560,7 +695,10 @@
 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
 {
     WebBrowser *This = CONTROL_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pCI);
+
+    TRACE("(%p)->(%p)\n", This, pCI);
+
+    /* Tests show that this function should be not implemented */
     return E_NOTIMPL;
 }
 
@@ -574,7 +712,17 @@
 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
 {
     WebBrowser *This = CONTROL_THIS(iface);
-    FIXME("(%p)->(%ld)\n", This, dispID);
+
+    TRACE("(%p)->(%d)\n", This, dispID);
+
+    switch(dispID) {
+    case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
+        return on_offlineconnected_change(This);
+    case DISPID_AMBIENT_SILENT:
+        return on_silent_change(This);
+    }
+
+    FIXME("Unknown dispID %d\n", dispID);
     return E_NOTIMPL;
 }
 
@@ -688,24 +836,77 @@
     InPlaceActiveObject_EnableModeless
 };
 
+#define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
+
+static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
+        REFIID riid, void **ppv)
+{
+    WebBrowser *This = OLECMD_THIS(iface);
+    return IWebBrowser2_QueryInterface(WEBBROWSER(This), riid, ppv);
+}
+
+static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
+{
+    WebBrowser *This = OLECMD_THIS(iface);
+    return IWebBrowser2_AddRef(WEBBROWSER(This));
+}
+
+static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
+{
+    WebBrowser *This = OLECMD_THIS(iface);
+    return IWebBrowser2_Release(WEBBROWSER(This));
+}
+
+static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
+        const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
+{
+    WebBrowser *This = OLECMD_THIS(iface);
+    FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
+          pCmdText);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
+        const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
+        VARIANT *pvaOut)
+{
+    WebBrowser *This = OLECMD_THIS(iface);
+    FIXME("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
+          nCmdexecopt, pvaIn, pvaOut);
+    return E_NOTIMPL;
+}
+
+#undef OLECMD_THIS
+
+static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
+    WBOleCommandTarget_QueryInterface,
+    WBOleCommandTarget_AddRef,
+    WBOleCommandTarget_Release,
+    WBOleCommandTarget_QueryStatus,
+    WBOleCommandTarget_Exec
+};
+
 void WebBrowser_OleObject_Init(WebBrowser *This)
 {
     This->lpOleObjectVtbl              = &OleObjectVtbl;
     This->lpOleInPlaceObjectVtbl       = &OleInPlaceObjectVtbl;
     This->lpOleControlVtbl             = &OleControlVtbl;
     This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
+    This->lpOleCommandTargetVtbl     = &OleCommandTargetVtbl;
 
     This->client = NULL;
+    This->inplace = NULL;
     This->container = NULL;
-    This->iphwnd = NULL;
     This->frame_hwnd = NULL;
-    This->frame = NULL;
     This->uiwindow = NULL;
     This->shell_embedding_hwnd = NULL;
 
     memset(&This->pos_rect, 0, sizeof(RECT));
     memset(&This->clip_rect, 0, sizeof(RECT));
     memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
+
+    This->extent.cx = 1323;
+    This->extent.cy = 529;
 }
 
 void WebBrowser_OleObject_Destroy(WebBrowser *This)
@@ -714,8 +915,6 @@
         IOleObject_SetClientSite(OLEOBJ(This), NULL);
     if(This->container)
         IOleContainer_Release(This->container);
-    if(This->frame)
-        IOleInPlaceFrame_Release(This->frame);
     if(This->uiwindow)
         IOleInPlaceUIWindow_Release(This->uiwindow);
 }
Index: dll/win32/shdocvw/shdocvw.inf
===================================================================
--- dll/win32/shdocvw/shdocvw.inf	(Revision 0)
+++ dll/win32/shdocvw/shdocvw.inf	(Revision 0)
@@ -0,0 +1,137 @@
+[version]
+Signature="$CHICAGO$"
+
+
+[RegisterDll]
+AddReg=Classes.Reg
+
+
+[UnregisterDll]
+DelReg=Classes.Reg
+
+
+[RegisterIE]
+AddReg=IE.Reg, Settings.Reg
+
+
+[UnregisterIE]
+DelReg=IE.Reg, Settings.Reg
+
+
+[Classes.Reg]
+HKCR,"CLSID\%CLSID_InternetExplorer%",,,"Internet Explorer(Ver 1.0)"
+HKCR,"CLSID\%CLSID_InternetExplorer%\LocalServer32",,,"iexplore.exe"
+HKCR,"CLSID\%CLSID_InternetExplorer%\ProgID",,,"InternetExplorer.Application.1"
+HKCR,"CLSID\%CLSID_InternetExplorer%\VersionIndependentProgID",,,"InternetExplorer.Application"
+HKCR,"InternetExplorer.Application",,,"Internet Explorer(Ver 1.0)"
+HKCR,"InternetExplorer.Application\CLSID",,,"%CLSID_InternetExplorer%"
+HKCR,"InternetExplorer.Application\CurVer",,,"InternetExplorer.Application.1"
+HKCR,"InternetExplorer.Application.1",,,"Internet Explorer(Ver 1.0)"
+HKCR,"InternetExplorer.Application.1\CLSID",,,"%CLSID_InternetExplorer%"
+
+HKCR,"CLSID\%CLSID_SearchAssistantOC%",,,"SearchAssistantOC"
+HKCR,"CLSID\%CLSID_SearchAssistantOC%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_SearchAssistantOC%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_SearchAssistantOC%\ProgID",,,"SearchAssistantOC.SearchAssistantOC.1"
+HKCR,"CLSID\%CLSID_SearchAssistantOC%\VersionIndependentProgID",,,"SearchAssistantOC.SearchAssistantOC"
+HKCR,"SearchAssistantOC.SearchAssistantOC",,,""
+HKCR,"SearchAssistantOC.SearchAssistantOC\CLSID",,,"%CLSID_SearchAssistantOC%"
+HKCR,"SearchAssistantOC.SearchAssistantOC\CurVer",,,"SearchAssistantOC.SearchAssistantOC.1"
+HKCR,"SearchAssistantOC.SearchAssistantOC.1",,,""
+HKCR,"SearchAssistantOC.SearchAssistantOC.1\CLSID",,,"%CLSID_SearchAssistantOC%"
+
+HKCR,"CLSID\%CLSID_ShellNameSpace%",,,"Shell Name Space"
+HKCR,"CLSID\%CLSID_ShellNameSpace%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_ShellNameSpace%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_ShellNameSpace%\ProgID",,,"ShellNameSpace.ShellNameSpace.1"
+HKCR,"CLSID\%CLSID_ShellNameSpace%\VersionIndependentProgID",,,"ShellNameSpace.ShellNameSpace"
+
+HKCR,"CLSID\%CLSID_CUrlHistory%",,,"Microsoft Url History Service"
+HKCR,"CLSID\%CLSID_CUrlHistory%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_CUrlHistory%\InProcServer32","ThreadingModel",,"Apartment"
+
+HKCR,"CLSID\%CLSID_MruLongList%",,,"MruLongList"
+HKCR,"CLSID\%CLSID_MruLongList%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_MruLongList%\InProcServer32","ThreadingModel",,"Apartment"
+
+HKCR,"CLSID\%CLSID_ShellShellNameSpace%",,,"Shell Name Space"
+HKCR,"CLSID\%CLSID_ShellShellNameSpace%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_ShellShellNameSpace%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_ShellShellNameSpace%\ProgID",,,"ShellNameSpace.ShellNameSpace.1"
+HKCR,"CLSID\%CLSID_ShellShellNameSpace%\VersionIndependentProgID",,,"ShellNameSpace.ShellNameSpace"
+
+HKCR,"CLSID\%CLSID_ShellUIHelper%",,,"Microsoft Shell UI Helper"
+HKCR,"CLSID\%CLSID_ShellUIHelper%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_ShellUIHelper%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_ShellUIHelper%\ProgID",,,"Shell.UIHelper.1"
+HKCR,"Shell.UIHelper",,,"Microsoft Shell UI Helper"
+HKCR,"Shell.UIHelper\CLSID",,,"%CLSID_ShellUIHelper%"
+HKCR,"Shell.UIHelper\CurVer",,,"Shell.UIHelper.2"
+HKCR,"Shell.UIHelper.1",,,""
+HKCR,"Shell.UIHelper.1\CLSID",,,"%CLSID_ShellUIHelper%"
+
+HKCR,"CLSID\%CLSID_Internet%",,,"Internet Explorer"
+HKCR,"CLSID\%CLSID_Internet%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_Internet%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_Internet%\ShellFolder",,2,"0x24"
+
+HKCR,"CLSID\%CLSID_WebBrowser%",,,"Microsoft Web Browser"
+HKCR,"CLSID\%CLSID_WebBrowser%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_WebBrowser%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_WebBrowser%\ProgID",,,"Shell.Explorer.2"
+HKCR,"CLSID\%CLSID_WebBrowser%\VersionIndependentProgID",,,"Shell.Explorer"
+HKCR,"Shell.Explorer",,,"Microsoft Web Browser"
+HKCR,"Shell.Explorer\CLSID",,,"%CLSID_WebBrowser%"
+HKCR,"Shell.Explorer\CurVer",,,"Shell.Explorer.2"
+HKCR,"Shell.Explorer.2",,,""
+HKCR,"Shell.Explorer.2\CLSID",,,"%CLSID_WebBrowser%"
+
+HKCR,"CLSID\%CLSID_ShellWindows%",,,"ShellWindows"
+HKCR,"CLSID\%CLSID_ShellWindows%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_ShellWindows%\InProcServer32","ThreadingModel",,"Apartment"
+
+HKCR,"CLSID\%CLSID_MicrosoftBrowserArchitecture%",,,"Microsoft Browser Architecture"
+HKCR,"CLSID\%CLSID_MicrosoftBrowserArchitecture%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_MicrosoftBrowserArchitecture%\InProcServer32","ThreadingModel",,"Apartment"
+
+HKCR,"CLSID\%CLSID_ShellSearchAssistantOC%",,,"SearchAssistantOC"
+HKCR,"CLSID\%CLSID_ShellSearchAssistantOC%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_ShellSearchAssistantOC%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_ShellSearchAssistantOC%\ProgID",,,"SearchAssistantOC.SearchAssistantOC.1"
+HKCR,"CLSID\%CLSID_ShellSearchAssistantOC%\VersionIndependentProgID",,,"SearchAssistantOC.SearchAssistantOC"
+
+HKCR,"CLSID\%CLSID_WebBrowser_V1%",,,"Microsoft Web Browser Version 1"
+HKCR,"CLSID\%CLSID_WebBrowser_V1%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_WebBrowser_V1%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_WebBrowser_V1%\ProgID",,,"Shell.Explorer.1"
+HKCR,"CLSID\%CLSID_WebBrowser_V1%\VersionIndependentProgID",,,"Shell.Explorer"
+HKCR,"Shell.Explorer.1",,,""
+HKCR,"Shell.Explorer.1\CLSID",,,"%CLSID_WebBrowser_V1%"
+
+HKCR,"CLSID\%CLSID_InternetShortcut%",,,"Internet Shortcut"
+HKCR,"CLSID\%CLSID_InternetShortcut%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_InternetShortcut%\InProcServer32","ThreadingModel",,"Apartment"
+HKCR,"CLSID\%CLSID_InternetShortcut%\ProgID",,,"InternetShortcut"
+HKCR,"CLSID\%CLSID_InternetShortcut%\shellex\MayChangeDefaultMenu",,,
+HKCR,"InternetShortcut",,,"Internet Shortcut"
+HKCR,"InternetShortcut","EditFlags",2,"2"
+HKCR,"InternetShortcut","IsShortcut",,
+HKCR,"InternetShortcut","NeverShowExt",,
+HKCR,"InternetShortcut\CLSID",,,"%CLSID_InteretShortcut%"
+HKCR,"InternetShortcut\DefaultIcon",,,"url.dll,0"
+HKCR,"InternetShortcut\shell\open\command",,,"rundll32.exe shdocvw.dll,OpenURL %l"
+HKCR,"InternetShortcut\shell\print\command",,,"rundll32.exe mshtml.dll,PrintHTML \"%1\""
+HKCR,"InternetShortcut\shell\printto\command",,,"rundll32.exe mshtml.dll,PrintHTML \"%1\" \"%2\" \"%3\" \"%4\""
+
+
+[Settings.Reg]
+HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",,"http://www.winehq.org"
+HKCU,"Software\Microsoft\Internet Explorer\Main","Search Page",,"http://www.google.com"
+
+
+[IE.Reg]
+HKLM,"Software\Microsoft\Internet Explorer","Version",,"6.0.2900.2180"
+
+
+[Strings]
+MODULE="shdocvw.dll"
Index: dll/win32/shdocvw/regsvr.c
===================================================================
--- dll/win32/shdocvw/regsvr.c	(Revision 31635)
+++ dll/win32/shdocvw/regsvr.c	(Arbeitskopie)
@@ -18,6 +18,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* There is an implementation in factory.c */
+#if 0
+
 #include <stdarg.h>
 #include <string.h>
 
@@ -549,3 +552,6 @@
 	hr = unregister_interfaces(interface_list);
     return hr;
 }
+
+#endif
+
Index: dll/win32/shdocvw/client.c
===================================================================
--- dll/win32/shdocvw/client.c	(Revision 31635)
+++ dll/win32/shdocvw/client.c	(Arbeitskopie)
@@ -13,19 +13,23 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <stdio.h>
+
 #include "wine/debug.h"
 #include "shdocvw.h"
+#include "mshtmdid.h"
+#include "idispids.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
-#define CLIENTSITE_THIS(iface) DEFINE_THIS(WebBrowser, OleClientSite, iface)
+#define CLIENTSITE_THIS(iface) DEFINE_THIS(DocHost, OleClientSite, iface)
 
 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
 
     *ppv = NULL;
 
@@ -50,10 +54,19 @@
     }else if(IsEqualGUID(&IID_IOleDocumentSite, riid)) {
         TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This, ppv);
         *ppv = DOCSITE(This);
+    }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
+        TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
+        *ppv = OLECMD(This);
+    }else if(IsEqualGUID(&IID_IDispatch, riid)) {
+        TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
+        *ppv = CLDISP(This);
+    }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
+        TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
+        *ppv = SERVPROV(This);
     }
 
     if(*ppv) {
-        IWebBrowser2_AddRef(WEBBROWSER(This));
+        IOleClientSite_AddRef(CLIENTSITE(This));
         return S_OK;
     }
 
@@ -64,19 +77,19 @@
 
 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
-    return IWebBrowser2_AddRef(WEBBROWSER(This));
+    DocHost *This = CLIENTSITE_THIS(iface);
+    return IDispatch_AddRef(This->disp);
 }
 
 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
-    return IWebBrowser2_Release(WEBBROWSER(This));
+    DocHost *This = CLIENTSITE_THIS(iface);
+    return IDispatch_Release(This->disp);
 }
 
 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -84,35 +97,35 @@
 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
                                             DWORD dwWhichMoniker, IMoniker **ppmk)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
-    FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
+    DocHost *This = CLIENTSITE_THIS(iface);
+    FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
     FIXME("(%p)->(%p)\n", This, ppContainer);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fShow);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
 {
-    WebBrowser *This = CLIENTSITE_THIS(iface);
+    DocHost *This = CLIENTSITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -131,46 +144,46 @@
     ClientSite_RequestNewObjectLayout
 };
 
-#define INPLACESITE_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceSite, iface)
+#define INPLACESITE_THIS(iface) DEFINE_THIS(DocHost, OleInPlaceSite, iface)
 
 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
 }
 
 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     return IOleClientSite_AddRef(CLIENTSITE(This));
 }
 
 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     return IOleClientSite_Release(CLIENTSITE(This));
 }
 
 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
 
     TRACE("(%p)->(%p)\n", This, phwnd);
 
-    *phwnd = This->doc_view_hwnd;
+    *phwnd = This->hwnd;
     return S_OK;
 }
 
 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fEnterMode);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
 
     TRACE("(%p)\n", This);
 
@@ -180,7 +193,7 @@
 
 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
 
     TRACE("(%p)\n", This);
 
@@ -190,7 +203,7 @@
 
 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -199,20 +212,21 @@
         IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
         LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
 
     TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
           lprcClipRect, lpFrameInfo);
 
+    IOleInPlaceFrame_AddRef(INPLACEFRAME(This));
     *ppFrame = INPLACEFRAME(This);
     *ppDoc = NULL;
 
-    GetClientRect(This->doc_view_hwnd, lprcPosRect);
+    GetClientRect(This->hwnd, lprcPosRect);
     memcpy(lprcClipRect, lprcPosRect, sizeof(RECT));
 
     lpFrameInfo->cb = sizeof(*lpFrameInfo);
     lpFrameInfo->fMDIApp = FALSE;
-    lpFrameInfo->hwndFrame = This->shell_embedding_hwnd;
+    lpFrameInfo->hwndFrame = This->frame_hwnd;
     lpFrameInfo->haccel = NULL;
     lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
 
@@ -221,35 +235,38 @@
 
 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)->({%ld %ld})\n", This, scrollExtent.cx, scrollExtent.cy);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fUndoable);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
-    FIXME("(%p)\n", This);
-    return E_NOTIMPL;
+    DocHost *This = INPLACESITE_THIS(iface);
+
+    TRACE("(%p)\n", This);
+
+    /* Nothing to do here */
+    return S_OK;
 }
 
 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
@@ -257,7 +274,7 @@
 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
                                                   LPCRECT lprcPosRect)
 {
-    WebBrowser *This = INPLACESITE_THIS(iface);
+    DocHost *This = INPLACESITE_THIS(iface);
     FIXME("(%p)->(%p)\n", This, lprcPosRect);
     return E_NOTIMPL;
 }
@@ -282,31 +299,31 @@
     InPlaceSite_OnPosRectChange
 };
 
-#define DOCSITE_THIS(iface) DEFINE_THIS(WebBrowser, OleDocumentSite, iface)
+#define DOCSITE_THIS(iface) DEFINE_THIS(DocHost, OleDocumentSite, iface)
 
 static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
                                                      REFIID riid, void **ppv)
 {
-    WebBrowser *This = DOCSITE_THIS(iface);
+    DocHost *This = DOCSITE_THIS(iface);
     return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
 }
 
 static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
 {
-    WebBrowser *This = DOCSITE_THIS(iface);
+    DocHost *This = DOCSITE_THIS(iface);
     return IOleClientSite_AddRef(CLIENTSITE(This));
 }
 
 static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
 {
-    WebBrowser *This = DOCSITE_THIS(iface);
+    DocHost *This = DOCSITE_THIS(iface);
     return IOleClientSite_Release(CLIENTSITE(This));
 }
 
 static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
                                                  IOleDocumentView *pViewToActivate)
 {
-    WebBrowser *This = DOCSITE_THIS(iface);
+    DocHost *This = DOCSITE_THIS(iface);
     IOleDocument *oledoc;
     RECT rect;
     HRESULT hres;
@@ -320,7 +337,7 @@
     IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view);
     IOleDocument_Release(oledoc);
 
-    GetClientRect(This->doc_view_hwnd, &rect);
+    GetClientRect(This->hwnd, &rect);
     IOleDocumentView_SetRect(This->view, &rect);
 
     hres = IOleDocumentView_Show(This->view, TRUE);
@@ -337,16 +354,176 @@
     OleDocumentSite_ActivateMe
 };
 
-void WebBrowser_ClientSite_Init(WebBrowser *This)
+#define DISP_THIS(iface) DEFINE_THIS(DocHost, Dispatch, iface)
+
+static HRESULT WINAPI ClDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
 {
+    DocHost *This = DISP_THIS(iface);
+    return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
+}
+
+static ULONG WINAPI ClDispatch_AddRef(IDispatch *iface)
+{
+    DocHost *This = DISP_THIS(iface);
+    return IOleClientSite_AddRef(CLIENTSITE(This));
+}
+
+static ULONG WINAPI ClDispatch_Release(IDispatch *iface)
+{
+    DocHost *This = DISP_THIS(iface);
+    return IOleClientSite_Release(CLIENTSITE(This));
+}
+
+static HRESULT WINAPI ClDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
+{
+    DocHost *This = DISP_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, pctinfo);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
+                                             ITypeInfo **ppTInfo)
+{
+    DocHost *This = DISP_THIS(iface);
+
+    TRACE("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
+                                               UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    DocHost *This = DISP_THIS(iface);
+
+    TRACE("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
+          lcid, rgDispId);
+
+    return E_NOTIMPL;
+}
+
+static const char *debugstr_dispid(DISPID dispid)
+{
+    static char buf[16];
+
+#define CASE_DISPID(did) case did: return #did
+    switch(dispid) {
+        CASE_DISPID(DISPID_AMBIENT_USERMODE);
+        CASE_DISPID(DISPID_AMBIENT_DLCONTROL);
+        CASE_DISPID(DISPID_AMBIENT_USERAGENT);
+        CASE_DISPID(DISPID_AMBIENT_PALETTE);
+        CASE_DISPID(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
+        CASE_DISPID(DISPID_AMBIENT_SILENT);
+    }
+#undef CASE_DISPID
+
+    sprintf(buf, "%ld", dispid);
+    return buf;
+}
+
+static HRESULT WINAPI ClDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
+                                        LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+                                        VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    DocHost *This = DISP_THIS(iface);
+
+    TRACE("(%p)->(%s %s %d %04x %p %p %p %p)\n", This, debugstr_dispid(dispIdMember),
+          debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+
+    switch(dispIdMember) {
+    case DISPID_AMBIENT_USERMODE:
+    case DISPID_AMBIENT_DLCONTROL:
+    case DISPID_AMBIENT_USERAGENT:
+    case DISPID_AMBIENT_PALETTE:
+        if(!This->client_disp)
+            return E_FAIL;
+        return IDispatch_Invoke(This->client_disp, dispIdMember, riid, lcid, wFlags,
+                                pDispParams, pVarResult, pExcepInfo, puArgErr);
+    case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
+        V_VT(pVarResult) = VT_BOOL;
+        V_BOOL(pVarResult) = This->offline;
+        return S_OK;
+    case DISPID_AMBIENT_SILENT:
+        V_VT(pVarResult) = VT_BOOL;
+        V_BOOL(pVarResult) = This->offline;
+        return S_OK;
+    }
+
+    FIXME("unhandled dispid %d\n", dispIdMember);
+    return E_NOTIMPL;
+}
+
+#undef DISP_THIS
+
+static const IDispatchVtbl DispatchVtbl = {
+    ClDispatch_QueryInterface,
+    ClDispatch_AddRef,
+    ClDispatch_Release,
+    ClDispatch_GetTypeInfoCount,
+    ClDispatch_GetTypeInfo,
+    ClDispatch_GetIDsOfNames,
+    ClDispatch_Invoke
+};
+
+#define SERVPROV_THIS(iface) DEFINE_THIS(DocHost, ServiceProvider, iface)
+
+static HRESULT WINAPI ClServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid,
+                                                       void **ppv)
+{
+    DocHost *This = SERVPROV_THIS(iface);
+    return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
+}
+
+static ULONG WINAPI ClServiceProvider_AddRef(IServiceProvider *iface)
+{
+    DocHost *This = SERVPROV_THIS(iface);
+    return IOleClientSite_AddRef(CLIENTSITE(This));
+}
+
+static ULONG WINAPI ClServiceProvider_Release(IServiceProvider *iface)
+{
+    DocHost *This = SERVPROV_THIS(iface);
+    return IOleClientSite_Release(CLIENTSITE(This));
+}
+
+static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
+                                                     REFIID riid, void **ppv)
+{
+    DocHost *This = SERVPROV_THIS(iface);
+
+    if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
+        TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
+        return IDispatch_QueryInterface(This->disp, riid, ppv);
+    }
+
+    FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
+
+    return E_NOINTERFACE;
+}
+
+#undef SERVPROV_THIS
+
+static const IServiceProviderVtbl ServiceProviderVtbl = {
+    ClServiceProvider_QueryInterface,
+    ClServiceProvider_AddRef,
+    ClServiceProvider_Release,
+    ClServiceProvider_QueryService
+};
+
+void DocHost_ClientSite_Init(DocHost *This)
+{
     This->lpOleClientSiteVtbl   = &OleClientSiteVtbl;
     This->lpOleInPlaceSiteVtbl  = &OleInPlaceSiteVtbl;
     This->lpOleDocumentSiteVtbl = &OleDocumentSiteVtbl;
+    This->lpDispatchVtbl        = &DispatchVtbl;
+    This->lpServiceProviderVtbl = &ServiceProviderVtbl;
 
     This->view = NULL;
 }
 
-void WebBrowser_ClientSite_Destroy(WebBrowser *This)
+void DocHost_ClientSite_Release(DocHost *This)
 {
     if(This->view)
         IOleDocumentView_Release(This->view);
Index: dll/win32/shdocvw/classinfo.c
===================================================================
--- dll/win32/shdocvw/classinfo.c	(Revision 31635)
+++ dll/win32/shdocvw/classinfo.c	(Arbeitskopie)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
@@ -70,24 +70,19 @@
 {
     WebBrowser *This = CLASSINFO_THIS(iface);
 
-    FIXME("(%p)->(%ld %p)\n", This, dwGuidKind, pGUID);
+    TRACE("(%p)->(%ld %p)\n", This, dwGuidKind, pGUID);
 
-    if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
-    {
-        FIXME ("Requested unsupported GUID type: %ld\n", dwGuidKind);
-        return E_FAIL;  /* Is there a better return type here? */
+    if(!pGUID)
+        return E_POINTER;
+
+    if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID) {
+        WARN("Wrong GUID type: %d\n", dwGuidKind);
+        memcpy(pGUID, &IID_NULL, sizeof(GUID));
+        return E_FAIL;
     }
 
-    /* FIXME: Returning IPropertyNotifySink interface, but should really
-     * return a more generic event set (???) dispinterface.
-     * However, this hack, allows a control site to return with success
-     * (MFC's COleControlSite falls back to older IProvideClassInfo interface
-     * if GetGUID() fails to return a non-NULL GUID).
-     */
-    memcpy(pGUID, &IID_IPropertyNotifySink, sizeof(GUID));
-    FIXME("Wrongly returning IPropertyNotifySink interface %s\n",
-          debugstr_guid(pGUID));
-
+    memcpy(pGUID, This->version == 1 ? &DIID_DWebBrowserEvents : &DIID_DWebBrowserEvents2,
+           sizeof(GUID));
     return S_OK;
 }
 
Index: dll/win32/shdocvw/iexplore.c
===================================================================
--- dll/win32/shdocvw/iexplore.c	(Revision 0)
+++ dll/win32/shdocvw/iexplore.c	(Revision 0)
@@ -0,0 +1,231 @@
+/*
+ * SHDOCVW - Internet Explorer main frame window
+ *
+ * Copyright 2006 Mike McCormack (for CodeWeavers)
+ * Copyright 2006 Jacek Caban (for CodeWeavers)
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "winnls.h"
+#include "ole2.h"
+#include "exdisp.h"
+#include "oleidl.h"
+
+#include "shdocvw.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+static const WCHAR szIEWinFrame[] = { 'I','E','F','r','a','m','e',0 };
+
+static LRESULT iewnd_OnCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
+{
+    SetWindowLongPtrW(hwnd, 0, (LONG_PTR) lpcs->lpCreateParams);
+    return 0;
+}
+
+static LRESULT iewnd_OnSize(InternetExplorer *This, INT width, INT height)
+{
+    if(This->doc_host.hwnd)
+        SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
+                     SWP_NOZORDER | SWP_NOACTIVATE);
+
+    return 0;
+}
+
+static LRESULT iewnd_OnDestroy(InternetExplorer *This)
+{
+    TRACE("%p\n", This);
+
+    This->frame_hwnd = NULL;
+    PostQuitMessage(0); /* FIXME */
+
+    return 0;
+}
+
+static LRESULT CALLBACK
+ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    InternetExplorer *This = (InternetExplorer*) GetWindowLongPtrW(hwnd, 0);
+
+    switch (msg)
+    {
+    case WM_CREATE:
+        return iewnd_OnCreate(hwnd, (LPCREATESTRUCTW)lparam);
+    case WM_DESTROY:
+        return iewnd_OnDestroy(This);
+    case WM_SIZE:
+        return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam));
+    }
+    return DefWindowProcW(hwnd, msg, wparam, lparam);
+}
+
+void register_iewindow_class(void)
+{
+    WNDCLASSW wc;
+
+    memset(&wc, 0, sizeof wc);
+    wc.style = 0;
+    wc.lpfnWndProc = ie_window_proc;
+    wc.cbClsExtra = 0;
+    wc.cbWndExtra = sizeof(InternetExplorer*);
+    wc.hInstance = shdocvw_hinstance;
+    wc.hIcon = 0;
+    wc.hCursor = LoadCursorW(0, MAKEINTRESOURCEW(IDI_APPLICATION));
+    wc.hbrBackground = 0;
+    wc.lpszClassName = szIEWinFrame;
+    wc.lpszMenuName = NULL;
+
+    RegisterClassW(&wc);
+}
+
+void unregister_iewindow_class(void)
+{
+    UnregisterClassW(szIEWinFrame, shdocvw_hinstance);
+}
+
+static void create_frame_hwnd(InternetExplorer *This)
+{
+    /* Windows uses "Microsoft Internet Explorer" */
+    static const WCHAR wszWineInternetExplorer[] =
+        {'W','i','n','e',' ','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
+
+    This->frame_hwnd = CreateWindowExW(
+            WS_EX_WINDOWEDGE,
+            szIEWinFrame, wszWineInternetExplorer,
+            WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+                | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
+            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+            NULL, NULL /* FIXME */, shdocvw_hinstance, This);
+}
+
+static IWebBrowser2 *create_ie_window(LPCSTR cmdline)
+{
+    IWebBrowser2 *wb = NULL;
+
+    InternetExplorer_Create(NULL, &IID_IWebBrowser2, (void**)&wb);
+    if(!wb)
+        return NULL;
+
+    IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
+
+    if(!*cmdline) {
+        IWebBrowser2_GoHome(wb);
+    }else {
+        VARIANT var_url;
+        DWORD len;
+
+        if(!strncasecmp(cmdline, "-nohome", 7))
+            cmdline += 7;
+
+        V_VT(&var_url) = VT_BSTR;
+
+        len = MultiByteToWideChar(CP_ACP, 0, cmdline, -1, NULL, 0);
+        V_BSTR(&var_url) = SysAllocStringLen(NULL, len);
+        MultiByteToWideChar(CP_ACP, 0, cmdline, -1, V_BSTR(&var_url), len);
+
+        /* navigate to the first page */
+        IWebBrowser2_Navigate2(wb, &var_url, NULL, NULL, NULL, NULL);
+
+        SysFreeString(V_BSTR(&var_url));
+    }
+
+    return wb;
+}
+
+HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv)
+{
+    InternetExplorer *ret;
+    HRESULT hres;
+
+    TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
+
+    ret = HeapAlloc(GetProcessHeap(), 0, sizeof(InternetExplorer));
+    ret->ref = 0;
+
+    ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
+    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
+
+    InternetExplorer_WebBrowser_Init(ret);
+
+    create_frame_hwnd(ret);
+    ret->doc_host.frame_hwnd = ret->frame_hwnd;
+
+    hres = IWebBrowser2_QueryInterface(WEBBROWSER2(ret), riid, ppv);
+    if(FAILED(hres)) {
+        HeapFree(GetProcessHeap(), 0, ret);
+        return hres;
+    }
+
+    return hres;
+}
+
+/******************************************************************
+ *		IEWinMain            (SHDOCVW.101)
+ *
+ * Only returns on error.
+ */
+DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
+{
+    IWebBrowser2 *wb = NULL;
+    MSG msg;
+    HRESULT hres;
+
+    TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow);
+
+    if(*szCommandLine == '-' || *szCommandLine == '/') {
+        if(!strcasecmp(szCommandLine+1, "regserver"))
+            return register_iexplore(TRUE);
+        if(!strcasecmp(szCommandLine+1, "unregserver"))
+            return register_iexplore(FALSE);
+    }
+
+    CoInitialize(NULL);
+
+    hres = register_class_object(TRUE);
+    if(FAILED(hres)) {
+        CoUninitialize();
+        ExitProcess(1);
+    }
+
+    if(strcasecmp(szCommandLine, "-embedding"))
+        wb = create_ie_window(szCommandLine);
+
+    /* run the message loop for this thread */
+    while (GetMessageW(&msg, 0, 0, 0))
+    {
+        TranslateMessage(&msg);
+        DispatchMessageW(&msg);
+    }
+
+    if(wb)
+        IWebBrowser2_Release(wb);
+
+    register_class_object(FALSE);
+
+    CoUninitialize();
+
+    ExitProcess(0);
+    return 0;
+}
Index: dll/win32/shdocvw/shdocvw.rc
===================================================================
--- dll/win32/shdocvw/shdocvw.rc	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw.rc	(Arbeitskopie)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "windef.h"
@@ -39,3 +39,6 @@
 #include "Ru.rc"
 #include "Sv.rc"
 #include "Uk.rc"
+
+/* @makedep: shdocvw.inf */
+REGINST REGINST shdocvw.inf
Index: dll/win32/shdocvw/events.c
===================================================================
--- dll/win32/shdocvw/events.c	(Revision 31635)
+++ dll/win32/shdocvw/events.c	(Arbeitskopie)
@@ -5,6 +5,7 @@
  *  - IConnectionPoint
  *
  * Copyright 2001 John R. Sheets (for CodeWeavers)
+ * Copyright 2006 Jacek Caban for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,7 +19,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <string.h>
@@ -30,7 +31,7 @@
 struct ConnectionPoint {
     const IConnectionPointVtbl *lpConnectionPointVtbl;
 
-    WebBrowser *webbrowser;
+    IConnectionPointContainer *container;
 
     IDispatch **sinks;
     DWORD sinks_size;
@@ -44,31 +45,31 @@
  * Implement the IConnectionPointContainer interface
  */
 
-#define CONPTCONT_THIS(iface) DEFINE_THIS(WebBrowser, ConnectionPointContainer, iface)
+#define CONPTCONT_THIS(iface) DEFINE_THIS(ConnectionPointContainer, ConnectionPointContainer, iface)
 
 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
-        REFIID riid, LPVOID *ppobj)
+        REFIID riid, LPVOID *ppv)
 {
-    WebBrowser *This = CONPTCONT_THIS(iface);
-    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_QueryInterface(This->impl, riid, ppv);
 }
 
 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
 {
-    WebBrowser *This = CONPTCONT_THIS(iface);
-    return IWebBrowser_AddRef(WEBBROWSER(This));
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_AddRef(This->impl);
 }
 
 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
 {
-    WebBrowser *This = CONPTCONT_THIS(iface);
-    return IWebBrowser_Release(WEBBROWSER(This));
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_Release(This->impl);
 }
 
 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
         LPENUMCONNECTIONPOINTS *ppEnum)
 {
-    WebBrowser *This = CONPTCONT_THIS(iface);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
     FIXME("(%p)->(%p)\n", This, ppEnum);
     return E_NOTIMPL;
 }
@@ -76,7 +77,7 @@
 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
         REFIID riid, LPCONNECTIONPOINT *ppCP)
 {
-    WebBrowser *This = CONPTCONT_THIS(iface);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
 
     if(!ppCP) {
         WARN("ppCP == NULL\n");
@@ -87,13 +88,13 @@
 
     if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) {
         TRACE("(%p)->(DIID_DWebBrowserEvents2 %p)\n", This, ppCP);
-        *ppCP = CONPOINT(This->cp_wbe2);
+        *ppCP = CONPOINT(This->wbe2);
     }else if(IsEqualGUID(&DIID_DWebBrowserEvents, riid)) {
         TRACE("(%p)->(DIID_DWebBrowserEvents %p)\n", This, ppCP);
-        *ppCP = CONPOINT(This->cp_wbe);
+        *ppCP = CONPOINT(This->wbe);
     }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
         TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppCP);
-        *ppCP = CONPOINT(This->cp_pns);
+        *ppCP = CONPOINT(This->pns);
     }
 
     if(*ppCP) {
@@ -102,7 +103,7 @@
     }
 
     WARN("Unsupported IID %s\n", debugstr_guid(riid));
-    return E_NOINTERFACE;
+    return CONNECT_E_NOCONNECTION;
 }
 
 #undef CONPTCONT_THIS
@@ -139,7 +140,7 @@
     }
 
     if(*ppv) {
-        IWebBrowser2_AddRef(WEBBROWSER(This->webbrowser));
+        IConnectionPointContainer_AddRef(This->container);
         return S_OK;
     }
 
@@ -150,13 +151,13 @@
 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
 {
     ConnectionPoint *This = CONPOINT_THIS(iface);
-    return IWebBrowser2_AddRef(WEBBROWSER(This->webbrowser));
+    return IConnectionPointContainer_AddRef(This->container);
 }
 
 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
 {
     ConnectionPoint *This = CONPOINT_THIS(iface);
-    return IWebBrowser2_Release(WEBBROWSER(This->webbrowser));
+    return IConnectionPointContainer_Release(This->container);
 }
 
 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
@@ -176,7 +177,8 @@
 
     TRACE("(%p)->(%p)\n", This, ppCPC);
 
-    *ppCPC = CONPTCONT(This->webbrowser);
+    *ppCPC = This->container;
+    IConnectionPointContainer_AddRef(This->container);
     return S_OK;
 }
 
@@ -266,15 +268,16 @@
     }
 }
 
-static void ConnectionPoint_Create(WebBrowser *wb, REFIID riid, ConnectionPoint **cp)
+static void ConnectionPoint_Create(REFIID riid, ConnectionPoint **cp,
+                                   IConnectionPointContainer *container)
 {
     ConnectionPoint *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ConnectionPoint));
 
     ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
-    ret->webbrowser = wb;
 
     ret->sinks = NULL;
     ret->sinks_size = 0;
+    ret->container = container;
 
     memcpy(&ret->iid, riid, sizeof(IID));
 
@@ -294,18 +297,20 @@
     HeapFree(GetProcessHeap(), 0, This);
 }
 
-void WebBrowser_Events_Init(WebBrowser *This)
+void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *impl)
 {
     This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
 
-    ConnectionPoint_Create(This, &DIID_DWebBrowserEvents2, &This->cp_wbe2);
-    ConnectionPoint_Create(This, &DIID_DWebBrowserEvents, &This->cp_wbe);
-    ConnectionPoint_Create(This, &IID_IPropertyNotifySink, &This->cp_pns);
+    ConnectionPoint_Create(&DIID_DWebBrowserEvents2, &This->wbe2, CONPTCONT(This));
+    ConnectionPoint_Create(&DIID_DWebBrowserEvents,  &This->wbe,  CONPTCONT(This));
+    ConnectionPoint_Create(&IID_IPropertyNotifySink, &This->pns,  CONPTCONT(This));
+
+    This->impl = impl;
 }
 
-void WebBrowser_Events_Destroy(WebBrowser *This)
+void ConnectionPointContainer_Destroy(ConnectionPointContainer *This)
 {
-    ConnectionPoint_Destroy(This->cp_wbe2);
-    ConnectionPoint_Destroy(This->cp_wbe);
-    ConnectionPoint_Destroy(This->cp_pns);
+    ConnectionPoint_Destroy(This->wbe2);
+    ConnectionPoint_Destroy(This->wbe);
+    ConnectionPoint_Destroy(This->pns);
 }
Index: dll/win32/shdocvw/version.rc
===================================================================
--- dll/win32/shdocvw/version.rc	(Revision 31635)
+++ dll/win32/shdocvw/version.rc	(Arbeitskopie)
@@ -13,15 +13,15 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #define WINE_OLESELFREGISTER
 #define WINE_FILEDESCRIPTION_STR "Wine core dll"
 #define WINE_FILENAME_STR "shdocvw.dll"
-#define WINE_FILEVERSION 5,50,0,0
-#define WINE_FILEVERSION_STR "5.50.0.0"
-#define WINE_PRODUCTVERSION 5,50,0,0
-#define WINE_PRODUCTVERSION_STR "5.50"
+#define WINE_FILEVERSION 6,0,2900,2180
+#define WINE_FILEVERSION_STR "6.0.2900.2180"
+#define WINE_PRODUCTVERSION 6,0,2900,2180
+#define WINE_PRODUCTVERSION_STR "6.0.2900.2180"
 
 #include "wine/wine_common_ver.rc"
Index: dll/win32/shdocvw/factory.c
===================================================================
--- dll/win32/shdocvw/factory.c	(Revision 31635)
+++ dll/win32/shdocvw/factory.c	(Arbeitskopie)
@@ -15,13 +15,19 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <string.h>
-#include "wine/debug.h"
+#include <stdio.h>
+
 #include "shdocvw.h"
+#include "winreg.h"
+#include "advpub.h"
+#include "isguids.h"
 
+#include "wine/debug.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
 /**********************************************************************
@@ -30,6 +36,8 @@
  * (Based on implementation in ddraw/main.c)
  */
 
+#define FACTORY(x) ((IClassFactory*) &(x)->lpVtbl)
+
 /**********************************************************************
  * WBCF_QueryInterface (IUnknown)
  */
@@ -43,6 +51,7 @@
 
     if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
         *ppobj = iface;
+        IClassFactory_AddRef(iface);
         return S_OK;
     }
 
@@ -78,7 +87,8 @@
 static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
                                           REFIID riid, LPVOID *ppobj)
 {
-    return WebBrowser_Create(pOuter, riid, ppobj);
+    IClassFactoryImpl *This = (IClassFactoryImpl *) iface;
+    return This->cf(pOuter, riid, ppobj);
 }
 
 /************************************************************************
@@ -105,4 +115,174 @@
     WBCF_LockServer
 };
 
-IClassFactoryImpl SHDOCVW_ClassFactory = {&WBCF_Vtbl};
+/*************************************************************************
+ *              DllGetClassObject (SHDOCVW.@)
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
+{
+    static IClassFactoryImpl WB1ClassFactory = {&WBCF_Vtbl, WebBrowserV1_Create};
+    static IClassFactoryImpl WB2ClassFactory = {&WBCF_Vtbl, WebBrowserV2_Create};
+    static IClassFactoryImpl CUHClassFactory = {&WBCF_Vtbl, CUrlHistory_Create};
+
+    TRACE("\n");
+
+    if(IsEqualGUID(&CLSID_WebBrowser, rclsid))
+        return IClassFactory_QueryInterface(FACTORY(&WB2ClassFactory), riid, ppv);
+
+    if(IsEqualGUID(&CLSID_WebBrowser_V1, rclsid))
+        return IClassFactory_QueryInterface(FACTORY(&WB1ClassFactory), riid, ppv);
+
+    if(IsEqualGUID(&CLSID_CUrlHistory, rclsid))
+        return IClassFactory_QueryInterface(FACTORY(&CUHClassFactory), riid, ppv);
+
+    /* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
+    return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
+}
+
+HRESULT register_class_object(BOOL do_reg)
+{
+    HRESULT hres;
+
+    static DWORD cookie;
+    static IClassFactoryImpl IEClassFactory = {&WBCF_Vtbl, InternetExplorer_Create};
+
+    if(do_reg) {
+        hres = CoRegisterClassObject(&CLSID_InternetExplorer, (IUnknown*)FACTORY(&IEClassFactory),
+                                     CLSCTX_SERVER, REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie);
+        if (FAILED(hres)) {
+            ERR("failed to register object %08x\n", hres);
+            return hres;
+        }
+
+        hres = CoResumeClassObjects();
+        if(SUCCEEDED(hres))
+            return hres;
+
+        ERR("failed to resume object %08x\n", hres);
+    }
+
+    return CoRevokeClassObject(cookie);
+}
+
+static HRESULT reg_install(LPCSTR section, STRTABLEA *strtable)
+{
+    typeof(RegInstallA) *pRegInstall;
+    HMODULE hadvpack;
+    HRESULT hres;
+
+    static const WCHAR advpackW[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
+
+    hadvpack = LoadLibraryW(advpackW);
+    pRegInstall = (typeof(RegInstallA)*)GetProcAddress(hadvpack, "RegInstall");
+
+    hres = pRegInstall(shdocvw_hinstance, section, strtable);
+
+    FreeLibrary(hadvpack);
+    return hres;
+}
+
+/* FIXME: Copy from ddk/isguids.h which is not static */
+static const GUID CLSID_InternetShortcut =
+    {0xFBF23B40, 0xE3F0, 0x101B, {0x84, 0x88, 0x00, 0xAA, 0x00, 0x3E, 0x56, 0xF8}};
+static const GUID CLSID_MicrosoftBrowserArchitecture =
+    {0xa5e46e3a, 0x8849, 0x11d1, {0x9d, 0x8c, 0x00, 0xc0, 0x4f, 0xc9, 0x9d, 0x61}};
+static const GUID CLSID_MruLongList =
+    {0x53bd6b4e, 0x3780, 0x4693, {0xaf, 0xc3, 0x71, 0x61, 0xc2, 0xf3, 0xee, 0x9c}};
+
+#define INF_SET_CLSID(clsid)                  \
+    do                                        \
+    {                                         \
+        static CHAR name[] = "CLSID_" #clsid; \
+                                              \
+        pse[i].pszName = name;                \
+        clsids[i++] = &CLSID_ ## clsid;       \
+    } while (0)
+
+static HRESULT register_server(BOOL doregister)
+{
+    STRTABLEA strtable;
+    STRENTRYA pse[14];
+    static CLSID const *clsids[14];
+    int i = 0;
+    HRESULT hres;
+
+    INF_SET_CLSID(CUrlHistory);
+    INF_SET_CLSID(Internet);
+    INF_SET_CLSID(InternetExplorer);
+    INF_SET_CLSID(InternetShortcut);
+    INF_SET_CLSID(MicrosoftBrowserArchitecture);
+    INF_SET_CLSID(MruLongList);
+    INF_SET_CLSID(SearchAssistantOC);
+    INF_SET_CLSID(ShellNameSpace);
+    INF_SET_CLSID(ShellSearchAssistantOC);
+    INF_SET_CLSID(ShellShellNameSpace);
+    INF_SET_CLSID(ShellUIHelper);
+    INF_SET_CLSID(ShellWindows);
+    INF_SET_CLSID(WebBrowser);
+    INF_SET_CLSID(WebBrowser_V1);
+
+    for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) {
+        pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39);
+        sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+                clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0],
+                clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4],
+                clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]);
+    }
+
+    strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
+    strtable.pse = pse;
+
+    hres = reg_install(doregister ? "RegisterDll" : "UnregisterDll", &strtable);
+
+    for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
+        HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
+
+    return hres;
+}
+
+#undef INF_SET_CLSID
+
+/***********************************************************************
+ *          DllRegisterServer (shdocvw.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+    ITypeLib *typelib;
+    HRESULT hres;
+
+    static const WCHAR shdocvwW[] = {'s','h','d','o','c','v','w','.','d','l','l',0};
+
+    hres = register_server(TRUE);
+    if(FAILED(hres))
+        return hres;
+
+    hres = LoadTypeLibEx(shdocvwW, REGKIND_REGISTER, &typelib);
+    if(FAILED(hres)) {
+        ERR("Could not load typelib: %08x\n", hres);
+        return hres;
+    }
+
+    ITypeLib_Release(typelib);
+
+    return hres;
+}
+
+/***********************************************************************
+ *          DllUnregisterServer (shdocvw.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+    HRESULT hres;
+
+    hres = register_server(FALSE);
+    if(FAILED(hres))
+        return hres;
+
+    return UnRegisterTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, SYS_WIN32);
+}
+
+DWORD register_iexplore(BOOL doregister)
+{
+    HRESULT hres = reg_install(doregister ? "RegisterIE" : "UnregisterIE", NULL);
+    return !SUCCEEDED(hres);
+}
Index: dll/win32/shdocvw/view.c
===================================================================
--- dll/win32/shdocvw/view.c	(Revision 31635)
+++ dll/win32/shdocvw/view.c	(Arbeitskopie)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "wine/debug.h"
Index: dll/win32/shdocvw/shdocvw.rbuild
===================================================================
--- dll/win32/shdocvw/shdocvw.rbuild	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw.rbuild	(Arbeitskopie)
@@ -1,3 +1,5 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
 <module name="shdocvw" type="win32dll" baseaddress="${BASEADDRESS_SHDOCVW}" installbase="system32" installname="shdocvw.dll" allowwarnings="true">
 	<autoregister infsection="OleControlDlls" type="Both" />
 	<importlibrary definition="shdocvw.spec.def" />
@@ -5,8 +7,8 @@
 	<include base="ReactOS">include/reactos/wine</include>
 	<define name="__REACTOS__" />
 	<define name="_WIN32_IE">0x600</define>
-	<define name="_WIN32_WINNT">0x501</define>
-	<define name="WINVER">0x501</define>
+	<define name="_WIN32_WINNT">0x600</define>
+	<define name="WINVER">0x600</define>
 	<define name="_SHDOCVW_" />
 	<library>wine</library>
 	<library>uuid</library>
@@ -17,18 +19,24 @@
 	<library>ole32</library>
 	<library>oleaut32</library>
 	<library>urlmon</library>
+	<library>shell32</library>
+	<library>shlwapi</library>
 	<file>classinfo.c</file>
 	<file>client.c</file>
 	<file>dochost.c</file>
 	<file>events.c</file>
 	<file>factory.c</file>
 	<file>frame.c</file>
+	<file>ie.c</file>
+	<file>iexplore.c</file>
 	<file>misc.c</file>
+	<file>navigate.c</file>
 	<file>oleobject.c</file>
 	<file>persist.c</file>
 	<file>regsvr.c</file>
 	<file>shdocvw_main.c</file>
 	<file>shlinstobj.c</file>
+	<file>urlhist.c</file>
 	<file>view.c</file>
 	<file>webbrowser.c</file>
 	<file>shdocvw.rc</file>
Index: dll/win32/shdocvw/shlinstobj.c
===================================================================
--- dll/win32/shdocvw/shlinstobj.c	(Revision 31635)
+++ dll/win32/shdocvw/shlinstobj.c	(Arbeitskopie)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 /* 'Shell Instance Objects' allow you to add a node to the shell namespace
@@ -170,7 +170,7 @@
     RegistryPropertyBag_IPropertyBag_Write
 };
 
-HRESULT RegistryPropertyBag_Constructor(HKEY hInitPropertyBagKey, REFIID riid, LPVOID *ppvObject) {
+static HRESULT RegistryPropertyBag_Constructor(HKEY hInitPropertyBagKey, REFIID riid, LPVOID *ppvObject) {
     HRESULT hr = E_FAIL;
     RegistryPropertyBag *pRegistryPropertyBag;
 
@@ -314,8 +314,8 @@
     InstanceObjectFactory_IClassFactory_LockServer
 };
 
-HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *pPropertyBag, REFIID riid,
-    LPVOID *ppvObject)
+static HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *pPropertyBag,
+                                                 REFIID riid, LPVOID *ppvObject)
 {
     InstanceObjectFactory *pInstanceObjectFactory;
     HRESULT hr = E_FAIL;
@@ -375,7 +375,7 @@
     TRACE("(rclsid=%s, riid=%s, ppvClassObject=%p)\n", debugstr_guid(rclsid), debugstr_guid(riid),
           ppvClassObj);
 
-    /* Figure if there is an 'Instance' subkey for the given CLSID and aquire a handle. */
+    /* Figure if there is an 'Instance' subkey for the given CLSID and acquire a handle. */
     if (!StringFromGUID2(rclsid, wszInstanceKey + 6, CHARS_IN_GUID) ||
         !(wszInstanceKey[5+CHARS_IN_GUID]='\\') || /* Repair the null-termination. */
         ERROR_SUCCESS != RegOpenKeyExW(HKEY_CLASSES_ROOT, wszInstanceKey, 0, KEY_READ, &hInstanceKey))
Index: dll/win32/shdocvw/webbrowser.c
===================================================================
--- dll/win32/shdocvw/webbrowser.c	(Revision 31635)
+++ dll/win32/shdocvw/webbrowser.c	(Arbeitskopie)
@@ -16,14 +16,13 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "wine/debug.h"
 #include "shdocvw.h"
-#include "mshtml.h"
+#include "exdispid.h"
 
-
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
 /**********************************************************************
@@ -73,6 +72,9 @@
     }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
         TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
         *ppv = PERSTORAGE(This);
+    }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
+        TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
+        *ppv = PERMEMORY(This);
     }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
         TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
         *ppv = PERSTRINIT(This);
@@ -87,7 +89,7 @@
         *ppv = QUICKACT(This);
     }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
         TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
-        *ppv = CONPTCONT(This);
+        *ppv = CONPTCONT(&This->doc_host.cps);
     }else if(IsEqualGUID(&IID_IViewObject, riid)) {
         TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
         *ppv = VIEWOBJ(This);
@@ -97,6 +99,24 @@
     }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
         TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
         *ppv = ACTIVEOBJ(This);
+    }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
+        TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
+        *ppv = OLECMD(This);
+    }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
+        TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
+        *ppv = HLINKFRAME(This);
+    }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;
+    }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;
     }
 
     if(*ppv) {
@@ -124,14 +144,13 @@
     TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
-        if(This->document)
-            IUnknown_Release(This->document);
+        if(This->doc_host.document)
+            IUnknown_Release(This->doc_host.document);
 
+        DocHost_Release(&This->doc_host);
+
         WebBrowser_OleObject_Destroy(This);
-        WebBrowser_Events_Destroy(This);
-        WebBrowser_ClientSite_Destroy(This);
 
-        SysFreeString(This->url);
         HeapFree(GetProcessHeap(), 0, This);
         SHDOCVW_UnlockModule();
     }
@@ -171,9 +190,18 @@
                                 EXCEPINFO *pExepInfo, UINT *puArgErr)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%ld %s %ld %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+    ITypeInfo *typeinfo;
+    HRESULT hres;
+
+    TRACE("(%p)->(%ld %s %ld %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
             lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
-    return E_NOTIMPL;
+
+    hres = get_typeinfo(&typeinfo);
+    if(FAILED(hres))
+        return hres;
+
+    return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
+                            pVarResult, pExepInfo, puArgErr);
 }
 
 /* IWebBrowser methods */
@@ -194,8 +222,8 @@
 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)\n", This);
-    return E_NOTIMPL;
+    TRACE("(%p)\n", This);
+    return go_home(&This->doc_host);
 }
 
 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
@@ -205,14 +233,16 @@
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR URL,
+static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
                                   VARIANT *Flags, VARIANT *TargetFrameName,
                                   VARIANT *PostData, VARIANT *Headers)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(URL), Flags, TargetFrameName,
+
+    TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
           PostData, Headers);
-    return E_NOTIMPL;
+
+    return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
 }
 
 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
@@ -239,8 +269,15 @@
 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, ppDisp);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, ppDisp);
+
+    if(!ppDisp)
+        return E_POINTER;
+
+    *ppDisp = (IDispatch*)WEBBROWSER2(This);
+    IDispatch_AddRef(*ppDisp);
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
@@ -264,8 +301,8 @@
     TRACE("(%p)->(%p)\n", This, ppDisp);
 
     *ppDisp = NULL;
-    if(This->document)
-        IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)ppDisp);
+    if(This->doc_host.document)
+        IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
 
     return S_OK;
 }
@@ -287,57 +324,113 @@
 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, long *pl)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pl);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pl);
+
+    *pl = This->pos_rect.left;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, long Left)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%ld)\n", This, Left);
-    return E_NOTIMPL;
+    RECT rect;
+
+    TRACE("(%p)->(%ld)\n", This, Left);
+
+    if(!This->inplace)
+        return E_UNEXPECTED;
+
+    memcpy(&rect, &This->pos_rect, sizeof(RECT));
+    rect.left = Left;
+
+    /* We don't really change the window position here.
+     * We just notify the embedder that he should do so. */
+    return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
 }
 
 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, long *pl)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pl);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pl);
+
+    *pl = This->pos_rect.top;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, long Top)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%ld)\n", This, Top);
-    return E_NOTIMPL;
+    RECT rect;
+
+    TRACE("(%p)->(%ld)\n", This, Top);
+
+    if(!This->inplace)
+        return E_UNEXPECTED;
+
+    memcpy(&rect, &This->pos_rect, sizeof(RECT));
+    rect.top = Top;
+
+    /* We don't really change the window position here.
+     * We just notify the embedder that he should do so. */
+    return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
 }
 
 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, long *pl)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pl);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pl);
+
+    *pl = This->pos_rect.right - This->pos_rect.left;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, long Width)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%ld)\n", This, Width);
-    return E_NOTIMPL;
+    RECT rect;
+
+    TRACE("(%p)->(%ld)\n", This, Width);
+
+    if(!This->inplace)
+        return E_UNEXPECTED;
+
+    memcpy(&rect, &This->pos_rect, sizeof(RECT));
+    rect.right = rect.left+Width;
+ 
+    /* 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);
 }
 
 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, long *pl)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pl);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pl);
+
+    *pl = This->pos_rect.bottom - This->pos_rect.top;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, long Height)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%ld)\n", This, Height);
-    return E_NOTIMPL;
+    RECT rect;
+
+    TRACE("(%p)->(%ld)\n", This, Height);
+
+    if(!This->inplace)
+        return E_UNEXPECTED;
+
+    memcpy(&rect, &This->pos_rect, sizeof(RECT));
+    rect.bottom = rect.top+Height;
+
+    /* 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);
 }
 
 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
@@ -350,8 +443,17 @@
 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
+
     FIXME("(%p)->(%p)\n", This, LocationURL);
-    return E_NOTIMPL;
+
+    if(!This->doc_host.url) {
+        static const WCHAR null_char = 0;
+        *LocationURL = SysAllocString(&null_char);
+        return S_FALSE;
+    }
+
+    *LocationURL = SysAllocString(This->doc_host.url);
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
@@ -364,8 +466,11 @@
 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)\n", This);
-    return E_NOTIMPL;
+
+    TRACE("(%p)\n", This);
+
+    /* It's a InternetExplorer specific method, we have nothing to do here. */
+    return E_FAIL;
 }
 
 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
@@ -399,8 +504,12 @@
 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, long *pHWND)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pHWND);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pHWND);
+
+    /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
+    *pHWND = 0;
+    return E_FAIL;
 }
 
 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
@@ -420,29 +529,58 @@
 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pBool);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pBool);
+
+    *pBool = This->visible;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+    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;
+    call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pBool);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pBool);
+
+    *pBool = This->status_bar;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+    VARIANTARG arg;
+    DISPPARAMS dispparams = {&arg, NULL, 1, 0};
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
+
+    /* In opposition to InternetExplorer, all we should do here is
+     * inform the embedder about the status bar change. */
+
+    V_VT(&arg) = VT_BOOL;
+    V_BOOL(&arg) = Value;
+    call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
@@ -462,117 +600,102 @@
 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, Value);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, Value);
+
+    *Value = This->tool_bar;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%d)\n", This, Value);
-    return E_NOTIMPL;
+    VARIANTARG arg;
+    DISPPARAMS dispparams = {&arg, NULL, 1, 0};
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
+
+    /* In opposition to InternetExplorer, all we should do here is
+     * inform the embedder about the tool bar change. */
+
+    V_VT(&arg) = VT_BOOL;
+    V_BOOL(&arg) = Value;
+    call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, Value);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, Value);
+
+    *Value = This->menu_bar;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+    VARIANTARG arg;
+    DISPPARAMS dispparams = {&arg, NULL, 1, 0};
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
+
+    /* In opposition to InternetExplorer, all we should do here is
+     * inform the embedder about the menu bar change. */
+
+    V_VT(&arg) = VT_BOOL;
+    V_BOOL(&arg) = Value;
+    call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pbFullScreen);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pbFullScreen);
+
+    *pbFullScreen = This->full_screen;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, bFullScreen);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%x)\n", This, bFullScreen);
+
+    This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
         VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    IPersistMoniker *persist;
-    IOleObject *oleobj;
-    IMoniker *mon;
-    HRESULT hres;
 
     TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
 
     if(!This->client)
         return E_FAIL;
 
-    if((Flags && V_VT(Flags) != VT_EMPTY)
-       || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY)
-       || (PostData && V_VT(PostData) != VT_EMPTY)
-       || (Headers && V_VT(Headers) != VT_EMPTY))
-        FIXME("Unsupported arguments\n");
-
     if(!URL)
         return S_OK;
-    if(V_VT(URL) != VT_BSTR)
+
+    if(V_VT(URL) != VT_BSTR) {
+        FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
         return E_INVALIDARG;
-
-    if(!This->doc_view_hwnd)
-        create_doc_view_hwnd(This);
-
-    /*
-     * FIXME:
-     * We should use URLMoniker's BindToObject instead creating HTMLDocument here.
-     * This should be fixed when mshtml.dll and urlmon.dll will be good enough.
-     */
-
-    if(!This->document) {
-        hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
-                                CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
-                                &IID_IUnknown, (void**)&This->document);
-        if(FAILED(hres))
-            return hres;
     }
 
-    hres = IUnknown_QueryInterface(This->document, &IID_IPersistMoniker, (void**)&persist);
-    if(FAILED(hres))
-        return hres;
-
-    hres = CreateURLMoniker(NULL, V_BSTR(URL), &mon);
-    if(FAILED(hres)) {
-        IPersistMoniker_Release(persist);
-        return hres;
-    }
-
-    hres = IPersistMoniker_Load(persist, FALSE, mon, NULL /* FIXME */, 0);
-    IMoniker_Release(mon);
-    IPersistMoniker_Release(persist);
-    if(FAILED(hres)) {
-        WARN("Load failed: %08lx\n", hres);
-        return hres;
-    }
-
-    This->url = SysAllocString(V_BSTR(URL));
-
-    hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
-    if(FAILED(hres))
-        return hres;
-
-    hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This));
-    IOleObject_Release(oleobj);
-
-    PostMessageW(This->doc_view_hwnd, WB_WM_NAVIGATE2, 0, 0);
-
-    return hres;
+    return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
 }
 
 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
@@ -608,29 +731,41 @@
 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pbOffline);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pbOffline);
+
+    *pbOffline = This->doc_host.offline;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, bOffline);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%x)\n", This, bOffline);
+
+    This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pbSilent);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, pbSilent);
+
+    *pbSilent = This->doc_host.silent;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, bSilent);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%x)\n", This, bSilent);
+
+    This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
@@ -662,7 +797,7 @@
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
     FIXME("(%p)->(%x)\n", This, bRegister);
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
@@ -682,29 +817,51 @@
 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, Value);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, Value);
+
+    *Value = This->address_bar;
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+    VARIANTARG arg;
+    DISPPARAMS dispparams = {&arg, NULL, 1, 0};
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
+
+    /* In opposition to InternetExplorer, all we should do here is
+     * inform the embedder about the address bar change. */
+
+    V_VT(&arg) = VT_BOOL;
+    V_BOOL(&arg) = Value;
+    call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, Value);
+
+    TRACE("(%p)->(%p)\n", This, Value);
+
+    /* It's InternetExplorer object's method. We have nothing to do here. */
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     WebBrowser *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    /* It's InternetExplorer object's method. We have nothing to do here. */
+    return S_OK;
 }
 
 #undef WEBBROWSER_THIS
@@ -784,30 +941,34 @@
     WebBrowser_put_Resizable
 };
 
-HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
+static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
 {
     WebBrowser *ret;
     HRESULT hres;
 
-    TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
+    TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
 
     ret = HeapAlloc(GetProcessHeap(), 0, sizeof(WebBrowser));
 
     ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
     ret->ref = 0;
+    ret->version = version;
 
-    ret->document = NULL;
-    ret->url = NULL;
+    DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
 
+    ret->visible = VARIANT_TRUE;
+    ret->menu_bar = VARIANT_TRUE;
+    ret->address_bar = VARIANT_TRUE;
+    ret->status_bar = VARIANT_TRUE;
+    ret->tool_bar = VARIANT_TRUE;
+    ret->full_screen = VARIANT_FALSE;
+
     WebBrowser_OleObject_Init(ret);
     WebBrowser_ViewObject_Init(ret);
     WebBrowser_Persist_Init(ret);
     WebBrowser_ClassInfo_Init(ret);
+    WebBrowser_HlinkFrame_Init(ret);
     WebBrowser_Misc_Init(ret);
-    WebBrowser_Events_Init(ret);
-    WebBrowser_ClientSite_Init(ret);
-    WebBrowser_DocHost_Init(ret);
-    WebBrowser_Frame_Init(ret);
 
     hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
     if(SUCCEEDED(hres)) {
@@ -819,3 +980,13 @@
 
     return hres;
 }
+
+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);
+}
Index: dll/win32/shdocvw/shdocvw_main.c
===================================================================
--- dll/win32/shdocvw/shdocvw_main.c	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw_main.c	(Arbeitskopie)
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "config.h"
@@ -62,14 +62,37 @@
 HINSTANCE shdocvw_hinstance = 0;
 static HMODULE SHDOCVW_hshell32 = 0;
 static HMODULE hMozCtl = (HMODULE)~0UL;
+static ITypeInfo *wb_typeinfo = NULL;
 
+HRESULT get_typeinfo(ITypeInfo **typeinfo)
+{
+    ITypeLib *typelib;
+    HRESULT hres;
 
+    if(wb_typeinfo) {
+        *typeinfo = wb_typeinfo;
+        return S_OK;
+    }
+
+    hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, &typelib);
+    if(FAILED(hres)) {
+        ERR("LoadRegTypeLib failed: %08x\n", hres);
+        return hres;
+    }
+
+    hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IWebBrowser2, &wb_typeinfo);
+    ITypeLib_Release(typelib);
+
+    *typeinfo = wb_typeinfo;
+    return hres;
+}
+
 /* convert a guid to a wide character string */
 static void SHDOCVW_guid2wstr( const GUID *guid, LPWSTR wstr )
 {
     char str[40];
 
-    sprintf(str, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+    sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
            guid->Data1, guid->Data2, guid->Data3,
            guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
            guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
@@ -116,10 +139,14 @@
 	{
 	  case DLL_PROCESS_ATTACH:
 	    shdocvw_hinstance = hinst;
+        register_iewindow_class();
 	    break;
 	  case DLL_PROCESS_DETACH:
 	    if (SHDOCVW_hshell32) FreeLibrary(SHDOCVW_hshell32);
+        unregister_iewindow_class();
 	    if (hMozCtl && hMozCtl != (HMODULE)~0UL) FreeLibrary(hMozCtl);
+        if(wb_typeinfo)
+            ITypeInfo_Release(wb_typeinfo);
 	    break;
 	}
 	return TRUE;
@@ -141,8 +168,8 @@
             moz_can_unload = pCanUnloadNow();
     }
 
-    if (moz_can_unload == S_OK && SHDOCVW_refCount == 0)
-        return S_OK;
+    if (moz_can_unload)
+        return SHDOCVW_refCount ? S_FALSE : S_OK;
 
     return S_FALSE;
 }
@@ -455,6 +482,8 @@
     }
 }
 
+/* Implemented in factory.c */
+#if 0
 /*************************************************************************
  *              DllGetClassObject (SHDOCVW.@)
  */
@@ -495,6 +524,7 @@
     /* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
     return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
 }
+#endif
 
 /***********************************************************************
  *              DllGetVersion (SHDOCVW.@)
@@ -527,7 +557,7 @@
  *
  * makes sure the handle to shell32 is valid
  */
- BOOL SHDOCVW_LoadShell32(void)
+static BOOL SHDOCVW_LoadShell32(void)
 {
      if (SHDOCVW_hshell32)
        return TRUE;
@@ -562,7 +592,7 @@
     {
       if (!SHDOCVW_LoadShell32())
         return FALSE;
-      pShellDDEInit = GetProcAddress(SHDOCVW_hshell32, (LPCSTR)188);
+      pShellDDEInit = (void *)GetProcAddress(SHDOCVW_hshell32, (LPCSTR)188);
     }
 
     if (pShellDDEInit)
@@ -591,3 +621,73 @@
     FIXME("(%lu), stub!\n", arg);
     return 0;
 }
+
+/**********************************************************************
+ * Some forwards (by ordinal) to SHLWAPI
+ */
+
+static void* fetch_shlwapi_ordinal(unsigned ord)
+{
+    static const WCHAR shlwapiW[] = {'s','h','l','w','a','p','i','.','d','l','l','\0'};
+    static HANDLE h;
+
+    if (!h && !(h = GetModuleHandleW(shlwapiW))) return NULL;
+    return (void*)GetProcAddress(h, (const char*)ord);
+}
+
+/******************************************************************
+ *		WhichPlatformFORWARD            (SHDOCVW.@)
+ */
+DWORD WINAPI WhichPlatformFORWARD(void)
+{
+    static DWORD (*WINAPI p)(void);
+
+    if (p || (p = fetch_shlwapi_ordinal(276))) return p();
+    return 1; /* not integrated, see shlwapi.WhichPlatform */
+}
+
+/******************************************************************
+ *		StopWatchModeFORWARD            (SHDOCVW.@)
+ */
+void WINAPI StopWatchModeFORWARD(void)
+{
+    static void (*WINAPI p)(void);
+
+    if (p || (p = fetch_shlwapi_ordinal(241))) p();
+}
+
+/******************************************************************
+ *		StopWatchFlushFORWARD            (SHDOCVW.@)
+ */
+void WINAPI StopWatchFlushFORWARD(void)
+{
+    static void (*WINAPI p)(void);
+
+    if (p || (p = fetch_shlwapi_ordinal(242))) p();
+}
+
+/******************************************************************
+ *		StopWatchWFORWARD            (SHDOCVW.@)
+ */
+DWORD WINAPI StopWatchWFORWARD(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
+                               DWORD dwMode, DWORD dwTimeStamp)
+{
+    static DWORD (*WINAPI p)(DWORD, LPCWSTR, DWORD, DWORD, DWORD);
+
+    if (p || (p = fetch_shlwapi_ordinal(243)))
+        return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+/******************************************************************
+ *		StopWatchAFORWARD            (SHDOCVW.@)
+ */
+DWORD WINAPI StopWatchAFORWARD(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
+                               DWORD dwMode, DWORD dwTimeStamp)
+{
+    static DWORD (*WINAPI p)(DWORD, LPCSTR, DWORD, DWORD, DWORD);
+
+    if (p || (p = fetch_shlwapi_ordinal(244)))
+        return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
Index: dll/win32/shdocvw/shdocvw.h
===================================================================
--- dll/win32/shdocvw/shdocvw.h	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw.h	(Arbeitskopie)
@@ -2,6 +2,7 @@
  * Header includes for shdocvw.dll
  *
  * Copyright 2001 John R. Sheets (for CodeWeavers)
+ * Copyright 2005-2006 Jacek Caban for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -15,7 +16,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #ifndef __WINE_SHDOCVW_H
@@ -36,6 +37,7 @@
 #include "shlobj.h"
 #include "exdisp.h"
 #include "mshtmhst.h"
+#include "hlink.h"
 
 /**********************************************************************
  * IClassFactory declaration for SHDOCVW.DLL
@@ -44,6 +46,7 @@
 {
     /* IUnknown fields */
     const IClassFactoryVtbl *lpVtbl;
+    HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *);
     LONG ref;
 } IClassFactoryImpl;
 
@@ -62,6 +65,48 @@
 typedef struct ConnectionPoint ConnectionPoint;
 
 typedef struct {
+    const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
+
+    ConnectionPoint *wbe2;
+    ConnectionPoint *wbe;
+    ConnectionPoint *pns;
+
+    IUnknown *impl;
+} ConnectionPointContainer;
+
+typedef struct {
+    const IOleClientSiteVtbl      *lpOleClientSiteVtbl;
+    const IOleInPlaceSiteVtbl     *lpOleInPlaceSiteVtbl;
+    const IDocHostUIHandler2Vtbl  *lpDocHostUIHandlerVtbl;
+    const IOleDocumentSiteVtbl    *lpOleDocumentSiteVtbl;
+    const IOleCommandTargetVtbl   *lpOleCommandTargetVtbl;
+    const IDispatchVtbl           *lpDispatchVtbl;
+    const IServiceProviderVtbl    *lpServiceProviderVtbl;
+
+    /* Interfaces of InPlaceFrame object */
+    const IOleInPlaceFrameVtbl          *lpOleInPlaceFrameVtbl;
+
+    IDispatch *disp;
+
+    IDispatch *client_disp;
+    IDocHostUIHandler *hostui;
+    IOleInPlaceFrame *frame;
+
+    IUnknown *document;
+    IOleDocumentView *view;
+
+    HWND hwnd;
+    HWND frame_hwnd;
+
+    LPOLESTR url;
+
+    VARIANT_BOOL silent;
+    VARIANT_BOOL offline;
+
+    ConnectionPointContainer cps;
+} DocHost;
+
+typedef struct {
     /* Interfaces available via WebBrowser object */
 
     const IWebBrowser2Vtbl              *lpWebBrowser2Vtbl;
@@ -69,60 +114,61 @@
     const IOleInPlaceObjectVtbl         *lpOleInPlaceObjectVtbl;
     const IOleControlVtbl               *lpOleControlVtbl;
     const IPersistStorageVtbl           *lpPersistStorageVtbl;
+    const IPersistMemoryVtbl            *lpPersistMemoryVtbl;
     const IPersistStreamInitVtbl        *lpPersistStreamInitVtbl;
     const IProvideClassInfo2Vtbl        *lpProvideClassInfoVtbl;
     const IQuickActivateVtbl            *lpQuickActivateVtbl;
-    const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
     const IViewObject2Vtbl              *lpViewObjectVtbl;
     const IOleInPlaceActiveObjectVtbl   *lpOleInPlaceActiveObjectVtbl;
+    const IOleCommandTargetVtbl         *lpOleCommandTargetVtbl;
+    const IHlinkFrameVtbl               *lpHlinkFrameVtbl;
 
-    /* Interfaces available for embeded document */
-
-    const IOleClientSiteVtbl            *lpOleClientSiteVtbl;
-    const IOleInPlaceSiteVtbl           *lpOleInPlaceSiteVtbl;
-    const IDocHostUIHandler2Vtbl        *lpDocHostUIHandlerVtbl;
-    const IOleDocumentSiteVtbl          *lpOleDocumentSiteVtbl;
-
-    /* Interfaces of InPlaceFrame object */
-
-    const IOleInPlaceFrameVtbl          *lpOleInPlaceFrameVtbl;
-
     LONG ref;
 
-    IUnknown *document;
+    INT version;
 
     IOleClientSite *client;
     IOleContainer *container;
-    IOleDocumentView *view;
+    IOleInPlaceSite *inplace;
 
-    LPOLESTR url;
-
     /* window context */
 
-    HWND iphwnd;
     HWND frame_hwnd;
-    IOleInPlaceFrame *frame;
     IOleInPlaceUIWindow *uiwindow;
     RECT pos_rect;
     RECT clip_rect;
     OLEINPLACEFRAMEINFO frameinfo;
+    SIZEL extent;
 
-    HWND doc_view_hwnd;
     HWND shell_embedding_hwnd;
 
-    /* Connection points */
+    VARIANT_BOOL visible;
+    VARIANT_BOOL menu_bar;
+    VARIANT_BOOL address_bar;
+    VARIANT_BOOL status_bar;
+    VARIANT_BOOL tool_bar;
+    VARIANT_BOOL full_screen;
 
-    ConnectionPoint *cp_wbe2;
-    ConnectionPoint *cp_wbe;
-    ConnectionPoint *cp_pns;
+    DocHost doc_host;
 } WebBrowser;
 
+typedef struct {
+    const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
+
+    LONG ref;
+
+    HWND frame_hwnd;
+
+    DocHost doc_host;
+} InternetExplorer;
+
 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
 #define WEBBROWSER2(x)  ((IWebBrowser2*)                &(x)->lpWebBrowser2Vtbl)
 #define OLEOBJ(x)       ((IOleObject*)                  &(x)->lpOleObjectVtbl)
 #define INPLACEOBJ(x)   ((IOleInPlaceObject*)           &(x)->lpOleInPlaceObjectVtbl)
 #define CONTROL(x)      ((IOleControl*)                 &(x)->lpOleControlVtbl)
 #define PERSTORAGE(x)   ((IPersistStorage*)             &(x)->lpPersistStorageVtbl)
+#define PERMEMORY(x)    ((IPersistMemory*)              &(x)->lpPersistMemoryVtbl)
 #define PERSTRINIT(x)   ((IPersistStreamInit*)          &(x)->lpPersistStreamInitVtbl)
 #define CLASSINFO(x)    ((IProvideClassInfo2*)          &(x)->lpProvideClassInfoVtbl)
 #define QUICKACT(x)     ((IQuickActivate*)              &(x)->lpQuickActivateVtbl)
@@ -130,12 +176,16 @@
 #define VIEWOBJ(x)      ((IViewObject*)                 &(x)->lpViewObjectVtbl);
 #define VIEWOBJ2(x)     ((IViewObject2*)                &(x)->lpViewObjectVtbl);
 #define ACTIVEOBJ(x)    ((IOleInPlaceActiveObject*)     &(x)->lpOleInPlaceActiveObjectVtbl)
+#define OLECMD(x)       ((IOleCommandTarget*)           &(x)->lpOleCommandTargetVtbl)
+#define HLINKFRAME(x)   ((IHlinkFrame*)                 &(x)->lpHlinkFrameVtbl)
 
 #define CLIENTSITE(x)   ((IOleClientSite*)              &(x)->lpOleClientSiteVtbl)
 #define INPLACESITE(x)  ((IOleInPlaceSite*)             &(x)->lpOleInPlaceSiteVtbl)
 #define DOCHOSTUI(x)    ((IDocHostUIHandler*)           &(x)->lpDocHostUIHandlerVtbl)
 #define DOCHOSTUI2(x)   ((IDocHostUIHandler2*)          &(x)->lpDocHostUIHandlerVtbl)
 #define DOCSITE(x)      ((IOleDocumentSite*)            &(x)->lpOleDocumentSiteVtbl)
+#define CLDISP(x)       ((IDispatch*)                   &(x)->lpDispatchVtbl)
+#define SERVPROV(x)     ((IServiceProvider*)            &(x)->lpServiceProviderVtbl)
 
 #define INPLACEFRAME(x) ((IOleInPlaceFrame*)            &(x)->lpOleInPlaceFrameVtbl)
 
@@ -143,23 +193,37 @@
 void WebBrowser_ViewObject_Init(WebBrowser*);
 void WebBrowser_Persist_Init(WebBrowser*);
 void WebBrowser_ClassInfo_Init(WebBrowser*);
+void WebBrowser_HlinkFrame_Init(WebBrowser*);
 void WebBrowser_Misc_Init(WebBrowser*);
 void WebBrowser_Events_Init(WebBrowser*);
 
-void WebBrowser_ClientSite_Init(WebBrowser*);
-void WebBrowser_DocHost_Init(WebBrowser*);
+void WebBrowser_OleObject_Destroy(WebBrowser*);
 
-void WebBrowser_Frame_Init(WebBrowser*);
+void DocHost_Init(DocHost*,IDispatch*);
+void DocHost_ClientSite_Init(DocHost*);
+void DocHost_Frame_Init(DocHost*);
 
-void WebBrowser_OleObject_Destroy(WebBrowser*);
 void WebBrowser_Events_Destroy(WebBrowser*);
-void WebBrowser_ClientSite_Destroy(WebBrowser*);
+void DocHost_Release(DocHost*);
+void DocHost_ClientSite_Release(DocHost*);
 
-HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
+void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
+void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
 
-void create_doc_view_hwnd(WebBrowser *This);
+HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
+HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
+
+void create_doc_view_hwnd(DocHost*);
+void deactivate_document(DocHost*);
 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
+HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
+HRESULT go_home(DocHost*);
 
+HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
+void InternetExplorer_WebBrowser_Init(InternetExplorer*);
+
+HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
+
 #define WB_WM_NAVIGATE2 (WM_USER+100)
 
 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
@@ -172,5 +236,11 @@
 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
 
 extern HINSTANCE shdocvw_hinstance;
+extern void register_iewindow_class(void);
+extern void unregister_iewindow_class(void);
 
+HRESULT register_class_object(BOOL);
+HRESULT get_typeinfo(ITypeInfo**);
+DWORD register_iexplore(BOOL);
+
 #endif /* __WINE_SHDOCVW_H */
Index: dll/win32/shdocvw/shdocvw.spec
===================================================================
--- dll/win32/shdocvw/shdocvw.spec	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw.spec	(Arbeitskopie)
@@ -1,8 +1,8 @@
 # ordinal exports
-101 stub -noname IEWinMain
+101 stdcall -noname IEWinMain(str long)
 102 stub -noname CreateShortcutInDirA
 103 stub -noname CreateShortcutInDirW
-104 stub -noname WhichPlatformFORWARD
+104 stdcall -noname WhichPlatformFORWARD()
 105 stub -noname CreateShortcutInDirEx
 106 stub HlinkFindFrame
 107 stub SetShellOfflineState
@@ -15,9 +15,10 @@
 118 stdcall -noname ShellDDEInit(long)
 119 stub -noname SHCreateDesktop
 120 stub -noname SHDesktopMessageLoop
-121 stub -noname StopWatchModeFORWARD
-122 stub -noname StopWatchFlushFORWARD
-123 stub -noname StopWatchFORWARD
+121 stdcall -noname StopWatchModeFORWARD()
+122 stdcall -noname StopWatchFlushFORWARD()
+123 stdcall -noname StopWatchAFORWARD(long str long long long)
+124 stdcall -noname StopWatchWFORWARD(long wstr long long long)
 125 stdcall -noname RunInstallUninstallStubs()
 130 stub -noname RunInstallUninstallStubs2
 131 stub -noname SHCreateSplashScreen
Index: dll/win32/shdocvw/shdocvw_ros.diff
===================================================================
--- dll/win32/shdocvw/shdocvw_ros.diff	(Revision 31635)
+++ dll/win32/shdocvw/shdocvw_ros.diff	(Arbeitskopie)
@@ -1,46 +0,0 @@
-Index: shdocvw.rc
-===================================================================
---- shdocvw.rc	(revision 25694)
-+++ shdocvw.rc	(revision 25695)
-@@ -38,3 +38,4 @@
- #include "Pt.rc"
- #include "Ru.rc"
- #include "Sv.rc"
-+#include "Uk.rc"
-Index: Uk.rc
-===================================================================
---- Uk.rc	(revision 25695)
-+++ Uk.rc	(working copy)
-@@ -0,0 +1,26 @@
-+/*
-+ * PROJECT:     Shell Doc Object and Control Library
-+ * LICENSE:     GPL - See COPYING in the top level directory
-+ * FILE:        dll/win32/shdocvw/Uk.rc
-+ * PURPOSE:     Ukraianian Language File for shdocvw
-+ * TRANSLATOR:  Artem Reznikov
-+ */
-+
-+LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
-+
-+100 DIALOG LOADONCALL MOVEABLE DISCARDABLE  0, 0, 220, 62
-+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-+CAPTION "������������ �������� ��������� Mozilla Active X"
-+FONT 8, "MS Shell Dlg"
-+{
-+ CONTROL "Progress1",1000,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
-+ LTEXT "", 104, 10, 30, 200, 10, SS_CENTER
-+ PUSHBUTTON "���������", IDCANCEL, 85, 44, 50, 15, WS_GROUP | WS_TABSTOP
-+}
-+
-+STRINGTABLE
-+BEGIN
-+ 1001	"��� ������� ������� ��'��� ActiveX ��������,\n" \
-+        "��� ������� ��������� Mozilla Active X �� ������������." \
-+        "�� ������ ����������� � ���������� ����??"
-+END
-
-Property changes on: Uk.rc
-___________________________________________________________________
-Name: svn:eol-style
-   + native
-
Index: dll/win32/shdocvw/persist.c
===================================================================
--- dll/win32/shdocvw/persist.c	(Revision 31635)
+++ dll/win32/shdocvw/persist.c	(Arbeitskopie)
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "wine/debug.h"
@@ -67,7 +67,7 @@
 {
     WebBrowser *This = PERSTORAGE_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pStg);
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
@@ -92,8 +92,6 @@
     return E_NOTIMPL;
 }
 
-#define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
-
 static const IPersistStorageVtbl PersistStorageVtbl =
 {
     PersistStorage_QueryInterface,
@@ -108,6 +106,87 @@
 };
 
 /**********************************************************************
+ * Implement the IPersistMemory interface
+ */
+
+#define PERMEMORY_THIS(ifce) DEFINE_THIS(WebBrowser, PersistMemory, iface)
+
+static HRESULT WINAPI PersistMemory_QueryInterface(IPersistMemory *iface,
+        REFIID riid, LPVOID *ppobj)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
+}
+
+static ULONG WINAPI PersistMemory_AddRef(IPersistMemory *iface)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    return IWebBrowser_AddRef(WEBBROWSER(This));
+}
+
+static ULONG WINAPI PersistMemory_Release(IPersistMemory *iface)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    return IWebBrowser_Release(WEBBROWSER(This));
+}
+
+static HRESULT WINAPI PersistMemory_GetClassID(IPersistMemory *iface, CLSID *pClassID)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pClassID);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PersistMemory_IsDirty(IPersistMemory *iface)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PersistMemory_InitNew(IPersistMemory *iface)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)\n", This);
+    return S_OK;
+}
+
+static HRESULT WINAPI PersistMemory_Load(IPersistMemory *iface, LPVOID pMem, ULONG cbSize)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)->(%p %x)\n", This, pMem, cbSize);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PersistMemory_Save(IPersistMemory *iface, LPVOID pMem,
+        BOOL fClearDirty, ULONG cbSize)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)->(%p %x %x)\n", This, pMem, fClearDirty, cbSize);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI PersistMemory_GetSizeMax(IPersistMemory *iface, ULONG *pCbSize)
+{
+    WebBrowser *This = PERMEMORY_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pCbSize);
+    return E_NOTIMPL;
+}
+
+static const IPersistMemoryVtbl PersistMemoryVtbl =
+{
+    PersistMemory_QueryInterface,
+    PersistMemory_AddRef,
+    PersistMemory_Release,
+    PersistMemory_GetClassID,
+    PersistMemory_IsDirty,
+    PersistMemory_Load,
+    PersistMemory_Save,
+    PersistMemory_GetSizeMax,
+    PersistMemory_InitNew
+};
+
+/**********************************************************************
  * Implement the IPersistStreamInit interface
  */
 
@@ -148,7 +227,7 @@
 {
     WebBrowser *This = PERSTRINIT_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pStg);
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
@@ -171,7 +250,7 @@
 {
     WebBrowser *This = PERSTRINIT_THIS(iface);
     FIXME("(%p)\n", This);
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 #undef PERSTRINIT_THIS
@@ -192,5 +271,6 @@
 void WebBrowser_Persist_Init(WebBrowser *This)
 {
     This->lpPersistStorageVtbl    = &PersistStorageVtbl;
+    This->lpPersistMemoryVtbl     = &PersistMemoryVtbl;
     This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
 }
Index: dll/win32/shdocvw/frame.c
===================================================================
--- dll/win32/shdocvw/frame.c	(Revision 31635)
+++ dll/win32/shdocvw/frame.c	(Arbeitskopie)
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include "wine/debug.h"
@@ -21,12 +21,12 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
-#define INPLACEFRAME_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceFrame, iface)
+#define INPLACEFRAME_THIS(iface) DEFINE_THIS(DocHost, OleInPlaceFrame, iface)
 
 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface,
                                                   REFIID riid, void **ppv)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
 
     *ppv = NULL;
 
@@ -52,19 +52,19 @@
 
 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
-    return IWebBrowser2_AddRef(WEBBROWSER(This));
+    DocHost *This = INPLACEFRAME_THIS(iface);
+    return IOleClientSite_AddRef(CLIENTSITE(This));
 }
 
 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
-    return IWebBrowser2_Release(WEBBROWSER(This));
+    DocHost *This = INPLACEFRAME_THIS(iface);
+    return IOleClientSite_Release(CLIENTSITE(This));
 }
 
 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, phwnd);
     return E_NOTIMPL;
 }
@@ -72,14 +72,14 @@
 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface,
                                                         BOOL fEnterMode)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fEnterMode);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, lprectBorder);
     return E_NOTIMPL;
 }
@@ -87,7 +87,7 @@
 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
                                                       LPCBORDERWIDTHS pborderwidths)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pborderwidths);
     return E_NOTIMPL;
 }
@@ -95,7 +95,7 @@
 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
                                                   LPCBORDERWIDTHS pborderwidths)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pborderwidths);
     return E_NOTIMPL;
 }
@@ -103,7 +103,7 @@
 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
         IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
     return E_NOTIMPL;
 }
@@ -111,7 +111,7 @@
 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
         LPOLEMENUGROUPWIDTHS lpMenuWidths)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths);
     return E_NOTIMPL;
 }
@@ -119,14 +119,14 @@
 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
         HOLEMENU holemenu, HWND hwndActiveObject)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, hmenuShared);
     return E_NOTIMPL;
 }
@@ -134,14 +134,14 @@
 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
                                                  LPCOLESTR pszStatusText)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p)\n", This, debugstr_w(pszStatusText));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%x)\n", This, fEnable);
     return E_NOTIMPL;
 }
@@ -149,7 +149,7 @@
 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg,
                                                         WORD wID)
 {
-    WebBrowser *This = INPLACEFRAME_THIS(iface);
+    DocHost *This = INPLACEFRAME_THIS(iface);
     FIXME("(%p)->(%p %d)\n", This, lpmsg, wID);
     return E_NOTIMPL;
 }
@@ -174,7 +174,7 @@
     InPlaceFrame_TranslateAccelerator
 };
 
-void WebBrowser_Frame_Init(WebBrowser *This)
+void DocHost_Frame_Init(DocHost *This)
 {
     This->lpOleInPlaceFrameVtbl = &OleInPlaceFrameVtbl;
 }
Index: dll/win32/shdocvw/urlhist.c
===================================================================
--- dll/win32/shdocvw/urlhist.c	(Revision 0)
+++ dll/win32/shdocvw/urlhist.c	(Revision 0)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/debug.h"
+#include "shdocvw.h"
+#include "urlhist.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+static HRESULT WINAPI UrlHistoryStg_QueryInterface(IUrlHistoryStg2 *iface, REFIID riid, void **ppv)
+{
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(IID_IUnknown %p)\n", ppv);
+        *ppv = iface;
+    }else if(IsEqualGUID(&IID_IUrlHistoryStg, riid)) {
+        TRACE("(IID_IUrlHistoryStg %p)\n", ppv);
+        *ppv = iface;
+    }else if(IsEqualGUID(&IID_IUrlHistoryStg2, riid)) {
+        TRACE("(IID_IUrlHistoryStg2 %p)\n", ppv);
+        *ppv = iface;
+    }
+
+    if(*ppv) {
+        IUnknown_AddRef((IUnknown*)*ppv);
+        return S_OK;
+    }
+
+    WARN("(%s %p)\n", debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI UrlHistoryStg_AddRef(IUrlHistoryStg2 *iface)
+{
+    SHDOCVW_LockModule();
+    return 2;
+}
+
+static ULONG WINAPI UrlHistoryStg_Release(IUrlHistoryStg2 *iface)
+{
+    SHDOCVW_UnlockModule();
+    return 1;
+}
+
+static HRESULT WINAPI UrlHistoryStg_AddUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
+        LPCOLESTR pocsTitle, DWORD dwFlags)
+{
+    FIXME("(%s %s %08x)\n", debugstr_w(lpcsUrl), debugstr_w(pocsTitle), dwFlags);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_DeleteUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
+        DWORD dwFlags)
+{
+    FIXME("(%s %08x)\n", debugstr_w(lpcsUrl), dwFlags);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_QueryUrl(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
+        DWORD dwFlags, LPSTATURL lpSTATURL)
+{
+    FIXME("(%s %08x %p)\n", debugstr_w(lpcsUrl), dwFlags, lpSTATURL);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_BindToObject(IUrlHistoryStg2 *iface, LPCOLESTR lpcsUrl,
+        REFIID riid, void **ppv)
+{
+    FIXME("(%s %s %p)\n", debugstr_w(lpcsUrl), debugstr_guid(riid), ppv);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_EnumUrls(IUrlHistoryStg2 *iface, IEnumSTATURL **ppEnum)
+{
+    FIXME("(%p)\n", ppEnum);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_AddUrlAndNotify(IUrlHistoryStg2 *iface, LPCOLESTR pocsUrl,
+        LPCOLESTR pocsTitle, DWORD dwFlags, BOOL fWriteHistory, IOleCommandTarget *poctNotify,
+        IUnknown *punkISFolder)
+{
+    FIXME("(%s %s %08x %x %p %p)\n", debugstr_w(pocsUrl), debugstr_w(pocsTitle),
+          dwFlags, fWriteHistory, poctNotify, punkISFolder);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI UrlHistoryStg_ClearHistory(IUrlHistoryStg2 *iface)
+{
+    FIXME("()\n");
+    return E_NOTIMPL;
+}
+
+static const IUrlHistoryStg2Vtbl UrlHistoryStg2Vtbl = {
+    UrlHistoryStg_QueryInterface,
+    UrlHistoryStg_AddRef,
+    UrlHistoryStg_Release,
+    UrlHistoryStg_AddUrl,
+    UrlHistoryStg_DeleteUrl,
+    UrlHistoryStg_QueryUrl,
+    UrlHistoryStg_BindToObject,
+    UrlHistoryStg_EnumUrls,
+    UrlHistoryStg_AddUrlAndNotify,
+    UrlHistoryStg_ClearHistory
+};
+
+static IUrlHistoryStg2 UrlHistoryStg2 = { &UrlHistoryStg2Vtbl };
+
+HRESULT CUrlHistory_Create(IUnknown *pOuter, REFIID riid, void **ppv)
+{
+    if(pOuter)
+        return CLASS_E_NOAGGREGATION;
+
+    return IUrlHistoryStg_QueryInterface(&UrlHistoryStg2, riid, ppv);
+}
Index: dll/win32/shdocvw/ie.c
===================================================================
--- dll/win32/shdocvw/ie.c	(Revision 0)
+++ dll/win32/shdocvw/ie.c	(Revision 0)
@@ -0,0 +1,673 @@
+/*
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/debug.h"
+#include "shdocvw.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+#define WEBBROWSER_THIS(iface) DEFINE_THIS(InternetExplorer, WebBrowser2, iface)
+
+static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = WEBBROWSER(This);
+    }else if(IsEqualGUID(&IID_IDispatch, riid)) {
+        TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
+        *ppv = WEBBROWSER(This);
+    }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
+        TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
+        *ppv = WEBBROWSER(This);
+    }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);
+    }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
+        TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
+        *ppv = CONPTCONT(&This->doc_host.cps);
+    }
+
+    if(*ppv) {
+        IUnknown_AddRef((IUnknown*)*ppv);
+        return S_OK;
+    }
+
+    WARN("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI InternetExplorer_AddRef(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+    TRACE("(%p) ref=%d\n", This, ref);
+    return ref;
+}
+
+static ULONG WINAPI InternetExplorer_Release(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref) {
+        DocHost_Release(&This->doc_host);
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI InternetExplorer_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pctinfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
+                                     LPTYPEINFO *ppTInfo)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
+                                       LPOLESTR *rgszNames, UINT cNames,
+                                       LCID lcid, DISPID *rgDispId)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
+            lcid, rgDispId);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
+                                REFIID riid, LCID lcid, WORD wFlags,
+                                DISPPARAMS *pDispParams, VARIANT *pVarResult,
+                                EXCEPINFO *pExepInfo, UINT *puArgErr)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+            lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GoBack(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GoForward(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GoHome(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    TRACE("(%p)\n", This);
+    return go_home(&This->doc_host);
+}
+
+static HRESULT WINAPI InternetExplorer_GoSearch(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Navigate(IWebBrowser2 *iface, BSTR szUrl,
+                                  VARIANT *Flags, VARIANT *TargetFrameName,
+                                  VARIANT *PostData, VARIANT *Headers)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+
+    TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
+          PostData, Headers);
+
+    return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
+}
+
+static HRESULT WINAPI InternetExplorer_Refresh(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Level);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Stop(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppDisp);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppDisp);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppDisp);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppDisp);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pBool);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Type(IWebBrowser2 *iface, BSTR *Type)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Type);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Left(IWebBrowser2 *iface, long *pl)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Left(IWebBrowser2 *iface, long Left)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, Left);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Top(IWebBrowser2 *iface, long *pl)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Top(IWebBrowser2 *iface, long Top)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, Top);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Width(IWebBrowser2 *iface, long *pl)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Width(IWebBrowser2 *iface, long Width)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, Width);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Height(IWebBrowser2 *iface, long *pl)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pl);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Height(IWebBrowser2 *iface, long Height)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, Height);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, LocationName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, LocationURL);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pBool);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Quit(IWebBrowser2 *iface)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Name(IWebBrowser2 *iface, BSTR *Name)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Name);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_HWND(IWebBrowser2 *iface, long *pHWND)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pHWND);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, FullName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Path(IWebBrowser2 *iface, BSTR *Path)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Path);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pBool);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    ShowWindow(This->frame_hwnd, Value ? SW_SHOW : SW_HIDE);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI InternetExplorer_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pBool);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, StatusText);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_ToolBar(IWebBrowser2 *iface, int *Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_ToolBar(IWebBrowser2 *iface, int Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%d)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbFullScreen);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bFullScreen);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
+        VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+
+    TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
+
+    if(!URL)
+        return S_OK;
+
+    if(V_VT(URL) != VT_BSTR) {
+        FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
+        return E_INVALIDARG;
+    }
+
+    return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
+}
+
+static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
+        OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
+        VARIANT *pvarShow, VARIANT *pvarSize)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, lpReadyState);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbOffline);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bOffline);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbSilent);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bSilent);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_RegisterAsBrowser(IWebBrowser2 *iface,
+        VARIANT_BOOL *pbRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_RegisterAsBrowser(IWebBrowser2 *iface,
+        VARIANT_BOOL bRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_RegisterAsDropTarget(IWebBrowser2 *iface,
+        VARIANT_BOOL *pbRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_RegisterAsDropTarget(IWebBrowser2 *iface,
+        VARIANT_BOOL bRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pbRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, bRegister);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetExplorer_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
+{
+    InternetExplorer *This = WEBBROWSER_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, Value);
+    return E_NOTIMPL;
+}
+
+#undef WEBBROWSER_THIS
+
+static const IWebBrowser2Vtbl InternetExplorerVtbl =
+{
+    InternetExplorer_QueryInterface,
+    InternetExplorer_AddRef,
+    InternetExplorer_Release,
+    InternetExplorer_GetTypeInfoCount,
+    InternetExplorer_GetTypeInfo,
+    InternetExplorer_GetIDsOfNames,
+    InternetExplorer_Invoke,
+    InternetExplorer_GoBack,
+    InternetExplorer_GoForward,
+    InternetExplorer_GoHome,
+    InternetExplorer_GoSearch,
+    InternetExplorer_Navigate,
+    InternetExplorer_Refresh,
+    InternetExplorer_Refresh2,
+    InternetExplorer_Stop,
+    InternetExplorer_get_Application,
+    InternetExplorer_get_Parent,
+    InternetExplorer_get_Container,
+    InternetExplorer_get_Document,
+    InternetExplorer_get_TopLevelContainer,
+    InternetExplorer_get_Type,
+    InternetExplorer_get_Left,
+    InternetExplorer_put_Left,
+    InternetExplorer_get_Top,
+    InternetExplorer_put_Top,
+    InternetExplorer_get_Width,
+    InternetExplorer_put_Width,
+    InternetExplorer_get_Height,
+    InternetExplorer_put_Height,
+    InternetExplorer_get_LocationName,
+    InternetExplorer_get_LocationURL,
+    InternetExplorer_get_Busy,
+    InternetExplorer_Quit,
+    InternetExplorer_ClientToWindow,
+    InternetExplorer_PutProperty,
+    InternetExplorer_GetProperty,
+    InternetExplorer_get_Name,
+    InternetExplorer_get_HWND,
+    InternetExplorer_get_FullName,
+    InternetExplorer_get_Path,
+    InternetExplorer_get_Visible,
+    InternetExplorer_put_Visible,
+    InternetExplorer_get_StatusBar,
+    InternetExplorer_put_StatusBar,
+    InternetExplorer_get_StatusText,
+    InternetExplorer_put_StatusText,
+    InternetExplorer_get_ToolBar,
+    InternetExplorer_put_ToolBar,
+    InternetExplorer_get_MenuBar,
+    InternetExplorer_put_MenuBar,
+    InternetExplorer_get_FullScreen,
+    InternetExplorer_put_FullScreen,
+    InternetExplorer_Navigate2,
+    InternetExplorer_QueryStatusWB,
+    InternetExplorer_ExecWB,
+    InternetExplorer_ShowBrowserBar,
+    InternetExplorer_get_ReadyState,
+    InternetExplorer_get_Offline,
+    InternetExplorer_put_Offline,
+    InternetExplorer_get_Silent,
+    InternetExplorer_put_Silent,
+    InternetExplorer_get_RegisterAsBrowser,
+    InternetExplorer_put_RegisterAsBrowser,
+    InternetExplorer_get_RegisterAsDropTarget,
+    InternetExplorer_put_RegisterAsDropTarget,
+    InternetExplorer_get_TheaterMode,
+    InternetExplorer_put_TheaterMode,
+    InternetExplorer_get_AddressBar,
+    InternetExplorer_put_AddressBar,
+    InternetExplorer_get_Resizable,
+    InternetExplorer_put_Resizable
+};
+
+void InternetExplorer_WebBrowser_Init(InternetExplorer *This)
+{
+    This->lpWebBrowser2Vtbl = &InternetExplorerVtbl;
+}
