-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathexplorerex-dll-loader.wh.cpp
More file actions
91 lines (78 loc) · 2.15 KB
/
explorerex-dll-loader.wh.cpp
File metadata and controls
91 lines (78 loc) · 2.15 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// ==WindhawkMod==
// @id explorerex-dll-loader
// @name ExplorerEx DLL Loader
// @description Loads the DLL build of ExplorerEx
// @version 1.0.0
// @author aubymori
// @github https://github.com/aubymori
// @include explorer.exe
// @architecture x86-64
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
# ExplorerEx DLL Loader
This mod allows you to use the DLL build of ExplorerEx, which allows you to use
UWP/Immersive apps.
# IMPORTANT: READ!
Windhawk needs to hook into `winlogon.exe` to successfully capture Explorer starting. Please
navigate to Windhawk's Settings, Advanced settings, More advanced settings, and make sure that
`winlogon.exe` is in the Process inclusion list.
*/
// ==/WindhawkModReadme==
// ==WindhawkModSettings==
/*
- path: "ExplorerEx.dll"
$name: DLL path
$description: Path to the ExplorerEx DLL.
- console: true
$name: Enable console
*/
// ==/WindhawkModSettings==
#include <windhawk_utils.h>
void *CreateDesktopAndTray_orig = nullptr;
void Wh_ModSettingsChanged(void)
{
if (Wh_GetIntSetting(L"console"))
AllocConsole();
else
FreeConsole();
}
BOOL Wh_ModInit(void)
{
Wh_Log(L"init");
Wh_ModSettingsChanged();
WindhawkUtils::StringSetting path = WindhawkUtils::StringSetting::make(L"path");
HMODULE hEpTaskbar = LoadLibraryW(path.get());
if (!hEpTaskbar)
{
Wh_Log(L"Failed to load ExplorerEx DLL");
return FALSE;
}
void *CreateDesktopAndTray = (void *)GetProcAddress(hEpTaskbar, "CreateDesktopAndTray");
if (!CreateDesktopAndTray)
{
Wh_Log(L"Failed to load CreateDesktopAndTray from ExplorerEx DLL");
return FALSE;
}
const WindhawkUtils::SYMBOL_HOOK hook = {
{
L"void * __cdecl CreateDesktopAndTray(void)"
},
&CreateDesktopAndTray_orig,
CreateDesktopAndTray,
false
};
if (!WindhawkUtils::HookSymbols(
GetModuleHandleW(NULL),
&hook, 1
))
{
Wh_Log(L"Failed to hook CreateDesktopAndTray in explorer.exe");
return FALSE;
}
return TRUE;
}
void Wh_ModUninit(void)
{
FreeConsole();
}