MIAMEX 106: Get OS Information

Revised and reviewed July 2020

xcall MIAMEX, MX_OSVER, osname {,osver, osrel, asplatform, ate'osname, ate'osver, ate'osrel, ate'platform}

MX_OSVER retrieves information about the current host operating system or ATE, including its name, version, and release, plus the platform for which this copy of A-Shell was compiled. This can be useful in applications which wish to take advantage of features that are only available under certain platforms.

Parameters

osname  (String, 10+)  [out]

returns the name of the host operating system. For Windows, the possibilities are: "Win95", "Win98", "WinME", "WinNT 3.51", "WinNT 4.0", "Win2000", and "WinXP".  If the version information is not recognized, it will be reported as "Win X.Y" where X is the major version number and Y is the minor version number. For 64-bit versions, "/64" will be appended to the end. For UNIX, OSNAME will return the same as the "uname -s" command, e.g. "Linux," "SCO_SV," "AIX."

osver  (String, 16+)  [out]

returns the "version" of the operating system. For Windows, this might contain "OSR2" for Win95, "SE" for Win98, or "Service Pack 6" for NT. For UNIX, it will be what "uname -v" returns, e.g. a date string for Linux, or "5.0.5" (SC0), or "4" (AIX 4.3).

osrel  (String, 16+)  [out]

returns the "release" of the operating system. For Windows, this will be the build number. For UNIX, this will be what "uname -r" returns, e.g. "2.4.2-2" (Linux), "3.2" (SCO), "3" (AIX 4.3).

asplatform  (String, 16+)  [out]

returns the generic platform that this copy of A-Shell was compiled for. This is the same string that would be returned in the SYSDOS field in GETJTB.SBR. Examples are: "AIX", "SCO Unix", "Linux", "Windows/32".

The parameters ate'osname, ate'osver, ate'osrel, and ate'platform are equivalent to the osname, osver, osrel and asplatform parameters, except they return the information about the ATE client, if applicable. Otherwise they return null strings.

The sample program MIAMEX.BP in EXLIB:[908,30] illustrates these fields.

Windows Names and Versions

The return values of the function are not as easy to to compare to a particular threshold as they might be—but then again, neither are the underlying OS versions themselves. Certain "recognized" versions of Windows will report a "friendly name" (e.g. "Win7") while unrecognized versions will just show "Win x.y" where x.y is the underlying major.minor version reported by Windows itself. Here is a table of those values:

Microsoft Public Name

Internal Version

OSname*

Windows 10

10.0

Win10**

Windows 8.1

6.3

**

Windows Server 2012 R2

6.3

WinSvr2012R2

Windows 8

6.2

Win 6.2

Windows Server 2012

6.2

Win 6.2

Windows 7

6.1

Win7

Windows Server 2008 R2

6.1

WinSvr2008R2

Windows Server 2008

6.0

WinSvr2008

Windows Vista

6.0

WinVista

Windows Server 2003 R2

5.2

Win 5.2

Windows Server 2003

5.2

Win 5.2

Windows XP 64-Bit Edition

5.2

Win 5.2

Windows XP

5.1

Win 5.1

Windows 2000

5.0

Win 5.0

Windows ME

4.90

Win 4.90

Windows 98

4.10

Win 4.10

Windows 95

4.0

Win 4.0

Windows NT

4.0

Win 4.0

Windows NT

3.?

Win 3.51

*  /64 is appended for 64-bit OS versions

**  Prior to A-Shell 6.2.1420.5, Windows 8.1 and above would report itself as Windows 8.

History

2020 July, A-Shell 6.5.1687:  The osname parameter will now be returned with "/64" appended to the end when running a 64 bit Windows OS.

2011 June, A-Shell 5.1.1221:  The osname parameter will now be returned with "/64" appended to the end when running a 64 bit Windows OS.

2007 May, A-Shell 4.9.988:  If this version or later is on both the A-Shell and ATE ends, MX_OSVER supports returning information about the ATE client.