public static bool IsNotNetNativeRunningAsConsoleApp { get { throw null; } }
public static bool IsNotOneCoreUAP { get { throw null; } }
public static bool IsNotWindows8x { get { throw null; } }
+ public static bool IsNotWindowsHomeEdition { get { throw null; } }
public static bool IsNotWindowsIoTCore { get { throw null; } }
public static bool IsNotWindowsNanoServer { get { throw null; } }
public static bool IsNotWindowsServerCore { get { throw null; } }
public static bool IsWindows7 { get { throw null; } }
public static bool IsWindows8x { get { throw null; } }
public static bool IsWindowsAndElevated { get { throw null; } }
+ public static bool IsWindowsHomeEdition { get { throw null; } }
public static bool IsWindowsIoTCore { get { throw null; } }
public static bool IsWindowsNanoServer { get { throw null; } }
public static bool IsWindowsServerCore { get { throw null; } }
public static partial class PlatformDetection
{
public static bool IsWindowsIoTCore => false;
+ public static bool IsWindowsHomeEdition => false;
public static bool IsWindows => false;
public static bool IsWindows7 => false;
public static bool IsWindows8x => false;
}
}
+ public static bool IsWindowsHomeEdition
+ {
+ get
+ {
+ int productType = GetWindowsProductType();
+ switch (productType)
+ {
+ case PRODUCT_CORE:
+ case PRODUCT_CORE_COUNTRYSPECIFIC:
+ case PRODUCT_CORE_N:
+ case PRODUCT_CORE_SINGLELANGUAGE:
+ case PRODUCT_HOME_BASIC:
+ case PRODUCT_HOME_BASIC_N:
+ case PRODUCT_HOME_PREMIUM:
+ case PRODUCT_HOME_PREMIUM_N:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
public static bool IsWindows => true;
public static bool IsWindows7 => GetWindowsVersion() == 6 && GetWindowsMinorVersion() == 1;
public static bool IsWindows8x => GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3);
private const int PRODUCT_IOTUAP = 0x0000007B;
private const int PRODUCT_IOTUAPCOMMERCIAL = 0x00000083;
+ private const int PRODUCT_CORE = 0x00000065;
+ private const int PRODUCT_CORE_COUNTRYSPECIFIC = 0x00000063;
+ private const int PRODUCT_CORE_N = 0x00000062;
+ private const int PRODUCT_CORE_SINGLELANGUAGE = 0x00000064;
+ private const int PRODUCT_HOME_BASIC = 0x00000002;
+ private const int PRODUCT_HOME_BASIC_N = 0x00000005;
+ private const int PRODUCT_HOME_PREMIUM = 0x00000003;
+ private const int PRODUCT_HOME_PREMIUM_N = 0x0000001A;
[DllImport("kernel32.dll", SetLastError = false)]
private static extern bool GetProductInfo(
public static bool IsNotWindowsNanoServer => !IsWindowsNanoServer;
public static bool IsNotWindowsServerCore => !IsWindowsServerCore;
public static bool IsNotWindowsIoTCore => !IsWindowsIoTCore;
+ public static bool IsNotWindowsHomeEdition => !IsWindowsHomeEdition;
public static bool IsDrawingSupported => (IsNotWindowsNanoServer && IsNotWindowsIoTCore);
public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm;
public static bool IsNotArmProcess => !IsArmProcess;
Assert.Throws<PlatformNotSupportedException>(() => File.Decrypt(null));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+ // On Windows Nano Server and Home Edition, file encryption with File.Encrypt(string path) throws an IOException
+ // because EFS (Encrypted File System), its underlying technology, is not available on these operating systems.
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsHomeEdition))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "File encryption is not supported on this platform.")]
[PlatformSpecific(TestPlatforms.Windows)]
public static void EncryptDecrypt_Read()