static Win32() { Win32Native.OSVERSIONINFO osVer = new Win32Native.OSVERSIONINFO(); if (!Environment.GetVersion(osVer)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if ((osVer.MajorVersion > 5) || (osVer.MinorVersion > 0)) { _LsaLookupNames2Supported = true; _WellKnownSidApisSupported = true; } else { _LsaLookupNames2Supported = false; Win32Native.OSVERSIONINFOEX osversioninfoex = new Win32Native.OSVERSIONINFOEX(); if (!Environment.GetVersionEx(osversioninfoex)) { throw new SystemException(Environment.GetResourceString("InvalidOperation_GetVersion")); } if (osversioninfoex.ServicePackMajor < 3) { _WellKnownSidApisSupported = false; } else { _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; } } }