forgot about this repo

This commit is contained in:
Cynthia Foxwell 2024-02-23 23:10:28 -07:00
parent f45b3c95f1
commit 93695b1c96
3 changed files with 552 additions and 0 deletions

View file

@ -0,0 +1,93 @@
// ==WindhawkMod==
// @id classic-explorer-toolbars
// @name Classic Explorer Toolbars
// @description Restyles Explorer toolbars to fit in with classic theme
// @version 1.0.1
// @author Cynosphere
// @github https://github.com/Cynosphere
// @homepage https://c7.pm
// @include explorer.exe
// @compilerOptions -lcomdlg32
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# Classic Explorer Toolbars
Restyles Explorer toolbars to fit in with classic theme
## Changelog
**1.0.1** (2023/12/10)
- Fix applying to taskbar
**1.0.0** (2023/11/27)
- Initial release
*/
// ==/WindhawkModReadme==
#include <windhawk_utils.h>
#ifdef _WIN64
# define THISCALL __cdecl
# define STHISCALL L"__cdecl"
#else
# define THISCALL __thiscall
# define STHISCALL L"__thiscall"
#endif
typedef long (THISCALL *BandSite__Initialize_t)(int* pThis, HWND hWnd);
BandSite__Initialize_t CBandSite__Initialize_orig;
long THISCALL CBandSite__Initialize_hook(int* pThis, HWND hWnd) {
long ret = CBandSite__Initialize_orig(pThis, hWnd);
// FIXME: pointer math bad!
HWND barHwnd = *((HWND *)pThis + 17);
if (barHwnd) {
HWND parentHwnd = GetParent(barHwnd);
WCHAR lpParCls[256];
GetClassNameW(parentHwnd, lpParCls, 256);
if (!wcscmp(lpParCls, L"WorkerW")) {
LONG style = GetWindowLongPtrW(barHwnd, GWL_STYLE);
style |= RBS_BANDBORDERS;
style |= WS_BORDER;
SetWindowLongPtrW(barHwnd, GWL_STYLE, style);
}
}
return ret;
}
BOOL Wh_ModInit() {
HMODULE hExplorerFrame = LoadLibraryW(L"ExplorerFrame.dll");
if (!hExplorerFrame)
{
Wh_Log(L"Failed to load ExplorerFrame.dll");
return FALSE;
}
const WindhawkUtils::SYMBOL_HOOK hooks[] = {
{
{
L"protected: virtual long "
STHISCALL
L" CBandSite::_Initialize(struct HWND__ *)"
},
&CBandSite__Initialize_orig,
CBandSite__Initialize_hook,
false
}
};
if (!WindhawkUtils::HookSymbols(
hExplorerFrame,
hooks,
ARRAYSIZE(hooks)
))
{
Wh_Log(L"Failed to hook CBandSite::_Initialize");
return FALSE;
}
return TRUE;
}

View file

@ -0,0 +1,67 @@
// ==WindhawkMod==
// @id hide-navigation-bar
// @name Hide Navigation Bar
// @description Hide navigation bar by removing it entirely
// @version 0.1
// @author Cynosphere
// @github https://github.com/Cynosphere
// @homepage https://c7.pm
// @include explorer.exe
// @compilerOptions -lcomdlg32
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# Hide Navigation Bar
*/
// ==/WindhawkModReadme==
#include <windhawk_utils.h>
#ifdef _WIN64
# define THISCALL __cdecl
# define STHISCALL L"__cdecl"
#else
# define THISCALL __thiscall
# define STHISCALL L"__thiscall"
#endif
typedef long (THISCALL *CNavBar__CreateBar_t)(void *);
CNavBar__CreateBar_t CNavBar__CreateBar_orig;
long THISCALL CNavBar__CreateBar_hook(void *pThis) {
return 0;
}
BOOL Wh_ModInit() {
HMODULE hExplorerFrame = LoadLibraryW(L"ExplorerFrame.dll");
if (!hExplorerFrame)
{
Wh_Log(L"Failed to load ExplorerFrame.dll");
return FALSE;
}
const WindhawkUtils::SYMBOL_HOOK hooks[] = {
{
{
L"protected: long "
STHISCALL
L" CNavBar::_CreateBar(void)"
},
&CNavBar__CreateBar_orig,
CNavBar__CreateBar_hook,
false
}
};
if (!WindhawkUtils::HookSymbols(
hExplorerFrame,
hooks,
ARRAYSIZE(hooks)
))
{
Wh_Log(L"Failed to hook CAddressBand::_CreateAddressBand");
return FALSE;
}
return TRUE;
}

392
winver-customizer.wh.cpp Normal file
View file

@ -0,0 +1,392 @@
// ==WindhawkMod==
// @id winver-customizer
// @name Winver Customizer
// @description Modify winver without system mods
// @version 1.0.0
// @author Cynosphere
// @github https://github.com/cynosphere
// @homepage https://c7.pm
// @include *
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# Winver Customizer
Customize winver without system mods
- Choose different layouts from different OS iterations
- Replace the banner with whatever image you want. **All pixels set to #FFFFFF will become transparent!**
*/
// ==/WindhawkModReadme==
// ==WindhawkModSettings==
/*
- banner: ""
$name: Banner path
$description: Must be a bitmap
- layout: default
$name: Layout
$description: What OS layout to use
$options:
- default: System default
- 2k: Windows 2000
- xpsp1: Windows XP (SP1 and earlier)
- xpsp2: Windows XP (SP2 and later)
- vista: Windows Vista
*/
// ==/WindhawkModSettings==
#include <windhawk_api.h>
#include <windhawk_utils.h>
#include <winnt.h>
// https://www.codeproject.com/articles/13330/using-dialog-templates-to-create-an-inputbox-in-c
static unsigned char TEMPLATE_LAYOUT_2K[] = {
0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0xc8,0x80,0x0c,
0x00,0x14,0x00,0x14,0x00,0x13,0x01,0x8c,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x62,
0x00,0x6f,0x00,0x75,0x00,0x74,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x4d,0x00,0x53,0x00,0x20,0x00,0x53,0x00,0x68,0x00,0x65,
0x00,0x6c,0x00,0x6c,0x00,0x20,0x00,0x44,0x00,0x6c,0x00,0x67,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x50,0x15,0x00,0x07,0x00,0x12,
0x00,0x14,0x00,0x09,0x30,0x00,0x00,0xff,0xff,0x82,0x00,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x46,
0x00,0x07,0x00,0xa5,0x00,0x0a,0x00,0x00,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x46,
0x00,0x11,0x00,0x96,0x00,0x0a,0x00,0x0b,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,
0x00,0x1c,0x00,0xcd,0x00,0x0a,0x00,0x0a,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,
0x00,0x26,0x00,0x91,0x00,0x14,0x00,0x0d,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,
0x00,0x39,0x00,0x91,0x00,0x0a,0x00,0x12,0x35,0x00,0x00,0x53,0x00,0x79,0x00,0x73,
0x00,0x4c,0x00,0x69,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,0x54,0x00,0x68,0x00,0x69,
0x00,0x73,0x00,0x20,0x00,0x70,0x00,0x72,0x00,0x6f,0x00,0x64,0x00,0x75,0x00,0x63,
0x00,0x74,0x00,0x20,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x6c,0x00,0x69,0x00,0x63,
0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,0x00,0x64,0x00,0x20,0x00,0x74,0x00,0x6f,
0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x50,0x46,0x00,0x44,0x00,0x91,0x00,0x0a,0x00,0x07,0x35,0x00,0x00,0xff,
0xff,0x82,0x00,0x75,0x00,0x73,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x6e,0x00,0x61,
0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,0x00,0x4e,0x00,0x91,0x00,0x0a,0x00,0x08,
0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x6f,0x00,0x72,0x00,0x67,0x00,0x20,0x00,0x6e,
0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x00,0x00,0x50,0x46,0x00,0x5a,0x00,0xc6,0x00,0x01,0x00,0x27,
0x33,0x00,0x00,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,0x00,0x5f,0x00,0xe6,0x00,0x0a,0x00,0x02,
0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x50,0x00,0x68,0x00,0x79,0x00,0x73,0x00,0x69,
0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x20,0x00,0x6d,0x00,0x65,0x00,0x6d,0x00,0x6f,
0x00,0x72,0x00,0x79,0x00,0x20,0x00,0x61,0x00,0x76,0x00,0x61,0x00,0x69,0x00,0x6c,
0x00,0x61,0x00,0x62,0x00,0x6c,0x00,0x65,0x00,0x20,0x00,0x74,0x00,0x6f,0x00,0x20,
0x00,0x57,0x00,0x69,0x00,0x6e,0x00,0x64,0x00,0x6f,0x00,0x77,0x00,0x73,0x00,0x3a,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x50,0xca,0x00,0x5f,0x00,0x35,0x00,0x0a,0x00,0x03,0x35,0x00,0x00,0xff,
0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x01,0x50,0xdc,0x00,0x79,0x00,0x32,0x00,0x0e,0x00,0x01,0x00,0x00,0x00,0xff,
0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00,0x00,0x00,0x00
};
static unsigned char TEMPLATE_LAYOUT_XPSP1[] = {
0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0xc8,0x80,0x0c,
0x00,0x14,0x00,0x14,0x00,0x13,0x01,0x96,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x62,
0x00,0x6f,0x00,0x75,0x00,0x74,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x4d,0x00,0x53,0x00,0x20,0x00,0x53,0x00,0x68,0x00,0x65,
0x00,0x6c,0x00,0x6c,0x00,0x20,0x00,0x44,0x00,0x6c,0x00,0x67,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x50,0x15,0x00,0x07,0x00,0x15,
0x00,0x14,0x00,0x09,0x30,0x00,0x00,0xff,0xff,0x82,0x00,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x46,
0x00,0x07,0x00,0xa5,0x00,0x0a,0x00,0x00,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x4d,
0x00,0x69,0x00,0x63,0x00,0x72,0x00,0x6f,0x00,0x73,0x00,0x6f,0x00,0x66,0x00,0x74,
0x00,0x20,0x00,0xae,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x46,0x00,0x12,0x00,0xc8,
0x00,0x0a,0x00,0x0b,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,0x00,0x1c,0x00,0xaf,
0x00,0x0a,0x00,0x0a,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x43,0x00,0x6f,0x00,0x70,
0x00,0x79,0x00,0x72,0x00,0x69,0x00,0x67,0x00,0x68,0x00,0x74,0x00,0x20,0x00,0xa9,
0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x20,0x00,0x4d,0x00,0x69,0x00,0x63,0x00,0x72,
0x00,0x6f,0x00,0x73,0x00,0x6f,0x00,0x66,0x00,0x74,0x00,0x20,0x00,0x43,0x00,0x6f,
0x00,0x72,0x00,0x70,0x00,0x6f,0x00,0x72,0x00,0x61,0x00,0x74,0x00,0x69,0x00,0x6f,
0x00,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x50,0x46,0x00,0x26,0x00,0x91,0x00,0x14,0x00,0x0d,0x35,0x00,0x00,0xff,
0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x50,0x46,0x00,0x3a,0x00,0x91,0x00,0x14,0x00,0x12,0x35,0x00,0x00,0x53,
0x00,0x79,0x00,0x73,0x00,0x4c,0x00,0x69,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,0x54,
0x00,0x68,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x70,0x00,0x72,0x00,0x6f,0x00,0x64,
0x00,0x75,0x00,0x63,0x00,0x74,0x00,0x20,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x6c,
0x00,0x69,0x00,0x63,0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,0x00,0x64,0x00,0x20,
0x00,0x75,0x00,0x6e,0x00,0x64,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x74,0x00,0x68,
0x00,0x65,0x00,0x20,0x00,0x74,0x00,0x65,0x00,0x72,0x00,0x6d,0x00,0x73,0x00,0x20,
0x00,0x6f,0x00,0x66,0x00,0x20,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x20,0x00,0x3c,
0x00,0x41,0x00,0x3e,0x00,0x45,0x00,0x6e,0x00,0x64,0x00,0x2d,0x00,0x55,0x00,0x73,
0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x4c,0x00,0x69,0x00,0x63,0x00,0x65,0x00,0x6e,
0x00,0x73,0x00,0x65,0x00,0x20,0x00,0x41,0x00,0x67,0x00,0x72,0x00,0x65,0x00,0x65,
0x00,0x6d,0x00,0x65,0x00,0x6e,0x00,0x74,0x00,0x3c,0x00,0x2f,0x00,0x41,0x00,0x3e,
0x00,0x20,0x00,0x74,0x00,0x6f,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x50,0x00,0x4e,0x00,0x91,
0x00,0x0a,0x00,0x07,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x75,0x00,0x73,0x00,0x65,
0x00,0x72,0x00,0x20,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x50,
0x00,0x57,0x00,0x91,0x00,0x0a,0x00,0x08,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x6f,
0x00,0x72,0x00,0x67,0x00,0x20,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x50,0x46,
0x00,0x64,0x00,0xc7,0x00,0x01,0x00,0x27,0x33,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x46,
0x00,0x69,0x00,0x82,0x00,0x0a,0x00,0x02,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x50,
0x00,0x68,0x00,0x79,0x00,0x73,0x00,0x69,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x20,
0x00,0x6d,0x00,0x65,0x00,0x6d,0x00,0x6f,0x00,0x72,0x00,0x79,0x00,0x20,0x00,0x61,
0x00,0x76,0x00,0x61,0x00,0x69,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x6c,0x00,0x65,
0x00,0x20,0x00,0x74,0x00,0x6f,0x00,0x20,0x00,0x57,0x00,0x69,0x00,0x6e,0x00,0x64,
0x00,0x6f,0x00,0x77,0x00,0x73,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0xca,0x00,0x69,0x00,0x35,
0x00,0x0a,0x00,0x03,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x50,0xdc,0x00,0x82,0x00,0x32,
0x00,0x0e,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00,
0x00,0x00,0x00
};
static unsigned char TEMPLATE_LAYOUT_XPSP2[] = {
0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0xc8,0x80,0x0c,
0x00,0x14,0x00,0x14,0x00,0x13,0x01,0x97,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x62,
0x00,0x6f,0x00,0x75,0x00,0x74,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x4d,0x00,0x53,0x00,0x20,0x00,0x53,0x00,0x68,0x00,0x65,
0x00,0x6c,0x00,0x6c,0x00,0x20,0x00,0x44,0x00,0x6c,0x00,0x67,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x50,0x07,0x00,0x07,0x00,0x15,
0x00,0x14,0x00,0x09,0x30,0x00,0x00,0xff,0xff,0x82,0x00,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x23,
0x00,0x07,0x00,0xc8,0x00,0x0a,0x00,0x00,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x24,
0x00,0x12,0x00,0xeb,0x00,0x0a,0x00,0x0b,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,
0x00,0x1c,0x00,0xd2,0x00,0x0a,0x00,0x0a,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,
0x00,0x26,0x00,0xb4,0x00,0x14,0x00,0x0d,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x23,
0x00,0x3a,0x00,0xb4,0x00,0x14,0x00,0x12,0x35,0x00,0x00,0x53,0x00,0x79,0x00,0x73,
0x00,0x4c,0x00,0x69,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,0x54,0x00,0x68,0x00,0x69,
0x00,0x73,0x00,0x20,0x00,0x70,0x00,0x72,0x00,0x6f,0x00,0x64,0x00,0x75,0x00,0x63,
0x00,0x74,0x00,0x20,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x6c,0x00,0x69,0x00,0x63,
0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,0x00,0x64,0x00,0x20,0x00,0x75,0x00,0x6e,
0x00,0x64,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x20,
0x00,0x74,0x00,0x65,0x00,0x72,0x00,0x6d,0x00,0x73,0x00,0x20,0x00,0x6f,0x00,0x66,
0x00,0x20,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x20,0x00,0x3c,0x00,0x41,0x00,0x3e,
0x00,0x45,0x00,0x6e,0x00,0x64,0x00,0x2d,0x00,0x55,0x00,0x73,0x00,0x65,0x00,0x72,
0x00,0x20,0x00,0x4c,0x00,0x69,0x00,0x63,0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,
0x00,0x20,0x00,0x41,0x00,0x67,0x00,0x72,0x00,0x65,0x00,0x65,0x00,0x6d,0x00,0x65,
0x00,0x6e,0x00,0x74,0x00,0x3c,0x00,0x2f,0x00,0x41,0x00,0x3e,0x00,0x20,0x00,0x74,
0x00,0x6f,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x2d,0x00,0x4e,0x00,0xb4,0x00,0x0a,0x00,0x07,
0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x75,0x00,0x73,0x00,0x65,0x00,0x72,0x00,0x20,
0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x2d,0x00,0x57,0x00,0xb4,
0x00,0x0a,0x00,0x08,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x6f,0x00,0x72,0x00,0x67,
0x00,0x20,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x50,0x23,0x00,0x64,0x00,0xea,
0x00,0x01,0x00,0x27,0x33,0x00,0x00,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,0x00,0x69,0x00,0x82,
0x00,0x0a,0x00,0x02,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x50,0x00,0x68,0x00,0x79,
0x00,0x73,0x00,0x69,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x20,0x00,0x6d,0x00,0x65,
0x00,0x6d,0x00,0x6f,0x00,0x72,0x00,0x79,0x00,0x20,0x00,0x61,0x00,0x76,0x00,0x61,
0x00,0x69,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x6c,0x00,0x65,0x00,0x20,0x00,0x74,
0x00,0x6f,0x00,0x20,0x00,0x57,0x00,0x69,0x00,0x6e,0x00,0x64,0x00,0x6f,0x00,0x77,
0x00,0x73,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x00,0x00,0x50,0xa7,0x00,0x69,0x00,0x58,0x00,0x0a,0x00,0x03,
0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x01,0x50,0xdc,0x00,0x82,0x00,0x32,0x00,0x0e,0x00,0x01,
0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00,0x00,0x00,0x00
};
static unsigned char TEMPLATE_LAYOUT_VISTA[] = {
0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0xc8,0x80,0x0c,
0x00,0x14,0x00,0x14,0x00,0x13,0x01,0xbf,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x62,
0x00,0x6f,0x00,0x75,0x00,0x74,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,0x00,0x4d,0x00,0x53,0x00,0x20,0x00,0x53,0x00,0x68,0x00,0x65,
0x00,0x6c,0x00,0x6c,0x00,0x20,0x00,0x44,0x00,0x6c,0x00,0x67,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x50,0x07,0x00,0x07,0x00,0x15,
0x00,0x14,0x00,0x09,0x30,0x00,0x00,0xff,0xff,0x82,0x00,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x23,
0x00,0x07,0x00,0xc8,0x00,0x0a,0x00,0x00,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0x00,0x50,0x23,
0x00,0x12,0x00,0xeb,0x00,0x0a,0x00,0x0b,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,
0x00,0x1c,0x00,0xd2,0x00,0x0a,0x00,0x0a,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,
0x00,0x26,0x00,0xd2,0x00,0x28,0x00,0x13,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x54,
0x00,0x68,0x00,0x65,0x00,0x20,0x00,0x25,0x00,0x57,0x00,0x49,0x00,0x4e,0x00,0x44,
0x00,0x4f,0x00,0x57,0x00,0x53,0x00,0x5f,0x00,0x4c,0x00,0x4f,0x00,0x4e,0x00,0x47,
0x00,0x25,0x00,0x20,0x00,0x6f,0x00,0x70,0x00,0x65,0x00,0x72,0x00,0x61,0x00,0x74,
0x00,0x69,0x00,0x6e,0x00,0x67,0x00,0x20,0x00,0x73,0x00,0x79,0x00,0x73,0x00,0x74,
0x00,0x65,0x00,0x6d,0x00,0x20,0x00,0x61,0x00,0x6e,0x00,0x64,0x00,0x20,0x00,0x69,
0x00,0x74,0x00,0x73,0x00,0x20,0x00,0x75,0x00,0x73,0x00,0x65,0x00,0x72,0x00,0x20,
0x00,0x69,0x00,0x6e,0x00,0x74,0x00,0x65,0x00,0x72,0x00,0x66,0x00,0x61,0x00,0x63,
0x00,0x65,0x00,0x20,0x00,0x61,0x00,0x72,0x00,0x65,0x00,0x20,0x00,0x70,0x00,0x72,
0x00,0x6f,0x00,0x74,0x00,0x65,0x00,0x63,0x00,0x74,0x00,0x65,0x00,0x64,0x00,0x20,
0x00,0x62,0x00,0x79,0x00,0x20,0x00,0x74,0x00,0x72,0x00,0x61,0x00,0x64,0x00,0x65,
0x00,0x6d,0x00,0x61,0x00,0x72,0x00,0x6b,0x00,0x20,0x00,0x61,0x00,0x6e,0x00,0x64,
0x00,0x20,0x00,0x6f,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x70,
0x00,0x65,0x00,0x6e,0x00,0x64,0x00,0x69,0x00,0x6e,0x00,0x67,0x00,0x20,0x00,0x6f,
0x00,0x72,0x00,0x20,0x00,0x65,0x00,0x78,0x00,0x69,0x00,0x73,0x00,0x74,0x00,0x69,
0x00,0x6e,0x00,0x67,0x00,0x20,0x00,0x69,0x00,0x6e,0x00,0x74,0x00,0x65,0x00,0x6c,
0x00,0x6c,0x00,0x65,0x00,0x63,0x00,0x74,0x00,0x75,0x00,0x61,0x00,0x6c,0x00,0x20,
0x00,0x70,0x00,0x72,0x00,0x6f,0x00,0x70,0x00,0x65,0x00,0x72,0x00,0x74,0x00,0x79,
0x00,0x20,0x00,0x72,0x00,0x69,0x00,0x67,0x00,0x68,0x00,0x74,0x00,0x73,0x00,0x20,
0x00,0x69,0x00,0x6e,0x00,0x20,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x20,0x00,0x55,
0x00,0x6e,0x00,0x69,0x00,0x74,0x00,0x65,0x00,0x64,0x00,0x20,0x00,0x53,0x00,0x74,
0x00,0x61,0x00,0x74,0x00,0x65,0x00,0x73,0x00,0x20,0x00,0x61,0x00,0x6e,0x00,0x64,
0x00,0x20,0x00,0x6f,0x00,0x74,0x00,0x68,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x63,
0x00,0x6f,0x00,0x75,0x00,0x6e,0x00,0x74,0x00,0x72,0x00,0x69,0x00,0x65,0x00,0x73,
0x00,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x00,0x00,0x50,0x23,0x00,0x4e,0x00,0xb4,0x00,0x14,0x00,0x0d,0x35,0x00,0x00,0xff,
0xff,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x50,0x23,0x00,0x62,0x00,0xb4,0x00,0x14,0x00,0x12,0x35,0x00,0x00,0x53,
0x00,0x79,0x00,0x73,0x00,0x4c,0x00,0x69,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,0x54,
0x00,0x68,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x70,0x00,0x72,0x00,0x6f,0x00,0x64,
0x00,0x75,0x00,0x63,0x00,0x74,0x00,0x20,0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x6c,
0x00,0x69,0x00,0x63,0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,0x00,0x64,0x00,0x20,
0x00,0x75,0x00,0x6e,0x00,0x64,0x00,0x65,0x00,0x72,0x00,0x20,0x00,0x74,0x00,0x68,
0x00,0x65,0x00,0x20,0x00,0x3c,0x00,0x41,0x00,0x3e,0x00,0x4d,0x00,0x69,0x00,0x63,
0x00,0x72,0x00,0x6f,0x00,0x73,0x00,0x6f,0x00,0x66,0x00,0x74,0x00,0x20,0x00,0x53,
0x00,0x6f,0x00,0x66,0x00,0x74,0x00,0x77,0x00,0x61,0x00,0x72,0x00,0x65,0x00,0x20,
0x00,0x4c,0x00,0x69,0x00,0x63,0x00,0x65,0x00,0x6e,0x00,0x73,0x00,0x65,0x00,0x20,
0x00,0x54,0x00,0x65,0x00,0x72,0x00,0x6d,0x00,0x73,0x00,0x3c,0x00,0x2f,0x00,0x41,
0x00,0x3e,0x00,0x20,0x00,0x74,0x00,0x6f,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x2d,0x00,0x76,0x00,0xb4,
0x00,0x0a,0x00,0x07,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x75,0x00,0x73,0x00,0x65,
0x00,0x72,0x00,0x20,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x2d,
0x00,0x7f,0x00,0xb4,0x00,0x0a,0x00,0x08,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x6f,
0x00,0x72,0x00,0x67,0x00,0x20,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x50,0x23,
0x00,0x8c,0x00,0xea,0x00,0x01,0x00,0x27,0x33,0x00,0x00,0xff,0xff,0x82,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x50,0x23,
0x00,0x91,0x00,0xe6,0x00,0x0a,0x00,0x03,0x35,0x00,0x00,0xff,0xff,0x82,0x00,0x50,
0x00,0x68,0x00,0x79,0x00,0x73,0x00,0x69,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x20,
0x00,0x6d,0x00,0x65,0x00,0x6d,0x00,0x6f,0x00,0x72,0x00,0x79,0x00,0x20,0x00,0x61,
0x00,0x76,0x00,0x61,0x00,0x69,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x6c,0x00,0x65,
0x00,0x20,0x00,0x74,0x00,0x6f,0x00,0x20,0x00,0x25,0x00,0x73,0x00,0x3a,0x00,0x20,
0x00,0x25,0x00,0x73,0x00,0x20,0x00,0x4b,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x50,0xdc,0x00,0xaa,0x00,0x32,
0x00,0x0e,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00,
0x00,0x00,0x00
};
typedef enum _LAYOUTTYPE
{
LAYOUT_DEFAULT = 0,
LAYOUT_2K,
LAYOUT_XPSP1,
LAYOUT_XPSP2,
LAYOUT_VISTA,
} LAYOUTTYPE;
struct {
wchar_t *banner;
LAYOUTTYPE layout;
} settings;
typedef HANDLE (CALLBACK *BrandingLoadImage_t)(wchar_t* a1, WORD* a2, UINT a3, int a4, int a5, UINT a6);
BrandingLoadImage_t BrandingLoadImage_orig;
HANDLE CALLBACK BrandingLoadImage_hook(wchar_t* a1, WORD* a2, UINT a3, int a4, int a5, UINT a6) {
if (wcscmp(a1, L"Basebrd") == 0 && a2 == (WORD*)121) {
if (wcscmp(settings.banner, L"") != 0) {
HBITMAP hBanner = (HBITMAP)LoadImage(NULL, settings.banner, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (hBanner) {
return hBanner;
} else {
return BrandingLoadImage_orig(a1, a2, a3, a4, a5, a6);
}
} else {
return BrandingLoadImage_orig(a1, a2, a3, a4, a5, a6);
}
}
return BrandingLoadImage_orig(a1, a2, a3, a4, a5, a6);
}
typedef INT_PTR (CALLBACK *SHFusionDialogBoxParam_t)(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
SHFusionDialogBoxParam_t SHFusionDialogBoxParam_orig;
INT_PTR CALLBACK SHFusionDialogBoxParam_hook(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
if (lpTemplateName == (LPCWSTR)0x3810) {
switch (settings.layout) {
case LAYOUT_2K:
return DialogBoxIndirectParamW(hInstance, (LPCDLGTEMPLATEW) TEMPLATE_LAYOUT_2K, hWndParent, lpDialogFunc, dwInitParam);
case LAYOUT_XPSP1:
return DialogBoxIndirectParamW(hInstance, (LPCDLGTEMPLATEW) TEMPLATE_LAYOUT_XPSP1, hWndParent, lpDialogFunc, dwInitParam);
case LAYOUT_XPSP2:
return DialogBoxIndirectParamW(hInstance, (LPCDLGTEMPLATEW) TEMPLATE_LAYOUT_XPSP2, hWndParent, lpDialogFunc, dwInitParam);
case LAYOUT_VISTA:
return DialogBoxIndirectParamW(hInstance, (LPCDLGTEMPLATEW) TEMPLATE_LAYOUT_VISTA, hWndParent, lpDialogFunc, dwInitParam);
default:
return SHFusionDialogBoxParam_orig(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
}
} else {
return SHFusionDialogBoxParam_orig(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
}
return SHFusionDialogBoxParam_orig(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
}
void LoadSettings(void)
{
settings.banner = (wchar_t *)Wh_GetStringSetting(L"banner");
LPCWSTR szLayout = Wh_GetStringSetting(L"layout");
if (wcscmp(szLayout, L"2k") == 0) {
settings.layout = LAYOUT_2K;
} else if (wcscmp(szLayout, L"xpsp1") == 0) {
settings.layout = LAYOUT_XPSP1;
} else if (wcscmp(szLayout, L"xpsp2") == 0) {
settings.layout = LAYOUT_XPSP2;
} else if (wcscmp(szLayout, L"vista") == 0) {
settings.layout = LAYOUT_VISTA;
} else {
settings.layout = LAYOUT_DEFAULT;
}
Wh_FreeStringSetting(szLayout);
}
BOOL Wh_ModInit(void)
{
LoadSettings();
HMODULE hWinbrand = LoadLibraryW(L"winbrand.dll");
if (!hWinbrand) {
Wh_Log(L"Failed to load winbrand.dll");
return FALSE;
}
WindhawkUtils::SYMBOL_HOOK bannerHook = {
{L"BrandingLoadImage"},
(void **)&BrandingLoadImage_orig,
(void *)BrandingLoadImage_hook,
false
};
if (!WindhawkUtils::HookSymbols(hWinbrand, &bannerHook, 1)) {
Wh_Log(L"Failed to hook BrandingLoadImage");
return FALSE;
}
HMODULE hShell32 = LoadLibraryW(L"shell32.dll");
if (!hShell32) {
Wh_Log(L"Failed to load shell32.dll");
return FALSE;
}
WindhawkUtils::SYMBOL_HOOK layoutHook = {
{L"SHFusionDialogBoxParam"},
(void **)&SHFusionDialogBoxParam_orig,
(void *)SHFusionDialogBoxParam_hook,
false
};
if (!WindhawkUtils::HookSymbols(hShell32, &layoutHook, 1)) {
Wh_Log(L"Failed to hook SHFusionDialogBoxParam");
return FALSE;
}
return TRUE;
}
void Wh_ModSettingsChanged(void)
{
LoadSettings();
}