Skip to content

Commit ad2aa16

Browse files
committed
windows-ui: fix inverted user interactive check
The code that was copied from the .NET runtime code (dotnet/runtime) had a bug in it that inverted the check for the WSF_VISIBLE flag! Updated the code to match their now fixed version.
1 parent c1ec880 commit ad2aa16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shared/Microsoft.Git.CredentialManager/Interop/Windows/WindowsSessionManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public unsafe bool IsDesktopSession
2020
// In .NET 5 the implementation on Windows has been 'fixed', but still POSIX versions always return true.
2121
//
2222
// This code is lifted from the .NET 5 targeting dotnet/runtime implementation for Windows:
23-
// https://github.com/dotnet/runtime/blob/8c10a98c13263eea806d4fcecb76d29e38593539/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs#L125-L145
23+
// https://github.com/dotnet/runtime/blob/cf654f08fb0078a96a4e414a0d2eab5e6c069387/src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs#L125-L145
2424

2525
// Per documentation of GetProcessWindowStation, this handle should not be closed
2626
IntPtr handle = User32.GetProcessWindowStation();
@@ -31,7 +31,7 @@ public unsafe bool IsDesktopSession
3131
if (User32.GetUserObjectInformation(handle, User32.UOI_FLAGS, &flags,
3232
(uint) sizeof(USEROBJECTFLAGS), ref dummy))
3333
{
34-
return (flags.dwFlags & User32.WSF_VISIBLE) == 0;
34+
return (flags.dwFlags & User32.WSF_VISIBLE) != 0;
3535
}
3636
}
3737

0 commit comments

Comments
 (0)