private static void Detect()
        {
            OperatingSystem os = Environment.OSVersion;

            switch (os.Platform)
            {
            case PlatformID.Win32NT:
                Version v = os.Version;
                if (v.Major < 5)
                {
                    impl = MemoryProtectionImplementation.Unsupported;
                }
                else if (v.Major == 5)
                {
                    if (v.Minor < 2)
                    {
                        // 2000 (5.0) Service Pack 3 and XP (5.1)
                        impl = MemoryProtectionImplementation.Win32RtlEncryptMemory;
                    }
                    else
                    {
                        impl = MemoryProtectionImplementation.Win32CryptoProtect;
                    }
                }
                else
                {
                    // vista (6.0) and later
                    impl = MemoryProtectionImplementation.Win32CryptoProtect;
                }
                break;

            default:
                impl = MemoryProtectionImplementation.Unsupported;
                break;
            }
        }
示例#2
0
		private static void Detect ()
		{
			OperatingSystem os = Environment.OSVersion;
			switch (os.Platform) {
			case PlatformID.Win32NT:
				Version v = os.Version;
				if (v.Major < 5) {
					impl = MemoryProtectionImplementation.Unsupported;
				} else if (v.Major == 5) {
					if (v.Minor < 2) {
						// 2000 (5.0) Service Pack 3 and XP (5.1)
						impl = MemoryProtectionImplementation.Win32RtlEncryptMemory;
					} else {
						impl = MemoryProtectionImplementation.Win32CryptoProtect;
					}
				} else {
					// vista (6.0) and later
					impl = MemoryProtectionImplementation.Win32CryptoProtect;
				}
				break;
			default:
				impl = MemoryProtectionImplementation.Unsupported;
				break;
			}
		}