2023-02-26 22:08:55 +00:00
|
|
|
// ==WindhawkMod==
|
|
|
|
// @id classic-theme-windows
|
|
|
|
// @name Classic Theme Windows
|
|
|
|
// @description Forces Classic Theme on all Windows
|
2023-03-11 22:17:36 +00:00
|
|
|
// @version 0.2
|
2023-03-04 19:21:23 +00:00
|
|
|
// @author Travis, Cynosphere
|
2023-02-26 22:08:55 +00:00
|
|
|
// @include *
|
|
|
|
// @exclude wininit.exe
|
|
|
|
// @exclude winlogon.exe
|
|
|
|
// @exclude taskmgr.exe
|
|
|
|
// @exclude dwm.exe
|
|
|
|
// @exclude C:\Windows\System32\*.scr
|
|
|
|
// @exclude svchost.exe
|
|
|
|
// @exclude taskhostw.exe
|
|
|
|
// @exclude dllhost.exe
|
2023-03-11 22:17:36 +00:00
|
|
|
// @exclude rundll32.exe
|
2023-02-26 22:08:55 +00:00
|
|
|
// @exclude sihost.exe
|
|
|
|
// @exclude lsass.exe
|
|
|
|
// @exclude C:\Program Files (x86)\Steam\*
|
|
|
|
// @exclude msedge.exe
|
|
|
|
// @exclude vmware.exe
|
|
|
|
// @exclude vmware-vmx.exe
|
|
|
|
// @exclude Spotify.exe
|
|
|
|
// @exclude smartscreen.exe
|
|
|
|
// @exclude RuntimeBroker.exe
|
|
|
|
// @exclude ApplicationFrameHost.exe
|
|
|
|
// @exclude SystemSettings.exe
|
|
|
|
// @exclude SecHealthUI.exe
|
|
|
|
// @exclude SecurityHealthHost.exe
|
|
|
|
// @exclude PhoneExperienceHost.exe
|
|
|
|
// @exclude SecurityHealthTray.exe
|
|
|
|
// @exclude Window Detective.exe
|
2023-03-04 19:21:23 +00:00
|
|
|
// @compilerOptions -luxtheme -ldwmapi
|
2023-02-26 22:08:55 +00:00
|
|
|
// ==/WindhawkMod==
|
|
|
|
|
|
|
|
// ==WindhawkModReadme==
|
|
|
|
/*
|
|
|
|
# Classic Theme Windows
|
|
|
|
Forces Classic Theme on all Windows
|
|
|
|
*/
|
|
|
|
// ==/WindhawkModReadme==
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <uxtheme.h>
|
2023-03-04 19:21:23 +00:00
|
|
|
#include <dwmapi.h>
|
|
|
|
|
2023-03-11 22:17:36 +00:00
|
|
|
// BasicThemer2 reimplementation to render classic titlebars
|
|
|
|
/*static const int DisableDWM = DWMNCRP_DISABLED;
|
2023-03-04 19:21:23 +00:00
|
|
|
static const int EnableDWM = DWMNCRP_ENABLED;
|
|
|
|
|
|
|
|
void BasicThemerEnable(HWND hwnd) {
|
|
|
|
DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &DisableDWM, sizeof(int));
|
|
|
|
}
|
|
|
|
void BasicThemerDisable(HWND hwnd) {
|
|
|
|
DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &EnableDWM, sizeof(int));
|
|
|
|
}
|
|
|
|
|
|
|
|
using CreateWindowExW_t = decltype(&CreateWindowExW);
|
|
|
|
CreateWindowExW_t CreateWindowExW_Orig;
|
|
|
|
HWND WINAPI CreateWindowExW_Hook(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam) {
|
|
|
|
HWND res = CreateWindowExW_Orig(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam);
|
|
|
|
|
|
|
|
BasicThemerEnable(res);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
using CreateWindowExA_t = decltype(&CreateWindowExA);
|
|
|
|
CreateWindowExA_t CreateWindowExA_Orig;
|
|
|
|
HWND WINAPI CreateWindowExA_Hook(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam) {
|
|
|
|
HWND res = CreateWindowExA_Orig(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam);
|
|
|
|
|
|
|
|
BasicThemerEnable(res);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CALLBACK EnableBasicThemerForAll(HWND hWnd, LPARAM lParam) {
|
2023-03-11 22:17:36 +00:00
|
|
|
if (IsWindow(hWnd))
|
|
|
|
BasicThemerEnable(hWnd);
|
2023-03-04 19:21:23 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
BOOL CALLBACK DisableBasicThemerForAll(HWND hWnd, LPARAM lParam) {
|
2023-03-11 22:17:36 +00:00
|
|
|
if (IsWindow(hWnd))
|
|
|
|
BasicThemerDisable(hWnd);
|
2023-03-04 19:21:23 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2023-03-11 22:17:36 +00:00
|
|
|
}*/
|
2023-02-26 22:08:55 +00:00
|
|
|
|
2023-03-11 22:17:36 +00:00
|
|
|
// Windhawk function
|
2023-02-26 22:08:55 +00:00
|
|
|
BOOL Wh_ModInit() {
|
2023-03-11 22:17:36 +00:00
|
|
|
// Enable classic theme
|
2023-02-26 22:08:55 +00:00
|
|
|
SetThemeAppProperties(0);
|
2023-03-04 19:21:23 +00:00
|
|
|
|
2023-03-11 22:17:36 +00:00
|
|
|
// BasicThemer hooks
|
|
|
|
/*Wh_SetFunctionHook((void*)CreateWindowExW,
|
2023-03-04 19:21:23 +00:00
|
|
|
(void*)CreateWindowExW_Hook,
|
|
|
|
(void**)&CreateWindowExW_Orig);
|
|
|
|
Wh_SetFunctionHook((void*)CreateWindowExA,
|
|
|
|
(void*)CreateWindowExA_Hook,
|
|
|
|
(void**)&CreateWindowExA_Orig);
|
|
|
|
|
2023-03-11 22:17:36 +00:00
|
|
|
// Iterate every window to enable BasicThemer
|
2023-03-04 19:21:23 +00:00
|
|
|
DWORD thisPid = GetProcessIdOfThread(GetCurrentThread());
|
2023-03-11 22:17:36 +00:00
|
|
|
EnumWindows(EnableBasicThemerForAll, thisPid);*/
|
2023-03-04 19:21:23 +00:00
|
|
|
|
2023-02-26 22:08:55 +00:00
|
|
|
return TRUE;
|
2023-03-04 19:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Wh_ModUninit() {
|
2023-03-11 22:17:36 +00:00
|
|
|
// Disable classic theme
|
2023-03-04 19:21:23 +00:00
|
|
|
if (GetThemeAppProperties() == 0) {
|
|
|
|
SetThemeAppProperties(3);
|
|
|
|
}
|
|
|
|
|
2023-03-11 22:17:36 +00:00
|
|
|
// Iterate every window to disable BasicThemer
|
|
|
|
/*DWORD thisPid = GetProcessIdOfThread(GetCurrentThread());
|
|
|
|
EnumWindows(DisableBasicThemerForAll, thisPid);*/
|
2023-02-26 22:08:55 +00:00
|
|
|
}
|