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

Create win10-taskbar-on-win11.wh.cpp #847

Merged
merged 1 commit into from
Aug 10, 2024
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
57 changes: 57 additions & 0 deletions mods/win10-taskbar-on-win11.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ==WindhawkMod==
// @id win10-taskbar-on-win11
// @name Windows 10 taskbar on Windows 11
// @description Enables Windows 10 taskbar on Windows 11 versions 21H2 to 23H2 via registry
// @version 1.0
// @author Anixx
// @github https://github.com/Anixx
// @include explorer.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
This mod enables Windows 10 taskbar on Windows 11 versions 21H2 to 23H2 via registry method, without
using Explorer Patcher.

It may be useful also on later versions of Windows with Explorer.exe downgraded to previous versions
and/or manipulated Windows features using vivetool utility.

If you want to get rid of the cogwheel icon in the tray area, use the mod "Hide Action Center icon".
You can restore the clock and set up the tray icons using legacy tray setup dialog,
which you can start with command `shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}`
*/
// ==/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"UndockingDisabled") == 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;
}