APIGetVersionEx (kernel32)
Last changed: Grahamed-31.51.250.55

.
Summary
Is used to get OSInformation, you can try the System.Environment.OSVersion class.

C# Signature:

[DllImport("kernel32", SetLastError = true)]
private static extern bool GetVersionEx(ref OSVERSIONINFOEX osvi);

[StructLayout(LayoutKind.Sequential)]
private struct OSVERSIONINFOEX
{
    public int dwOSVersionInfoSize;
    public int dwMajorVersion;
    public int dwMinorVersion;
    public int dwBuildNumber;
    public int dwPlatformId;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
    public string szCSDVersion;
    public UInt16 wServicePackMajor;
    public UInt16 wServicePackMinor;
    public UInt16 wSuiteMask;
    public byte wProductType;
    public byte wReserved;
}

VB Signature:

Declare Function APIGetVersionEx Lib "kernel32.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

don't forget to set the dwOSVersionInfoSize  

Sample Code:

OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(osVersionInfo); // don't forget this line, please!
GetVersionEx(ref osVersionInfo);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation