-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathfix-multicolumn-menus-theme-background-infinite-expansion.wh.cpp
More file actions
72 lines (61 loc) · 2.24 KB
/
fix-multicolumn-menus-theme-background-infinite-expansion.wh.cpp
File metadata and controls
72 lines (61 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// ==WindhawkMod==
// @id fix-multicolumn-menus-theme-background-infinite-expansion
// @name Fix Multicolumn Shell Menus Infinite Expansion with Theme Background Margins
// @version 1.0
// @author Isabella Lulamoon (kawapure)
// @github https://github.com/kawapure
// @twitter https://twitter.com/kawaipure
// @homepage https://kawapure.github.io/
// @include explorer.exe
// @compilerOptions -lcomdlg32
// @license MIT
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# Fix Multicolumn Shell Menus Infinite Expansion with Theme Background Margins
As the title suggests, this mod fixes shell menus expanding infinitely when the theme background has margins
and the menu is multicolumn. This is a bug that was introduced sometime after such themes would not be used
in Windows anymore (my guesses without doing any research are either Windows Vista or Windows 10 version 1703).
This mod is useful for the start menu in ExplorerEx with the Luna theme.
*/
// ==/WindhawkModReadme==
#include <windhawk_utils.h>
void (__cdecl *CMenuToolbarBase__GetSize)(void *pThis, SIZE *pSize) = nullptr;
void (__cdecl *CMenuSFToolbar__GetSize_orig)(void *pThis, SIZE *pSize) = nullptr;
void __cdecl CMenuSFToolbar__GetSize_hook(void *pThis, SIZE *pSize)
{
CMenuToolbarBase__GetSize(pThis, pSize);
}
// shell32.dll
WindhawkUtils::SYMBOL_HOOK c_rghookShell32[] = {
{
{
L"public: virtual void __cdecl CMenuSFToolbar::GetSize(struct tagSIZE *)",
},
&CMenuSFToolbar__GetSize_orig,
CMenuSFToolbar__GetSize_hook,
},
{
{
L"public: virtual void __cdecl CMenuToolbarBase::GetSize(struct tagSIZE *)",
},
&CMenuToolbarBase__GetSize,
},
};
// The mod is being initialized, load settings, hook functions, and do other
// initialization stuff if required.
BOOL Wh_ModInit()
{
Wh_Log(L"Init");
HMODULE hmShell32 = LoadLibraryW(L"shell32");
if (!WindhawkUtils::HookSymbols(hmShell32, c_rghookShell32, ARRAYSIZE(c_rghookShell32)))
{
Wh_Log(L"Failed to hook symbols in shell32.");
}
return TRUE;
}
// The mod is being unloaded, free all allocated resources.
void Wh_ModUninit()
{
Wh_Log(L"Uninit");
}