Author: akhaldi
Date: Sun Jun  5 19:18:20 2016
New Revision: 71551

URL: http://svn.reactos.org/svn/reactos?rev=71551&view=rev
Log:
[IEFRAME] Sync with Wine Staging 1.9.11. CORE-11368

Modified:
    trunk/reactos/dll/win32/ieframe/client.c
    trunk/reactos/dll/win32/ieframe/ieframe.h
    trunk/reactos/dll/win32/ieframe/intshcut.c
    trunk/reactos/dll/win32/ieframe/navigate.c
    trunk/reactos/dll/win32/ieframe/oleobject.c
    trunk/reactos/media/doc/README.WINE

Modified: trunk/reactos/dll/win32/ieframe/client.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/client.c?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ieframe/client.c    [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ieframe/client.c    [iso-8859-1] Sun Jun  5 
19:18:20 2016
@@ -381,8 +381,10 @@
     if(FAILED(hres))
         return hres;
 
-    IOleDocument_CreateView(oledoc, (IOleInPlaceSite*) 
&This->IOleInPlaceSiteEx_iface, NULL, 0, &This->view);
+    hres = IOleDocument_CreateView(oledoc, (IOleInPlaceSite*) 
&This->IOleInPlaceSiteEx_iface, NULL, 0, &This->view);
     IOleDocument_Release(oledoc);
+    if(FAILED(hres))
+        return hres;
 
     GetClientRect(This->hwnd, &rect);
     IOleDocumentView_SetRect(This->view, &rect);
@@ -657,6 +659,11 @@
         return IWebBrowser2_QueryInterface(This->wb, riid, ppv);
     }
 
+    if(IsEqualGUID(&IID_ITargetFrame, guidService)) {
+        TRACE("(%p)->(IID_ITargetFrame %s %p)\n", This, debugstr_guid(riid), 
ppv);
+        return IWebBrowser2_QueryInterface(This->wb, riid, ppv);
+    }
+
     if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
         TRACE("IWebBrowserApp service\n");
         return IWebBrowser2_QueryInterface(This->wb, riid, ppv);

Modified: trunk/reactos/dll/win32/ieframe/ieframe.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/ieframe.h?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ieframe/ieframe.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ieframe/ieframe.h   [iso-8859-1] Sun Jun  5 
19:18:20 2016
@@ -72,6 +72,7 @@
 
 typedef struct {
     IHlinkFrame    IHlinkFrame_iface;
+    ITargetFrame   ITargetFrame_iface;
     ITargetFrame2  ITargetFrame2_iface;
     ITargetFramePriv2 ITargetFramePriv2_iface;
     IWebBrowserPriv2IE9 IWebBrowserPriv2IE9_iface;
@@ -206,6 +207,7 @@
     INT version;
 
     IOleClientSite *client;
+    IOleClientSite *client_closed;
     IOleContainer *container;
     IOleInPlaceSiteEx *inplace;
 

Modified: trunk/reactos/dll/win32/ieframe/intshcut.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/intshcut.c?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ieframe/intshcut.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ieframe/intshcut.c  [iso-8859-1] Sun Jun  5 
19:18:20 2016
@@ -404,135 +404,119 @@
     return This->isDirty ? S_OK : S_FALSE;
 }
 
-/* A helper function:  Allocate and fill rString.  Return number of bytes 
read. */
-static DWORD get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName,
+/* Returns allocated profile string and a standard return code. */
+static HRESULT get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName,
                                 LPCWSTR lpFileName, WCHAR **rString )
 {
     DWORD r = 0;
     DWORD len = 128;
     WCHAR *buffer;
 
+    *rString = NULL;
     buffer = CoTaskMemAlloc(len * sizeof(*buffer));
-    if (buffer != NULL)
-    {
+    if (!buffer)
+        return E_OUTOFMEMORY;
+
+    r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, 
lpFileName);
+    while (r == len-1)
+    {
+        WCHAR *realloc_buf;
+
+        len *= 2;
+        realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer));
+        if (realloc_buf == NULL)
+        {
+            CoTaskMemFree(buffer);
+            return E_OUTOFMEMORY;
+        }
+        buffer = realloc_buf;
+
         r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, 
lpFileName);
-        while (r == len-1)
-        {
-            WCHAR *realloc_buf;
-
-            len *= 2;
-            realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer));
-            if (realloc_buf == NULL)
-            {
-                CoTaskMemFree(buffer);
-                *rString = NULL;
-                return 0;
-            }
-            buffer = realloc_buf;
-
-            r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, 
len, lpFileName);
-        }
     }
 
     *rString = buffer;
-    return r;
+    return r ? S_OK : E_FAIL;
 }
 
 static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR 
pszFileName, DWORD dwMode)
 {
-    WCHAR str_header[] = 
{'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0};
-    WCHAR str_URL[] = {'U','R','L',0};
-    WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0};
-    WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0};
+    InternetShortcut *This = impl_from_IPersistFile(pFile);
+    static WCHAR str_header[] = 
{'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0};
+    static WCHAR str_URL[] = {'U','R','L',0};
+    static WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0};
+    static WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0};
     WCHAR *filename = NULL;
+    WCHAR *url;
     HRESULT hr;
-    InternetShortcut *This = impl_from_IPersistFile(pFile);
+    IPropertyStorage *pPropStg;
+    WCHAR *iconfile;
+    WCHAR *iconindexstring;
+
     TRACE("(%p, %s, 0x%x)\n", pFile, debugstr_w(pszFileName), dwMode);
+
     if (dwMode != 0)
         FIXME("ignoring unimplemented mode 0x%x\n", dwMode);
+
     filename = co_strdupW(pszFileName);
-    if (filename != NULL)
-    {
-        DWORD r;
-        WCHAR *url;
-
-        r = get_profile_string(str_header, str_URL, pszFileName, &url);
-
-        if (url == NULL)
-        {
-            hr = E_OUTOFMEMORY;
-            CoTaskMemFree(filename);
-        }
-        else if (r == 0)
-        {
-            hr = E_FAIL;
-            CoTaskMemFree(filename);
-        }
-        else
-        {
-            hr = S_OK;
-            CoTaskMemFree(This->currentFile);
-            This->currentFile = filename;
-            CoTaskMemFree(This->url);
-            This->url = url;
-            This->isDirty = FALSE;
-        }
-
-        /* Now we're going to read in the iconfile and iconindex.
-           If we don't find them, that's not a failure case -- it's possible
-           that they just aren't in there. */
-        if (SUCCEEDED(hr))
-        {
-            IPropertyStorage *pPropStg;
-            WCHAR *iconfile;
-            WCHAR *iconindexstring;
-            hr = IPropertySetStorage_Open(This->property_set_storage, 
&FMTID_Intshcut,
-                                          STGM_READWRITE | 
STGM_SHARE_EXCLUSIVE,
-                                          &pPropStg);
-
-            if (get_profile_string(str_header, str_iconfile, pszFileName, 
&iconfile))
-            {
-                PROPSPEC ps;
-                PROPVARIANT pv;
-                ps.ulKind = PRSPEC_PROPID;
-                ps.u.propid = PID_IS_ICONFILE;
-                pv.vt = VT_LPWSTR;
-                pv.u.pwszVal = iconfile;
-                hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0);
-                if (FAILED(hr))
-                {
-                    TRACE("Failed to store the iconfile to our property 
storage.  hr = 0x%x\n", hr);
-                }
-            }
-            CoTaskMemFree(iconfile);
-
-            if (get_profile_string(str_header, str_iconindex, pszFileName, 
&iconindexstring))
-            {
-                int iconindex;
-                PROPSPEC ps;
-                PROPVARIANT pv;
-                char *iconindexastring = co_strdupWtoA(iconindexstring);
-                sscanf(iconindexastring, "%d", &iconindex);
-                CoTaskMemFree(iconindexastring);
-                ps.ulKind = PRSPEC_PROPID;
-                ps.u.propid = PID_IS_ICONINDEX;
-                pv.vt = VT_I4;
-                pv.u.iVal = iconindex;
-                hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0);
-                if (FAILED(hr))
-                {
-                    TRACE("Failed to store the iconindex to our property 
storage.  hr = 0x%x\n", hr);
-                }
-            }
-            CoTaskMemFree(iconindexstring);
-
-            IPropertyStorage_Release(pPropStg);
-        }
-        else
-            hr = E_OUTOFMEMORY;
-    }
-    else
-        hr = E_OUTOFMEMORY;
+    if (!filename)
+        return E_OUTOFMEMORY;
+
+    if (FAILED(hr = get_profile_string(str_header, str_URL, pszFileName, 
&url)))
+    {
+        CoTaskMemFree(filename);
+        return hr;
+    }
+
+    hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut,
+                STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStg);
+    if (FAILED(hr))
+    {
+        CoTaskMemFree(filename);
+        CoTaskMemFree(url);
+        return hr;
+    }
+
+    CoTaskMemFree(This->currentFile);
+    This->currentFile = filename;
+    CoTaskMemFree(This->url);
+    This->url = url;
+    This->isDirty = FALSE;
+
+    /* Now we're going to read in the iconfile and iconindex.
+       If we don't find them, that's not a failure case -- it's possible
+       that they just aren't in there. */
+
+    if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile) 
== S_OK)
+    {
+        PROPSPEC ps;
+        PROPVARIANT pv;
+        ps.ulKind = PRSPEC_PROPID;
+        ps.u.propid = PID_IS_ICONFILE;
+        pv.vt = VT_LPWSTR;
+        pv.u.pwszVal = iconfile;
+        hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0);
+        if (FAILED(hr))
+            TRACE("Failed to store the iconfile to our property storage.  hr = 
0x%x\n", hr);
+    }
+    CoTaskMemFree(iconfile);
+
+    if (get_profile_string(str_header, str_iconindex, pszFileName, 
&iconindexstring) == S_OK)
+    {
+        int iconindex;
+        PROPSPEC ps;
+        PROPVARIANT pv;
+        iconindex = strtolW(iconindexstring, NULL, 10);
+        ps.ulKind = PRSPEC_PROPID;
+        ps.u.propid = PID_IS_ICONINDEX;
+        pv.vt = VT_I4;
+        pv.u.iVal = iconindex;
+        hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0);
+        if (FAILED(hr))
+           TRACE("Failed to store the iconindex to our property storage.  hr = 
0x%x\n", hr);
+    }
+    CoTaskMemFree(iconindexstring);
+
+    IPropertyStorage_Release(pPropStg);
     return hr;
 }
 

Modified: trunk/reactos/dll/win32/ieframe/navigate.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/navigate.c?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ieframe/navigate.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ieframe/navigate.c  [iso-8859-1] Sun Jun  5 
19:18:20 2016
@@ -1228,9 +1228,152 @@
     HlinkFrame_UpdateHlink
 };
 
+static inline HlinkFrame *impl_from_ITargetFrame(ITargetFrame *iface)
+{
+    return CONTAINING_RECORD(iface, HlinkFrame, ITargetFrame_iface);
+}
+
+static HRESULT WINAPI TargetFrame_QueryInterface(ITargetFrame *iface, REFIID 
riid, void **ppv)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    return IUnknown_QueryInterface(This->outer, riid, ppv);
+}
+
+static ULONG WINAPI TargetFrame_AddRef(ITargetFrame *iface)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    return IUnknown_AddRef(This->outer);
+}
+
+static ULONG WINAPI TargetFrame_Release(ITargetFrame *iface)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    return IUnknown_Release(This->outer);
+}
+
+static HRESULT WINAPI TargetFrame_SetFrameName(ITargetFrame *iface, LPCWSTR 
pszFrameName)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameName));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetFrameName(ITargetFrame *iface, LPWSTR 
*ppszFrameName)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, ppszFrameName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetParentFrame(ITargetFrame *iface, IUnknown 
**ppunkParent)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, ppunkParent);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_FindFrame(ITargetFrame *iface, LPCWSTR 
pszTargetName,
+        IUnknown *ppunkContextFrame, DWORD dwFlags, IUnknown 
**ppunkTargetFrame)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%s %p %x %p)\n", This, debugstr_w(pszTargetName),
+            ppunkContextFrame, dwFlags, ppunkTargetFrame);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_SetFrameSrc(ITargetFrame *iface, LPCWSTR 
pszFrameSrc)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameSrc));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetFrameSrc(ITargetFrame *iface, LPWSTR 
*ppszFrameSrc)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, ppszFrameSrc);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetFramesContainer(ITargetFrame *iface, 
IOleContainer **ppContainer)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, ppContainer);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_SetFrameOptions(ITargetFrame *iface, DWORD 
dwFlags)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%x)\n", This, dwFlags);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetFrameOptions(ITargetFrame *iface, DWORD 
*pdwFlags)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, pdwFlags);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_SetFrameMargins(ITargetFrame *iface, DWORD 
dwWidth, DWORD dwHeight)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%d %d)\n", This, dwWidth, dwHeight);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_GetFrameMargins(ITargetFrame *iface, DWORD 
*pdwWidth, DWORD *pdwHeight)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p %p)\n", This, pdwWidth, pdwHeight);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_RemoteNavigate(ITargetFrame *iface, ULONG 
cLength, ULONG *pulData)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%u %p)\n", This, cLength, pulData);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_OnChildFrameActivate(ITargetFrame *iface, 
IUnknown *pUnkChildFrame)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, pUnkChildFrame);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI TargetFrame_OnChildFrameDeactivate(ITargetFrame *iface, 
IUnknown *pUnkChildFrame)
+{
+    HlinkFrame *This = impl_from_ITargetFrame(iface);
+    FIXME("(%p)->(%p)\n", This, pUnkChildFrame);
+    return E_NOTIMPL;
+}
+
+static const ITargetFrameVtbl TargetFrameVtbl = {
+    TargetFrame_QueryInterface,
+    TargetFrame_AddRef,
+    TargetFrame_Release,
+    TargetFrame_SetFrameName,
+    TargetFrame_GetFrameName,
+    TargetFrame_GetParentFrame,
+    TargetFrame_FindFrame,
+    TargetFrame_SetFrameSrc,
+    TargetFrame_GetFrameSrc,
+    TargetFrame_GetFramesContainer,
+    TargetFrame_SetFrameOptions,
+    TargetFrame_GetFrameOptions,
+    TargetFrame_SetFrameMargins,
+    TargetFrame_GetFrameMargins,
+    TargetFrame_RemoteNavigate,
+    TargetFrame_OnChildFrameActivate,
+    TargetFrame_OnChildFrameDeactivate
+};
+
 static inline HlinkFrame *impl_from_ITargetFrame2(ITargetFrame2 *iface)
 {
-    return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface);
+    return CONTAINING_RECORD(iface, HlinkFrame, ITargetFrame2_iface);
 }
 
 static HRESULT WINAPI TargetFrame2_QueryInterface(ITargetFrame2 *iface, REFIID 
riid, void **ppv)
@@ -1504,6 +1647,9 @@
     if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
         TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
         *ppv = &This->IHlinkFrame_iface;
+    }else if(IsEqualGUID(&IID_ITargetFrame, riid)) {
+        TRACE("(%p)->(IID_ITargetFrame %p)\n", This, ppv);
+        *ppv = &This->ITargetFrame_iface;
     }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) {
         TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv);
         *ppv = &This->ITargetFrame2_iface;
@@ -1526,7 +1672,8 @@
 
 void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host)
 {
-    This->IHlinkFrame_iface.lpVtbl   = &HlinkFrameVtbl;
+    This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl;
+    This->ITargetFrame_iface.lpVtbl = &TargetFrameVtbl;
     This->ITargetFrame2_iface.lpVtbl = &TargetFrame2Vtbl;
     This->ITargetFramePriv2_iface.lpVtbl = &TargetFramePriv2Vtbl;
     This->IWebBrowserPriv2IE9_iface.lpVtbl = &WebBrowserPriv2IE9Vtbl;

Modified: trunk/reactos/dll/win32/ieframe/oleobject.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/oleobject.c?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ieframe/oleobject.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ieframe/oleobject.c [iso-8859-1] Sun Jun  5 
19:18:20 2016
@@ -273,7 +273,7 @@
     return S_OK;
 }
 
-static void release_client_site(WebBrowser *This)
+static void release_client_site(WebBrowser *This, BOOL destroy_win)
 {
     release_dochost_client(&This->doc_host);
 
@@ -282,7 +282,12 @@
         This->client = NULL;
     }
 
-    if(This->shell_embedding_hwnd) {
+    if(This->client_closed) {
+        IOleClientSite_Release(This->client_closed);
+        This->client_closed = NULL;
+    }
+
+    if(destroy_win && This->shell_embedding_hwnd) {
         DestroyWindow(This->shell_embedding_hwnd);
         This->shell_embedding_hwnd = NULL;
     }
@@ -444,16 +449,29 @@
     WebBrowser *This = impl_from_IOleObject(iface);
     IDocHostUIHandler *hostui;
     IOleCommandTarget *olecmd;
+    BOOL get_olecmd = TRUE;
     IOleContainer *container;
     IDispatch *disp;
     HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, pClientSite);
 
+    if(This->client_closed) {
+        IOleClientSite_Release(This->client_closed);
+        This->client_closed = NULL;
+    }
+
     if(This->client == pClientSite)
         return S_OK;
 
-    release_client_site(This);
+    if(This->client && pClientSite) {
+        get_olecmd = FALSE;
+        olecmd = This->doc_host.olecmd;
+        if(olecmd)
+            IOleCommandTarget_AddRef(olecmd);
+    }
+
+    release_client_site(This, !pClientSite);
 
     if(!pClientSite) {
         on_commandstate_change(&This->doc_host, CSC_NAVIGATEBACK, FALSE);
@@ -477,31 +495,46 @@
     if(SUCCEEDED(hres))
         This->doc_host.hostui = hostui;
 
-    hres = IOleClientSite_GetContainer(This->client, &container);
-    if(SUCCEEDED(hres)) {
-        ITargetContainer *target_container;
-
-        hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer,
-                                            (void**)&target_container);
+    if(get_olecmd) {
+        hres = IOleClientSite_GetContainer(This->client, &container);
         if(SUCCEEDED(hres)) {
-            FIXME("Unsupported ITargetContainer\n");
-            ITargetContainer_Release(target_container);
+            ITargetContainer *target_container;
+
+            hres = IOleContainer_QueryInterface(container, 
&IID_ITargetContainer,
+                    (void**)&target_container);
+            if(SUCCEEDED(hres)) {
+                FIXME("Unsupported ITargetContainer\n");
+                ITargetContainer_Release(target_container);
+            }
+
+            hres = IOleContainer_QueryInterface(container, 
&IID_IOleCommandTarget, (void**)&olecmd);
+            if(FAILED(hres))
+                olecmd = NULL;
+
+            IOleContainer_Release(container);
+        }else {
+            hres = IOleClientSite_QueryInterface(This->client, 
&IID_IOleCommandTarget, (void**)&olecmd);
+            if(FAILED(hres))
+                olecmd = NULL;
         }
-
-        hres = IOleContainer_QueryInterface(container, &IID_IOleCommandTarget, 
(void**)&olecmd);
-        if(FAILED(hres))
-            olecmd = NULL;
-
-        IOleContainer_Release(container);
+    }
+
+    This->doc_host.olecmd = olecmd;
+
+    if(This->shell_embedding_hwnd) {
+        IOleInPlaceSite *inplace;
+        HWND parent;
+
+        hres = IOleClientSite_QueryInterface(This->client, 
&IID_IOleInPlaceSite, (void**)&inplace);
+        if(SUCCEEDED(hres)) {
+            hres = IOleInPlaceSite_GetWindow(inplace, &parent);
+            IOleInPlaceSite_Release(inplace);
+            if(SUCCEEDED(hres))
+                SHSetParentHwnd(This->shell_embedding_hwnd, parent);
+        }
     }else {
-        hres = IOleClientSite_QueryInterface(This->client, 
&IID_IOleCommandTarget, (void**)&olecmd);
-        if(FAILED(hres))
-            olecmd = NULL;
-    }
-
-    This->doc_host.olecmd = olecmd;
-
-    create_shell_embedding_hwnd(This);
+        create_shell_embedding_hwnd(This);
+    }
 
     on_offlineconnected_change(This);
     on_silent_change(This);
@@ -539,6 +572,8 @@
 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
 {
     WebBrowser *This = impl_from_IOleObject(iface);
+    IOleClientSite *client;
+    HRESULT hres;
 
     TRACE("(%p)->(%d)\n", This, dwSaveOption);
 
@@ -559,7 +594,13 @@
     if(This->inplace)
         IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace);
 
-    return IOleObject_SetClientSite(iface, NULL);
+    /* store old client site - we need to restore it in DoVerb */
+    client = This->client;
+    if(This->client)
+        IOleClientSite_AddRef(This->client);
+    hres = IOleObject_SetClientSite(iface, NULL);
+    This->client_closed = client;
+    return hres;
 }
 
 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD 
dwWhichMoniker, IMoniker* pmk)
@@ -600,6 +641,14 @@
 
     TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, 
lindex, hwndParent,
           wine_dbgstr_rect(lprcPosRect));
+
+    /* restore closed client site if we have one */
+    if(!This->client && This->client_closed) {
+        IOleClientSite *client = This->client_closed;
+        This->client_closed = NULL;
+        IOleObject_SetClientSite(iface, client);
+        IOleClientSite_Release(client);
+    }
 
     switch (iVerb)
     {
@@ -1162,5 +1211,5 @@
 
 void WebBrowser_OleObject_Destroy(WebBrowser *This)
 {
-    release_client_site(This);
-}
+    release_client_site(This, TRUE);
+}

Modified: trunk/reactos/media/doc/README.WINE
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=71551&r1=71550&r2=71551&view=diff
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun  5 19:18:20 2016
@@ -74,7 +74,7 @@
 reactos/dll/win32/hnetcfg             # Synced to WineStaging-1.9.11
 reactos/dll/win32/httpapi             # Synced to WineStaging-1.9.4
 reactos/dll/win32/iccvid              # Synced to WineStaging-1.9.11
-reactos/dll/win32/ieframe             # Synced to WineStaging-1.9.4
+reactos/dll/win32/ieframe             # Synced to WineStaging-1.9.11
 reactos/dll/win32/imaadp32.acm        # Synced to WineStaging-1.9.4
 reactos/dll/win32/imagehlp            # Synced to WineStaging-1.9.4
 reactos/dll/win32/imm32               # Synced to Wine-1.7.27


Reply via email to