From 2557948179d807373705407eca291591041e0b1b Mon Sep 17 00:00:00 2001 From: Thamatip Chitpong Date: Wed, 4 Dec 2024 01:00:28 +0700 Subject: [PATCH] [WINLOGON] Implement startup sound support (HACK) CORE-13951 --- base/system/winlogon/sas.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/base/system/winlogon/sas.c b/base/system/winlogon/sas.c index f00bbf50b18..8b169f73df6 100644 --- a/base/system/winlogon/sas.c +++ b/base/system/winlogon/sas.c @@ -285,6 +285,22 @@ PlaySoundRoutine( return Ret; } +static +BOOL +IsFirstLogon(VOID) +{ + /* FIXME: All of this is a HACK, designed specifically for PlayLogonSoundThread. + * Don't call IsFirstLogon multiple times inside the same function. And please + * note that this function is not thread-safe. */ + static BOOL bFirstLogon = TRUE; + if (bFirstLogon) + { + bFirstLogon = FALSE; + return TRUE; + } + return FALSE; +} + DWORD WINAPI PlayLogonSoundThread( @@ -347,7 +363,9 @@ PlayLogonSoundThread( } else { - PlaySoundRoutine(L"WindowsLogon", TRUE, SND_ALIAS | SND_NODEFAULT); + PlaySoundRoutine(IsFirstLogon() ? L"SystemStart" : L"WindowsLogon", + TRUE, + SND_ALIAS | SND_NODEFAULT); RevertToSelf(); } return 0;