add classic file picker
This commit is contained in:
parent
bece87aa6b
commit
42ed283bfe
2 changed files with 72 additions and 21 deletions
52
classic-file-picker.wh.cpp
Normal file
52
classic-file-picker.wh.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
// ==WindhawkMod==
|
||||
// @id classic-file-picker
|
||||
// @name Classic File Picker
|
||||
// @description Redirect the Windows Vista+ file picker to the Windows XP one
|
||||
// @version 0.1
|
||||
// @author Cynosphere
|
||||
// @github https://github.com/cynosphere
|
||||
// @homepage https://c7.pm
|
||||
// @include *
|
||||
// @compilerOptions -lole32 -lcomdlg32
|
||||
// ==/WindhawkMod==
|
||||
|
||||
// ==WindhawkModReadme==
|
||||
/*
|
||||
# Classic File Picker
|
||||
*/
|
||||
// ==/WindhawkModReadme==
|
||||
|
||||
template<class S>
|
||||
CLSID CreateGUID(const S& hexString)
|
||||
{
|
||||
CLSID clsid;
|
||||
CLSIDFromString(hexString, &clsid);
|
||||
|
||||
return clsid;
|
||||
}
|
||||
|
||||
const CLSID CLSID_FileOpenDialog = CreateGUID(L"{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}");
|
||||
const CLSID CLSID_FileOpenDialogLegacy = CreateGUID(L"{725F645B-EAED-4fc5-B1C5-D9AD0ACCBA5E}");
|
||||
const CLSID CLSID_FileSaveDialog = CreateGUID(L"{c0b4e2f3-ba21-4773-8dba-335ec946eb8b}");
|
||||
const CLSID CLSID_FileSaveDialogLegacy = CreateGUID(L"{AF02484C-A0A9-4669-9051-058AB12B9195}");
|
||||
|
||||
using CoCreateInstance_t = decltype(&CoCreateInstance);
|
||||
CoCreateInstance_t CoCreateInstance_Original;
|
||||
HRESULT WINAPI CoCreateInstance_Hook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv) {
|
||||
if (rclsid == CLSID_FileOpenDialog) {
|
||||
return CoCreateInstance_Original(CLSID_FileOpenDialogLegacy, pUnkOuter, dwClsContext, riid, ppv);
|
||||
} else if (rclsid == CLSID_FileSaveDialog) {
|
||||
return CoCreateInstance_Original(CLSID_FileSaveDialogLegacy, pUnkOuter, dwClsContext, riid, ppv);
|
||||
}
|
||||
|
||||
return CoCreateInstance_Original(rclsid, pUnkOuter, dwClsContext, riid, ppv);
|
||||
}
|
||||
|
||||
BOOL Wh_ModInit() {
|
||||
Wh_SetFunctionHook((void*)CoCreateInstance, (void*)CoCreateInstance_Hook,
|
||||
(void**)&CoCreateInstance_Original);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Wh_ModUninit() {}
|
|
@ -2,7 +2,7 @@
|
|||
// @id classic-theme-windows
|
||||
// @name Classic Theme Windows
|
||||
// @description Forces Classic Theme on all Windows
|
||||
// @version 0.1
|
||||
// @version 0.2
|
||||
// @author Travis, Cynosphere
|
||||
// @include *
|
||||
// @exclude wininit.exe
|
||||
|
@ -13,16 +13,13 @@
|
|||
// @exclude svchost.exe
|
||||
// @exclude taskhostw.exe
|
||||
// @exclude dllhost.exe
|
||||
// @exclude conhost.exe
|
||||
// @exclude rundll32.exe
|
||||
// @exclude sihost.exe
|
||||
// @exclude lsass.exe
|
||||
// @exclude C:\Program Files (x86)\Steam\*
|
||||
// @exclude Code.exe
|
||||
// @exclude Code - Insiders.exe
|
||||
// @exclude msedge.exe
|
||||
// @exclude vmware.exe
|
||||
// @exclude vmware-vmx.exe
|
||||
// @exclude rundll32.exe
|
||||
// @exclude Spotify.exe
|
||||
// @exclude smartscreen.exe
|
||||
// @exclude RuntimeBroker.exe
|
||||
|
@ -33,6 +30,7 @@
|
|||
// @exclude PhoneExperienceHost.exe
|
||||
// @exclude SecurityHealthTray.exe
|
||||
// @exclude Window Detective.exe
|
||||
// @exclude imhex.exe
|
||||
// @compilerOptions -luxtheme -ldwmapi
|
||||
// ==/WindhawkMod==
|
||||
|
||||
|
@ -47,7 +45,8 @@ Forces Classic Theme on all Windows
|
|||
#include <uxtheme.h>
|
||||
#include <dwmapi.h>
|
||||
|
||||
static const int DisableDWM = DWMNCRP_DISABLED;
|
||||
// BasicThemer2 reimplementation to render classic titlebars
|
||||
/*static const int DisableDWM = DWMNCRP_DISABLED;
|
||||
static const int EnableDWM = DWMNCRP_ENABLED;
|
||||
|
||||
void BasicThemerEnable(HWND hwnd) {
|
||||
|
@ -77,45 +76,45 @@ HWND WINAPI CreateWindowExA_Hook(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWin
|
|||
}
|
||||
|
||||
BOOL CALLBACK EnableBasicThemerForAll(HWND hWnd, LPARAM lParam) {
|
||||
if (IsWindow(hWnd))
|
||||
BasicThemerEnable(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
BOOL CALLBACK DisableBasicThemerForAll(HWND hWnd, LPARAM lParam) {
|
||||
if (IsWindow(hWnd))
|
||||
BasicThemerDisable(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Windhawk function
|
||||
BOOL Wh_ModInit() {
|
||||
//Wh_Log(L"Init");
|
||||
|
||||
//Wh_Log(L"Theme properties were: 0x%x", GetThemeAppProperties());
|
||||
// Enable classic theme
|
||||
SetThemeAppProperties(0);
|
||||
//Wh_Log(L"Theme properties are: 0x%x", GetThemeAppProperties());
|
||||
|
||||
Wh_SetFunctionHook((void*)CreateWindowExW,
|
||||
// BasicThemer hooks
|
||||
/*Wh_SetFunctionHook((void*)CreateWindowExW,
|
||||
(void*)CreateWindowExW_Hook,
|
||||
(void**)&CreateWindowExW_Orig);
|
||||
Wh_SetFunctionHook((void*)CreateWindowExA,
|
||||
(void*)CreateWindowExA_Hook,
|
||||
(void**)&CreateWindowExA_Orig);
|
||||
|
||||
// Iterate every window to enable BasicThemer
|
||||
DWORD thisPid = GetProcessIdOfThread(GetCurrentThread());
|
||||
EnumWindows(EnableBasicThemerForAll, thisPid);
|
||||
EnumWindows(EnableBasicThemerForAll, thisPid);*/
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Wh_ModUninit() {
|
||||
//Wh_Log(L"Uninit");
|
||||
|
||||
//Wh_Log(L"Theme properties were: 0x%x", GetThemeAppProperties());
|
||||
// Disable classic theme
|
||||
if (GetThemeAppProperties() == 0) {
|
||||
SetThemeAppProperties(3);
|
||||
}
|
||||
//Wh_Log(L"Theme properties are: 0x%x", GetThemeAppProperties());
|
||||
|
||||
DWORD thisPid = GetProcessIdOfThread(GetCurrentThread());
|
||||
EnumWindows(DisableBasicThemerForAll, thisPid);
|
||||
// Iterate every window to disable BasicThemer
|
||||
/*DWORD thisPid = GetProcessIdOfThread(GetCurrentThread());
|
||||
EnumWindows(DisableBasicThemerForAll, thisPid);*/
|
||||
}
|
Loading…
Reference in a new issue