Skip to content

Commit 337ec0d

Browse files
committed
Updated versioning.
1 parent 7efe0e4 commit 337ec0d

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

NtApiDotNet/AnnontationAttributes.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace NtApiDotNet
2222
/// </summary>
2323
public enum SupportedVersion
2424
{
25+
Unknown,
2526
Windows7,
2627
Windows8,
2728
Windows81,
@@ -33,6 +34,11 @@ public enum SupportedVersion
3334
Windows10_RS4,
3435
Windows10_RS5,
3536
Windows10_19H1,
37+
Windows10_19H2,
38+
/// <summary>
39+
/// This should always be at the end.
40+
/// </summary>
41+
Windows10_Latest,
3642
}
3743
#pragma warning restore 1591
3844

NtApiDotNet/NtObjectUtils.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,65 @@ internal static bool IsWindows81OrLess
687687
}
688688
}
689689

690+
internal static SupportedVersion SupportedVersion
691+
{
692+
get
693+
{
694+
if (IsWindows7OrLess)
695+
return SupportedVersion.Windows7;
696+
if (IsWindows8OrLess)
697+
return SupportedVersion.Windows8;
698+
if (IsWindows81OrLess)
699+
return SupportedVersion.Windows81;
700+
Version ver = Environment.OSVersion.Version;
701+
if (ver.Major != 10)
702+
{
703+
return SupportedVersion.Unknown;
704+
}
705+
706+
if (ver.Build <= 10240)
707+
{
708+
return SupportedVersion.Windows10;
709+
}
710+
else if (ver.Build <= 10586)
711+
{
712+
return SupportedVersion.Windows10_TH2;
713+
}
714+
else if (ver.Build <= 14393)
715+
{
716+
return SupportedVersion.Windows10_RS1;
717+
}
718+
else if (ver.Build <= 15063)
719+
{
720+
return SupportedVersion.Windows10_RS2;
721+
}
722+
else if (ver.Build <= 16299)
723+
{
724+
return SupportedVersion.Windows10_RS3;
725+
}
726+
else if (ver.Build <= 17134)
727+
{
728+
return SupportedVersion.Windows10_RS4;
729+
}
730+
else if (ver.Build <= 17763)
731+
{
732+
return SupportedVersion.Windows10_RS5;
733+
}
734+
else if (ver.Build <= 18362)
735+
{
736+
return SupportedVersion.Windows10_19H1;
737+
}
738+
else if (ver.Build <= 18363)
739+
{
740+
return SupportedVersion.Windows10_19H2;
741+
}
742+
else
743+
{
744+
return SupportedVersion.Windows10_Latest;
745+
}
746+
}
747+
}
748+
690749
private static Lazy<string> _assembly_version = new Lazy<string>(() =>
691750
{
692751
Assembly asm = Assembly.GetCallingAssembly();

0 commit comments

Comments
 (0)