// ==WindhawkMod==
// @id classic-explorer-toolbars-fork
// name Classic Explorer Toolbars - Fork // @description Restyles Explorer toolbars to fit in with classic theme
// @version 0.1
// @author Cynosphere
// @include explorer.exe
// @compileroptions -lcomdlg32
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# Classic Explorer Toolbars
*/
// ==/WindhawkModReadme==
#include <windhawk_utils.h>
#include <windows.h> // Include this header for Sleep function
#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) {
LONG style = GetWindowLongPtrW(barHwnd, GWL_STYLE);
style |= RBS_BANDBORDERS;
style |= WS_BORDER;
SetWindowLongPtrW(barHwnd, GWL_STYLE, style);
}
return ret;
}
BOOL Wh_ModInit() {
// Introduce a delay of 10 seconds
Sleep(100); // Sleep for 10 seconds (10000 milliseconds)
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;
}