diff --git a/PInvoke/Shared/PInvokeDataAttribute.cs b/PInvoke/Shared/PInvokeDataAttribute.cs
index 26153d77..50d95a04 100644
--- a/PInvoke/Shared/PInvokeDataAttribute.cs
+++ b/PInvoke/Shared/PInvokeDataAttribute.cs
@@ -64,4 +64,45 @@ namespace Vanara.PInvoke
/// The MSDN short identifier. This is a unique 8-character alphanumeric string used for Microsoft documentation.
public string MSDNShortId { get; set; }
}
+}
+
+namespace Vanara.Extensions
+{
+ /// Extension methods for .
+ public static class PInvokeClientExtensions
+ {
+ /// Determines whether the running OS is minimally the one specified.
+ /// The OS version to check.
+ /// if the running OS is minimally the specified client; otherwise, .
+ public static bool IsPlatformSupported(this PInvoke.PInvokeClient client)
+ {
+ var osVer = System.Environment.OSVersion.Version;
+
+ switch (client)
+ {
+ case PInvoke.PInvokeClient.None:
+ return true;
+ case PInvoke.PInvokeClient.Windows2000:
+ return osVer.Major >= 5;
+ case PInvoke.PInvokeClient.WindowsXP:
+ return osVer >= new Version(5, 1);
+ case PInvoke.PInvokeClient.WindowsXP_SP2:
+ return osVer >= new Version(5, 1, 2600, 2180);
+ case PInvoke.PInvokeClient.WindowsVista:
+ return osVer.Major >= 6;
+ case PInvoke.PInvokeClient.WindowsVista_SP2:
+ return osVer >= new Version(6, 0, 6002);
+ case PInvoke.PInvokeClient.Windows7:
+ return osVer >= new Version(6, 1);
+ case PInvoke.PInvokeClient.Windows8:
+ return osVer >= new Version(6, 2);
+ case PInvoke.PInvokeClient.Windows81:
+ return osVer >= new Version(6, 3);
+ case PInvoke.PInvokeClient.Windows10:
+ return osVer.Major >= 10;
+ default:
+ return false;
+ }
+ }
+ }
}
\ No newline at end of file