public static bool?SocketsReuseUnicastPortSupport() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { RTL_OSVERSIONINFOW v = default(RTL_OSVERSIONINFOW); v.dwOSVersionInfoSize = (uint)Marshal.SizeOf <RTL_OSVERSIONINFOW>(); RtlGetVersion(ref v); if (v.dwMajorVersion == 10) { return(true); } else if (v.dwMajorVersion == 6 && (v.dwMinorVersion == 2 || v.dwMinorVersion == 3)) { // On Windows 8/Windows Server 2012 (major=6, minor=2) or Windows 8.1/Windows Server 2012 R2 // (major=6, minor=3), this feature is not present unless a servicing patch is installed. // So, we return null to indicate that it is indeterminate whether the feature is active. return(null); } else { return(false); } } return(false); }
public static bool SocketsReuseUnicastPortSupport() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { RTL_OSVERSIONINFOW v = default(RTL_OSVERSIONINFOW); v.dwOSVersionInfoSize = (uint)Marshal.SizeOf <RTL_OSVERSIONINFOW>(); RtlGetVersion(ref v); return(v.dwMajorVersion == 10); } return(false); }
private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOW lpVersionInformation);
private static int RtlGetVersion(ref RTL_OSVERSIONINFOW lpVersionInformation) => throw new PlatformNotSupportedException();
public static extern int RtlGetVersion([In, Out] ref RTL_OSVERSIONINFOW lpVersionInformation);