v0.4.0

Version v0.1.0

Source
The operating system version, read through RtlGetVersion.

OsVersionInfoEx

pub struct OsVersionInfoEx {
    pub size: uint32;
    pub majorVersion: uint32;
    pub minorVersion: uint32;
    pub buildNumber: uint32;
    pub platformId: uint32;
    pub csdVersion: char16[N];
    pub servicePackMajor: uint16;
    pub servicePackMinor: uint16;
    pub suiteMask: uint16;
    pub productType: uint8;
    pub reserved: uint8;
}

The RTL_OSVERSIONINFOEXW that RtlGetVersion fills in.

Source

Fields

NameTypeDescription
sizeuint32The structure's size in bytes, sizeof(OsVersionInfoEx), which the caller sets before the call.
majorVersionuint32The major version: 10 for both Windows 10 and Windows 11.
minorVersionuint32The minor version: 0 for both Windows 10 and Windows 11.
buildNumberuint32The build number, such as 26100, which tells the releases apart.
platformIduint32The platform: 2, VER_PLATFORM_WIN32_NT, on every supported release.
csdVersionchar16[N]The NUL-terminated UTF-16 name of the latest service pack, empty on current releases.
servicePackMajoruint16The major version of the latest service pack.
servicePackMinoruint16The minor version of the latest service pack.
suiteMaskuint16The VER_SUITE_ bits saying which product suites are installed.
productTypeuint8Whether this is a workstation, VER_NT_WORKSTATION, a domain controller or a server.
reserveduint8Reserved.

VER_NT_WORKSTATION

pub const VER_NT_WORKSTATION: uint8 = 1;

VER_NT_WORKSTATION: the product type of a desktop edition, as opposed to a server.

Source

VER_PLATFORM_WIN32_NT

pub const VER_PLATFORM_WIN32_NT: uint32 = 2;

VER_PLATFORM_WIN32_NT: the platform of every supported Windows release.

Source

RtlGetVersion

pub extern func RtlGetVersion(info: *var OsVersionInfoEx) -> int32

Reads the true version of the running system, whatever the program's manifest declares. The caller sets size first; the call fills in every other field, csdVersion and the fields after it included, because the size says the structure is the extended one. It returns an NTSTATUS rather than a Bool, and sets nothing GetLastError reports.

See also: https://learn.microsoft.com/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlgetversion

Source

Parameters

NameTypeDescription
info*var OsVersionInfoExthe structure to fill, with size set to sizeof(OsVersionInfoEx)

Returns: zero, STATUS_SUCCESS, which is the only status the call returns