1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

GetProcAddress for some stuff from uxtheme

This commit is contained in:
Valentin Radu 2021-10-06 02:50:09 +03:00
parent 215ac7952e
commit c1af3103b0
2 changed files with 61 additions and 2 deletions

View File

@ -67,6 +67,16 @@ static HWND(WINAPI* CreateWindowInBand)(
_In_opt_ LPVOID lpParam,
DWORD band
);
static void(*SetPreferredAppMode)(INT64 bAllowDark);
static void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);
static BOOL(*ShouldAppsUseDarkMode)();
static void(*GetThemeName)(void*, void*, void*);
static BOOL AppsShouldUseDarkMode() { return TRUE; }
#pragma endregion
@ -622,7 +632,7 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook(
if (hStartIsBack64 && bMicaEffectOnTitlebar)
{
BOOL value = TRUE;
DwmSetWindowAttribute(hWndParent, 1029, &value, sizeof(BOOL)); // Set Mica effect on title bar
DwmSetWindowAttribute(hWndParent, DWMWA_MICA_EFFFECT, &value, sizeof(BOOL)); // Set Mica effect on title bar
SetWindowSubclass(
result,
(uintptr_t)hStartIsBack64 + SB_MICA_EFFECT_SUBCLASS_OFFSET,
@ -1338,10 +1348,18 @@ __declspec(dllexport) DWORD WINAPI main(
HANDLE hUser32 = LoadLibraryW(L"user32.dll");
if (hUser32) CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");
CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");
printf("Setup user32 functions done\n");
HANDLE hUxtheme = LoadLibraryW(L"uxtheme.dll");
SetPreferredAppMode = GetProcAddress(hUxtheme, (LPCSTR)0x87);
AllowDarkModeForWindow = GetProcAddress(hUxtheme, (LPCSTR)0x85);
ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x84);
GetThemeName = GetProcAddress(hUxtheme, (LPCSTR)0x4A);
printf("Setup uxtheme functions done\n");
HANDLE hTwinuiPcshell = LoadLibraryW(L"twinui.pcshell.dll");
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc = (INT64(*)(HWND, int, HWND, int, BOOL*))

View File

@ -3,6 +3,9 @@
#include <Windows.h>
#include <tchar.h>
#include <windows.data.xml.dom.h>
#include <accctrl.h>
#include <aclapi.h>
#include <sddl.h>
#include <Shlobj_core.h>
#define _LIBVALINET_INCLUDE_UNIVERSAL
#include <valinet/universal/toast/toast.h>
@ -12,6 +15,44 @@
#define SPECIAL_FOLDER CSIDL_APPDATA
#define APP_RELATIVE_PATH "\\ExplorerPatcher"
// This allows compiling with older Windows SDKs as well
#ifndef DWMWA_USE_HOSTBACKDROPBRUSH
#define DWMWA_USE_HOSTBACKDROPBRUSH 17 // [set] BOOL, Allows the use of host backdrop brushes for the window.
#endif
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 // [set] BOOL, Allows a window to either use the accent color, or dark, according to the user Color Mode preferences.
#endif
#ifndef DWMWCP_DEFAULT
#define DWMWCP_DEFAULT 0
#endif
#ifndef DWMWCP_DONOTROUND
#define DWMWCP_DONOTROUND 1
#endif
#ifndef DWMWCP_ROUND
#define DWMWCP_ROUND 2
#endif
#ifndef DWMWCP_ROUNDSMALL
#define DWMWCP_ROUNDSMALL 3
#endif
#ifndef DWMWA_WINDOW_CORNER_PREFERENCE
#define DWMWA_WINDOW_CORNER_PREFERENCE 33 // [set] WINDOW_CORNER_PREFERENCE, Controls the policy that rounds top-level window corners
#endif
#ifndef DWMWA_BORDER_COLOR
#define DWMWA_BORDER_COLOR 34 // [set] COLORREF, The color of the thin border around a top-level window
#endif
#ifndef DWMWA_CAPTION_COLOR
#define DWMWA_CAPTION_COLOR 35 // [set] COLORREF, The color of the caption
#endif
#ifndef DWMWA_TEXT_COLOR
#define DWMWA_TEXT_COLOR 36 // [set] COLORREF, The color of the caption text
#endif
#ifndef DWMWA_VISIBLE_FRAME_BORDER_THICKNESS
#define DWMWA_VISIBLE_FRAME_BORDER_THICKNESS 37 // [get] UINT, width of the visible border around a thick frame window
#endif
#ifndef DWMWA_MICA_EFFFECT
#define DWMWA_MICA_EFFFECT 1029
#endif
#pragma region "Weird stuff"
INT64 nimpl4_1(INT64 a1, DWORD* a2);
INT64 nimpl4_0(INT64 a1, DWORD* a2);