static Win32() { Win32Native.OSVERSIONINFO osVer1 = new Win32Native.OSVERSIONINFO(); if (!Environment.GetVersion(osVer1)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osVer1.MajorVersion > 5 || osVer1.MinorVersion > 0) { System.Security.Principal.Win32._LsaLookupNames2Supported = true; System.Security.Principal.Win32._WellKnownSidApisSupported = true; } else { System.Security.Principal.Win32._LsaLookupNames2Supported = false; Win32Native.OSVERSIONINFOEX osVer2 = new Win32Native.OSVERSIONINFOEX(); if (!Environment.GetVersionEx(osVer2)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if ((int)osVer2.ServicePackMajor < 3) { System.Security.Principal.Win32._WellKnownSidApisSupported = false; } else { System.Security.Principal.Win32._WellKnownSidApisSupported = true; } } }
static Win32() { Win32Native.OSVERSIONINFO osversioninfo = new Win32Native.OSVERSIONINFO(); if (!Environment.GetVersion(osversioninfo)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osversioninfo.MajorVersion > 5 || osversioninfo.MinorVersion > 0) { Win32._LsaLookupNames2Supported = true; Win32._WellKnownSidApisSupported = true; return; } Win32._LsaLookupNames2Supported = false; Win32Native.OSVERSIONINFOEX osversioninfoex = new Win32Native.OSVERSIONINFOEX(); if (!Environment.GetVersionEx(osversioninfoex)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osversioninfoex.ServicePackMajor < 3) { Win32._WellKnownSidApisSupported = false; return; } Win32._WellKnownSidApisSupported = true; }
[System.Security.SecuritySafeCritical] // auto-generated static Win32() { Win32Native.OSVERSIONINFO osvi = new Win32Native.OSVERSIONINFO(); bool r = Environment.GetVersion(osvi); if (!r) { Contract.Assert(r, "OSVersion native call failed."); throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osvi.MajorVersion > 5 || osvi.MinorVersion > 0) // Windows XP/2003 and above { // // LsaLookupNames2 supported only on XP and Windows 2003 and above // _LsaLookupNames2Supported = true; _WellKnownSidApisSupported = true; } else { // Win2000 _LsaLookupNames2Supported = false; // // WellKnownSid apis are only supported on Windows 2000 SP3 and above // (so we need sp info) // Win32Native.OSVERSIONINFOEX osviex = new Win32Native.OSVERSIONINFOEX(); r = Environment.GetVersionEx(osviex); if (!r) { Contract.Assert(r, "OSVersion native call failed"); throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osviex.ServicePackMajor < 3) { _WellKnownSidApisSupported = false; } else { _WellKnownSidApisSupported = true; } } }
internal static extern bool GetVersion(Win32Native.OSVERSIONINFO osVer);