[PATCH 6/7] joy.cpl: Enable visual styles.

Zhiyi Zhang zzhang at codeweavers.com
Wed Apr 13 02:50:31 CDT 2022


joy.cpl uses manifest at ID 124. According to tests, manifest at ID 124 is not loaded automatically
by rundll32.exe or Control_RunDLL().

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/joy.cpl/joy.manifest | 16 ++++++++++++++++
 dlls/joy.cpl/joy.rc       |  3 +++
 dlls/joy.cpl/main.c       | 17 +++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 dlls/joy.cpl/joy.manifest

diff --git a/dlls/joy.cpl/joy.manifest b/dlls/joy.cpl/joy.manifest
new file mode 100644
index 00000000000..877860e3d68
--- /dev/null
+++ b/dlls/joy.cpl/joy.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.Joy" 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/joy.cpl/joy.rc b/dlls/joy.cpl/joy.rc
index 77f121c5b1c..c1d8380af37 100644
--- a/dlls/joy.cpl/joy.rc
+++ b/dlls/joy.cpl/joy.rc
@@ -77,6 +77,9 @@ FONT 8, "Ms Shell Dlg"
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
+/* @makedep: joy.manifest */
+124 RT_MANIFEST joy.manifest
+
 /* @makedep: joy.ico */
 ICO_MAIN ICON "joy.ico"
 
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index 3ecef2d9aa8..c1f41fb0e56 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -992,10 +992,24 @@ static void display_cpl_sheets(HWND parent, struct JoystickData *data)
 {
     INITCOMMONCONTROLSEX icex;
     PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES];
+    BOOL activated = FALSE;
     PROPSHEETHEADERW psh;
+    ULONG_PTR cookie;
+    ACTCTXW actctx;
+    HANDLE context;
     DWORD id = 0;
 
     OleInitialize(NULL);
+    /* Activate context */
+    memset(&actctx, 0, sizeof(actctx));
+    actctx.cbSize = sizeof(actctx);
+    actctx.hModule = hcpl;
+    actctx.lpResourceName = MAKEINTRESOURCEW(124);
+    actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
+    context = CreateActCtxW(&actctx);
+    if (context != INVALID_HANDLE_VALUE)
+        activated = ActivateActCtx(context, &cookie);
+
     /* Initialize common controls */
     icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
     icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
@@ -1039,6 +1053,9 @@ static void display_cpl_sheets(HWND parent, struct JoystickData *data)
     /* display the dialog */
     PropertySheetW(&psh);
 
+    if (activated)
+        DeactivateActCtx(0, cookie);
+    ReleaseActCtx(context);
     OleUninitialize();
 }
 
-- 
2.32.0




More information about the wine-devel mailing list