internal static bool CheckForWin2KCrypto() { // cut-and-paste from Environment.OSVersion so we avoid the demand for EnvironmentPermission. // there's a side effect here that you can do a timing attack on how long it takes to spin up this // function and figure out whether you're pre- or post-Win2K crypto. But you could do that // anyway by looking at what CSPs are on the system. Microsoft.Win32.Win32Native.OSVERSIONINFO osvi = new Microsoft.Win32.Win32Native.OSVERSIONINFO(); bool r = Win32Native.GetVersionEx(osvi); if (!r) { return(false); } if (osvi.PlatformId == Win32Native.VER_PLATFORM_WIN32_NT) { return(osvi.MajorVersion >= 5); } return(false); }
internal static extern bool GetVersion(Microsoft.Win32.Win32Native.OSVERSIONINFO osVer);