Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Run Icon 1.0.0 #361

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions mods/no-run-icon.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ==WindhawkMod==
// @id no-run-icon
// @name No Run Icon
// @description Removes the window icon from the Run dialog, like Windows XP and before.
// @version 1.0.0
// @author aubymori
// @github https://github.com/aubymori
// @include *
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
# No Run Icon
Removes the window icon from the Run dialog, like Windows XP and before.

**Before**:

![Before](https://raw.githubusercontent.com/aubymori/images/main/no-run-icon-before.png)

**After**:

![After](https://raw.githubusercontent.com/aubymori/images/main/no-run-icon-after.png)
*/
// ==/WindhawkModReadme==

#include <windhawk_utils.h>

DLGPROC RunDlgProc_orig;
INT_PTR CALLBACK RunDlgProc_hook(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
if (uMsg == WM_INITDIALOG)
{
RunDlgProc_orig(hWnd, uMsg, wParam, lParam);
SendMessageW(hWnd, WM_SETICON, 0, NULL);
return 0;
}
return RunDlgProc_orig(hWnd, uMsg, wParam, lParam);
}

BOOL Wh_ModInit(void)
{
HMODULE hShell32 = LoadLibraryW(L"shell32.dll");
if (!hShell32)
{
Wh_Log(L"Failed to load shell32.dll");
return FALSE;
}

WindhawkUtils::SYMBOL_HOOK hook = {
{
#ifdef _WIN64
L"__int64 __cdecl RunDlgProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)"
#else
L"int __stdcall RunDlgProc(struct HWND__ *,unsigned int,unsigned int,long)"
#endif
},
&RunDlgProc_orig,
RunDlgProc_hook,
false
};

if (!WindhawkUtils::HookSymbols(hShell32, &hook, 1))
{
Wh_Log(L"Failed to hook RunDlgProc");
return FALSE;
}

return TRUE;
}
Loading