Skip to content

Commit

Permalink
Create legacy-alt-tab.wh.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Anixx authored Aug 10, 2024
1 parent fdcbbba commit 6120b0f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions mods/legacy-alt-tab.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// ==WindhawkMod==
// @id legacy-alt-tab
// @name Legacy Alt+Tab dialog
// @description Enables legacy Alt+Tab dialog from Windows XP and Windows 2000
// @version 1.0
// @author Anixx
// @github https://github.com/Anixx
// @include explorer.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
Enables legacy Alt+Tab dialog from Windows XP and Windows 2000
*/
// ==/WindhawkModReadme==

#include <windows.h>

typedef LONG (WINAPI *REGQUERYVALUEEXW)(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);

REGQUERYVALUEEXW pOriginalRegQueryValueExW;

LONG WINAPI RegQueryValueExWHook(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{

if (lstrcmpiW(lpValueName, L"AltTabSettings") == 0)

{
if (lpType)
*lpType = REG_DWORD;
if (lpData && lpcbData && *lpcbData >= sizeof(DWORD))
{
*(DWORD*)lpData = 1;
*lpcbData = sizeof(DWORD);
}
return ERROR_SUCCESS;
}

return pOriginalRegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}

BOOL Wh_ModInit(void)
{
Wh_Log(L"Init");

Wh_SetFunctionHook((void*)GetProcAddress(LoadLibrary(L"kernelbase.dll"), "RegQueryValueExW"), (void*)RegQueryValueExWHook, (void**)&pOriginalRegQueryValueExW);

return TRUE;
}

0 comments on commit 6120b0f

Please sign in to comment.