Skip to content

Conversation

@halfofknowledge-cpu
Copy link

No description provided.

@halfofknowledge-cpu
Copy link
Author

First contribution ;P
Waiting for a review, TY

@Anixx
Copy link
Contributor

Anixx commented Jan 6, 2026

Windhawk mods shold not make permanent changes to the registry settings. Your mod changes a registry value.

@Anixx
Copy link
Contributor

Anixx commented Jan 6, 2026

You can take this mod as an example of how to hook registry query for such mods:
https://windhawk.net/mods/legacy-alt-tab

Changing the key name from AltTabSettings to ShowSecondsInSystemClock has the reqired effect:

// ==WindhawkMod==
// @id           seconds-in-clock
// @name         Show seconds in clock on Win10 taskbar
// @description  Show seconds in clock on Win10 taskbar
// @version      1.0.0
// @include      explorer.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*...*/
// ==/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"ShowSecondsInSystemClock") == 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;
}

@halfofknowledge-cpu
Copy link
Author

I don't understand anixx

@Anixx
Copy link
Contributor

Anixx commented Jan 6, 2026

Your mod makes changes to the registry. Windhawk mods should not do so.

@halfofknowledge-cpu
Copy link
Author

So what do I do

@Anixx
Copy link
Contributor

Anixx commented Jan 7, 2026

Above is the link to the mod that you can use for your mod. You only change AltTabSettings to ShowSecondsInSystemClock and it adds seconds to system clock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants