From 5e9811a9c4d9b41c26d0bf6818c2d46be76646ac Mon Sep 17 00:00:00 2001 From: William Kent Date: Fri, 6 Sep 2024 12:54:42 -0400 Subject: [PATCH] [ACLAYERS] Add shim to force "Aero" theme name Some programs designed to run on Windows Vista and later assume that the theme is always named "Aero". On ReactOS the theme name can be anything. One example of such a program is WPF (both the .NET Framework and .NET 8/9 versions). Without a shim like this one, WPF would not be able to determine its default resources and programs that use it would suffer visual issues, if not outright crash. --- dll/appcompat/shims/layer/CMakeLists.txt | 1 + dll/appcompat/shims/layer/aero.c | 34 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 dll/appcompat/shims/layer/aero.c diff --git a/dll/appcompat/shims/layer/CMakeLists.txt b/dll/appcompat/shims/layer/CMakeLists.txt index 74c7fb0c7b9d1..37c57d9894621 100644 --- a/dll/appcompat/shims/layer/CMakeLists.txt +++ b/dll/appcompat/shims/layer/CMakeLists.txt @@ -4,6 +4,7 @@ include_directories(${SHIMLIB_DIR}) spec2def(aclayers.dll layer.spec) list(APPEND SOURCE + aero.c dispmode.c forcedxsetupsuccess.c ignoreloadlibrary.c diff --git a/dll/appcompat/shims/layer/aero.c b/dll/appcompat/shims/layer/aero.c new file mode 100644 index 0000000000000..8f5f75904580d --- /dev/null +++ b/dll/appcompat/shims/layer/aero.c @@ -0,0 +1,34 @@ +/* + * PROJECT: ReactOS 'Layers' Shim library + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Display settings related shims + * COPYRIGHT: Copyright 2024 William Kent (wjk011@gmail.com) + */ + +#include "string.h" +#define WIN32_NO_STATUS +#include +#include +#include +#include + +#define SHIM_NS AeroThemeName +#include + +HRESULT WINAPI SHIM_OBJ_NAME(GetCurrentThemeNameRedirect)( + LPWSTR pszThemeName, int cchThemeName, + LPWSTR pszColor, int cchColor, + LPWSTR pszSize, int cchSize) +{ + StringCbCopyW(pszThemeName, cchThemeName, L"Aero"); + if (pszColor != NULL) StringCbCopyW(pszColor, cchColor, L"NormalColor"); + if (pszSize != NULL) StringCbCopyW(pszSize, cchSize, L"Normal"); + + return S_OK; +} + +#define SHIM_NUM_HOOKS 1 +#define SHIM_SETUP_HOOKS \ + SHIM_HOOK(0, "UXTHEME.DLL", "GetCurrentThemeName", SHIM_OBJ_NAME(GetCurrentThemeNameRedirect)) + +#include