[PATCH 3/5] ieframe: Add stub implementation of IInternetExplorerManager.

Zebediah Figura zfigura at codeweavers.com
Tue Aug 8 12:56:40 CDT 2017


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/ieframe/ieframe.h         |  1 +
 dlls/ieframe/ieframe_main.c    | 43 +++++++++++++++-------
 dlls/ieframe/iexplore.c        | 81 ++++++++++++++++++++++++++++++++++++++++++
 programs/iexplore/iexplore.inf |  3 ++
 4 files changed, 115 insertions(+), 13 deletions(-)

diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h
index d1f1c5daf24..d8b5aa65da3 100644
--- a/dlls/ieframe/ieframe.h
+++ b/dlls/ieframe/ieframe.h
@@ -319,6 +319,7 @@ HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) D
 HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
 HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
 HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
+HRESULT WINAPI InternetExplorerManager_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
 
 extern LONG module_ref DECLSPEC_HIDDEN;
 extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
diff --git a/dlls/ieframe/ieframe_main.c b/dlls/ieframe/ieframe_main.c
index c6eaa845167..b777b437a19 100644
--- a/dlls/ieframe/ieframe_main.c
+++ b/dlls/ieframe/ieframe_main.c
@@ -18,9 +18,11 @@
 
 #include "ieframe.h"
 
+#include "initguid.h"
 #include "rpcproxy.h"
 #include "shlguid.h"
 #include "isguids.h"
+#include "ieautomation.h"
 
 #include "wine/debug.h"
 
@@ -240,29 +242,44 @@ static const IClassFactoryVtbl InternetExplorerFactoryVtbl = {
 
 static IClassFactory InternetExplorerFactory = { &InternetExplorerFactoryVtbl };
 
+static const IClassFactoryVtbl InternetExplorerManagerFactoryVtbl = {
+    ClassFactory_QueryInterface,
+    ClassFactory_AddRef,
+    ClassFactory_Release,
+    InternetExplorerManager_Create,
+    ClassFactory_LockServer
+};
+
+static IClassFactory InternetExplorerManagerFactory = { &InternetExplorerManagerFactoryVtbl };
+
 HRESULT register_class_object(BOOL do_reg)
 {
     HRESULT hres;
 
-    static DWORD cookie;
+    static DWORD ie_cookie, iem_cookie;
 
     if(do_reg) {
         hres = CoRegisterClassObject(&CLSID_InternetExplorer,
                 (IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER,
-                REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie);
-        if (FAILED(hres)) {
+                REGCLS_MULTIPLEUSE, &ie_cookie);
+        if (FAILED(hres))
+            ERR("failed to register object %08x\n", hres);
+        hres = CoRegisterClassObject(&CLSID_InternetExplorerManager,
+                (IUnknown*)&InternetExplorerManagerFactory, CLSCTX_SERVER,
+                REGCLS_MULTIPLEUSE, &iem_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);
+    else
+    {
+        hres = CoRevokeClassObject(ie_cookie);
+        if (FAILED(hres))
+            ERR("failed to register object %08x\n", hres);
+        hres = CoRevokeClassObject(iem_cookie);
+        if (FAILED(hres))
+            ERR("failed to register object %08x\n", hres);
+    }
+    return hres;
 }
 
 /***********************************************************************
diff --git a/dlls/ieframe/iexplore.c b/dlls/ieframe/iexplore.c
index 27257fd1996..f593049609c 100644
--- a/dlls/ieframe/iexplore.c
+++ b/dlls/ieframe/iexplore.c
@@ -39,6 +39,7 @@
 #include "shlwapi.h"
 #include "intshcut.h"
 #include "ddeml.h"
+#include "ieautomation.h"
 
 #include "wine/debug.h"
 
@@ -839,6 +840,86 @@ HRESULT WINAPI InternetExplorer_Create(IClassFactory *iface, IUnknown *pOuter, R
     return S_OK;
 }
 
+/******************************************************************
+ *      IInternetExplorerManager implementation
+ */
+struct internet_explorer_manager {
+    IInternetExplorerManager IInternetExplorerManager_iface;
+    LONG ref;
+};
+
+static inline struct internet_explorer_manager *impl_from_IInternetExplorerManager(IInternetExplorerManager *iface)
+{
+    return CONTAINING_RECORD(iface, struct internet_explorer_manager, IInternetExplorerManager_iface);
+}
+
+static HRESULT WINAPI InternetExplorerManager_QueryInterface(IInternetExplorerManager *iface, REFIID riid, void **out)
+{
+    TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), out);
+
+    if (IsEqualGUID(riid, &IID_IInternetExplorerManager) || IsEqualGUID(riid, &IID_IUnknown))
+    {
+        IInternetExplorerManager_AddRef(iface);
+        *out = iface;
+        return S_OK;
+    }
+
+    FIXME("interface %s not implemented\n", debugstr_guid(riid));
+    *out = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI InternetExplorerManager_AddRef(IInternetExplorerManager *iface)
+{
+    struct internet_explorer_manager *This = impl_from_IInternetExplorerManager(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) increasing refcount to %u\n", iface, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI InternetExplorerManager_Release(IInternetExplorerManager *iface)
+{
+    struct internet_explorer_manager *This = impl_from_IInternetExplorerManager(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) decreasing refcount to %u\n", iface, ref);
+
+    if (ref == 0)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
+}
+
+static HRESULT WINAPI InternetExplorerManager_CreateObject(IInternetExplorerManager *iface, DWORD config, LPCWSTR url, REFIID riid, void **ppv)
+{
+    FIXME("(%p)->(0x%x, %s, %s, %p) semi-stub\n", iface, config, debugstr_w(url), debugstr_guid(riid), ppv);
+
+    return CoCreateInstance(&CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, riid, ppv);
+}
+
+static const IInternetExplorerManagerVtbl InternetExplorerManager_vtbl =
+{
+    InternetExplorerManager_QueryInterface,
+    InternetExplorerManager_AddRef,
+    InternetExplorerManager_Release,
+    InternetExplorerManager_CreateObject,
+};
+
+HRESULT WINAPI InternetExplorerManager_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
+{
+    struct internet_explorer_manager *ret;
+
+    TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
+
+    if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret))))
+        return E_OUTOFMEMORY;
+
+    ret->IInternetExplorerManager_iface.lpVtbl = &InternetExplorerManager_vtbl;
+    return IInternetExplorerManager_QueryInterface(&ret->IInternetExplorerManager_iface, riid, ppv);
+}
+
 void released_obj(void)
 {
     if(!InterlockedDecrement(&obj_cnt))
diff --git a/programs/iexplore/iexplore.inf b/programs/iexplore/iexplore.inf
index a8538d8883b..1886352b282 100644
--- a/programs/iexplore/iexplore.inf
+++ b/programs/iexplore/iexplore.inf
@@ -22,6 +22,8 @@ HKCR,"CLSID\%CLSID_Internet%\Shell\OpenHomePage",,,"Open &Home Page"
 HKCR,"CLSID\%CLSID_Internet%\Shell\OpenHomePage\Command",,,"""%16422%\Internet Explorer\iexplore.exe"""
 HKCR,"CLSID\%CLSID_Internet%\ShellFolder",,2,"0x24"
 
+HKCR,"CLSID\%CLSID_InternetExplorerManager%\LocalServer32",,,"""%16422%\Internet Explorer\iexplore.exe"" -startmanager"
+
 
 [Settings.Reg]
 HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",2,"http://www.winehq.org"
@@ -42,3 +44,4 @@ HKLM,"Software\Microsoft\Internet Explorer","W2kVersion",,"9.0.8112.16421"
 [Strings]
 CLSID_InternetExplorer="{0002df01-0000-0000-c000-000000000046}"
 CLSID_Internet="{871c5380-42a0-1069-a2ea-08002b30309d}"
+CLSID_InternetExplorerManager="{df4fcc34-067a-4e0a-8352-4a1a5095346e}"
-- 
2.13.3




More information about the wine-patches mailing list