From 42d178789b3b61793ee4f8d1621831ce9887c38d Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Mon, 11 May 2026 13:44:24 +0200 Subject: [PATCH] [KERNEL32] GetStartupInfoA(): Check other thread result at the latest (#8326) Give a bit more time to succeed. - Remove a remnant assignment. - Check the interesting variable itself and as late as possible. Follow-up to 0.4.16-dev-1610-g 4f61d2ea04 (#8282). --- dll/win32/kernel32/client/procansi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dll/win32/kernel32/client/procansi.c b/dll/win32/kernel32/client/procansi.c index 2d9753da841..3bd389490f6 100644 --- a/dll/win32/kernel32/client/procansi.c +++ b/dll/win32/kernel32/client/procansi.c @@ -287,8 +287,6 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) } /* Someone beat us to it, we will use their data instead */ - Status = STATUS_SUCCESS; - /* We're going to free our own stuff, but not raise */ RtlFreeAnsiString(&TitleString); } @@ -297,9 +295,6 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) RtlFreeAnsiString(&ShellString); } RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo); - - /* Get the cached information again: either still NULL or set by another thread */ - StartupInfo = BaseAnsiStartupInfo; } else { @@ -307,8 +302,12 @@ GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) Status = STATUS_NO_MEMORY; } - /* Raise an error unless we got here due to the race condition */ - if (!StartupInfo) RtlRaiseStatus(Status); + /* Raise an error if there is no cached information */ + if (!BaseAnsiStartupInfo) + RtlRaiseStatus(Status); + + /* Get the cached information again: set by another thread */ + StartupInfo = BaseAnsiStartupInfo; } /* Now copy from the cached ANSI version */