From 0e446407ccb4725b2eb9061b584e45e304a281ad Mon Sep 17 00:00:00 2001 From: aubrey <44238627+aubymori@users.noreply.github.com> Date: Sun, 10 Nov 2024 12:47:08 -0600 Subject: [PATCH] Custom Shutdown Dialog 1.1.1 (#1231) - Remove unnecessary symbol hook, `LogoffWindowsDialog` is exported by ordinal --- mods/custom-shutdown-dialog.wh.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/mods/custom-shutdown-dialog.wh.cpp b/mods/custom-shutdown-dialog.wh.cpp index 44f354e4a..e5a07c3a6 100644 --- a/mods/custom-shutdown-dialog.wh.cpp +++ b/mods/custom-shutdown-dialog.wh.cpp @@ -2,7 +2,7 @@ // @id custom-shutdown-dialog // @name Custom Shutdown Dialog // @description Override the classic shutdown dialog in Explorer with your own -// @version 1.1.0 +// @version 1.1.1 // @author aubymori // @github https://github.com/aubymori // @include explorer.exe @@ -84,17 +84,6 @@ WindhawkUtils::SYMBOL_HOOK shutdownuxDllHooks[] = { _ShutdownDialogEx_hook, false } -};\ - -WindhawkUtils::SYMBOL_HOOK shell32DllHooks[] = { - { - { - L"LogoffWindowsDialog" - }, - &LogoffWindowsDialog_orig, - LogoffWindowsDialog_hook, - false - } }; void LoadSettings(void) @@ -133,10 +122,17 @@ BOOL Wh_ModInit(void) return FALSE; } - if (!WindhawkUtils::HookSymbols( - hShell32, - shell32DllHooks, - ARRAYSIZE(shell32DllHooks) + FARPROC LogoffWindowsDialog = GetProcAddress(hShell32, (LPCSTR)54); + if (!LogoffWindowsDialog) + { + Wh_Log(L"Failed to get address of LogoffWindowsDialog"); + return FALSE; + } + + if (!Wh_SetFunctionHook( + (void *)LogoffWindowsDialog, + (void *)LogoffWindowsDialog_hook, + (void **)&LogoffWindowsDialog_orig )) { Wh_Log(L"Failed to hook LogoffWindowsDialog");