[PATCH v3] ieframe: Enable visual styles.

Zhiyi Zhang zzhang at codeweavers.com
Thu Apr 14 02:26:11 CDT 2022


ieframe.dll uses manifest at ID 123. However, IEWinMain() is not called from rundll32.exe or
Control_RunDLL() so the manifest needs to be activated in IEWinMain(). This allows iexplore.exe
to enable theming.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v3: Supersede 232395. Activate context in IEWinMain() instead of DllMain(). Thanks, Jacek.

 dlls/ieframe/ieframe.manifest | 16 ++++++++++++++++
 dlls/ieframe/ieframe.rc       |  3 +++
 dlls/ieframe/iexplore.c       | 33 ++++++++++++++++++++++-----------
 3 files changed, 41 insertions(+), 11 deletions(-)
 create mode 100644 dlls/ieframe/ieframe.manifest

diff --git a/dlls/ieframe/ieframe.manifest b/dlls/ieframe/ieframe.manifest
new file mode 100644
index 00000000000..c8fd3eb4dce
--- /dev/null
+++ b/dlls/ieframe/ieframe.manifest
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity type="win32" name="Wine.Ieframe" version="0.0.0.0"/>
+<dependency>
+    <dependentAssembly>
+        <assemblyIdentity
+            type="win32"
+            name="Microsoft.Windows.Common-Controls"
+            version="6.0.0.0"
+            processorArchitecture="*"
+            publicKeyToken="6595b64144ccf1df"
+            language="*"
+        />
+    </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/dlls/ieframe/ieframe.rc b/dlls/ieframe/ieframe.rc
index aed8483e4ce..eb05a98dbc4 100644
--- a/dlls/ieframe/ieframe.rc
+++ b/dlls/ieframe/ieframe.rc
@@ -108,6 +108,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
 #include "wine/wine_common_ver.rc"
 
+/* @makedep: ieframe.manifest */
+123 RT_MANIFEST ieframe.manifest
+
 /* @makedep: ietoolbar.bmp */
 IDB_IETOOLBAR BITMAP ietoolbar.bmp
 
diff --git a/dlls/ieframe/iexplore.c b/dlls/ieframe/iexplore.c
index 27b72a64fa7..1616d4d7f84 100644
--- a/dlls/ieframe/iexplore.c
+++ b/dlls/ieframe/iexplore.c
@@ -1125,10 +1125,13 @@ static void release_dde(void)
  */
 DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
 {
+    BOOL embedding = FALSE, nohome = FALSE, manager = FALSE, activated = FALSE;
     MSG msg;
     HRESULT hres;
-    BOOL embedding = FALSE, nohome = FALSE, manager = FALSE;
-    DWORD reg_cookie;
+    HANDLE context = INVALID_HANDLE_VALUE;
+    DWORD reg_cookie, ret = 1;
+    ULONG_PTR context_cookie;
+    ACTCTXW actctx;
 
     static const WCHAR embeddingW[] = {'-','e','m','b','e','d','d','i','n','g',0};
     static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0};
@@ -1138,6 +1141,15 @@ DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
 
     CoInitialize(NULL);
 
+    memset(&actctx, 0, sizeof(actctx));
+    actctx.cbSize = sizeof(actctx);
+    actctx.hModule = ieframe_instance;
+    actctx.lpResourceName = MAKEINTRESOURCEW(123);
+    actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
+    context = CreateActCtxW(&actctx);
+    if (context != INVALID_HANDLE_VALUE)
+        activated = ActivateActCtx(context, &context_cookie);
+
     init_dde();
 
     while (*cmdline)
@@ -1173,17 +1185,13 @@ DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
     if (FAILED(hres))
     {
         ERR("failed to register CLSID_InternetExplorer%s: %08lx\n", manager ? "Manager" : "", hres);
-        CoUninitialize();
-        ExitProcess(1);
+        goto done;
     }
 
     if (!embedding)
     {
         if(!create_ie_window(nohome, cmdline))
-        {
-            CoUninitialize();
-            ExitProcess(1);
-        }
+            goto done;
     }
 
     /* run the message loop for this thread */
@@ -1196,8 +1204,11 @@ DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
     CoRevokeClassObject(reg_cookie);
     release_dde();
 
+    ret = 0;
+done:
     CoUninitialize();
-
-    ExitProcess(0);
-    return 0;
+    if (activated)
+        DeactivateActCtx(0, context_cookie);
+    ReleaseActCtx(context);
+    ExitProcess(ret);
 }
-- 
2.32.0



More information about the wine-devel mailing list