Skip to content

Commit 004b9e5

Browse files
committed
Update Native.DetectWindowsVersion() to consider Windows Server 2019 to be WindowsServer whenever it is not a Workstation (so, even when the server is configured to be a Domain Controller with PlatformType == 2)
1 parent 1416340 commit 004b9e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Grpc.Net.Client/Internal/Native.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal static class Native
3636
internal static void DetectWindowsVersion(out Version version, out bool isWindowsServer)
3737
{
3838
// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
39-
const byte VER_NT_SERVER = 3;
39+
const byte VER_NT_WORKSTATION = 1;
4040

4141
var osVersionInfo = new OSVERSIONINFOEX { OSVersionInfoSize = Marshal.SizeOf<OSVERSIONINFOEX>() };
4242

@@ -46,7 +46,7 @@ internal static void DetectWindowsVersion(out Version version, out bool isWindow
4646
}
4747

4848
version = new Version(osVersionInfo.MajorVersion, osVersionInfo.MinorVersion, osVersionInfo.BuildNumber, 0);
49-
isWindowsServer = osVersionInfo.ProductType == VER_NT_SERVER;
49+
isWindowsServer = osVersionInfo.ProductType != VER_NT_WORKSTATION;
5050
}
5151

5252
internal static bool IsUwp(string frameworkDescription, Version version)

0 commit comments

Comments
 (0)