GetPlatform method


Prototype

GetPlatform Proto lpszSvPack:LPSTR

Syntax

Invoke GetPlatform, lpszSvPack

Function

Gets the current operating system platform. Use this method to determine when your application is running in a particular platform of the Windows operating systems.

Parameters

lpszSvPack

Pointer to the effective address of a null-terminated string to receive the service pack string (if any). This parameter can be NULL if you do not need the service pack information.

Return value

Eax/Rax returns the platform of the running operating system.

Possible returned values are:

1  ecWin95 Running O.S. is Windows 95
2  ecWin98 Running O.S. is Windows 98/ME
3  ecWinNT Running O.S. is Windows NT40
4  ecWin2K Running O.S. is Windows 2000
5  ecWinXP Running O.S. is Windows XP
6  ecWinVista Running O.S. is Windows Vista
7  ecWin7 Running O.S. is Windows 7
8  ecWin8 Running O.S. is Windows 8
9  ecWin81 Running O.S. is Windows 8.1
10  ecWin10 Running O.S. is Windows 10
11  ecWin11 Running O.S. is Windows 11
12  ecWinSever2003 Running O.S. is Windows Sever 2003
13  ecWinHomeServer Running O.S. is Windows Home Sever
14  ecWinServer2008 Running O.S. is Windows Sever 2008
15  ecWinServer2008R2 Running O.S. is Windows Sever 2008 R2
16  ecWinSever2012 Running O.S. is Windows Sever 2012
17  ecWinSever2012R2 Running O.S. is Windows Sever 2012 R2
18  ecWinSever2016 Running O.S. is Windows Sever 2016
19  ecWinSever2019 Running O.S. is Windows Sever 2019
20  ecWinSever2022 Running O.S. is Windows Sever 2022


WARNING
: Applications not explicity manifested for Windows 8.1, Windows 10, or Windows 11 will return the Windows 8 OS version (ecWin8). To manifest your applications for Windows 8.1, Windows 10, or Windows 11, it should be specified in the Manifest file. For more information, please click this MSDN link.

REMARKS: The address specified by the lpszSvPack parameter will be filled with a null-terminated string (such as "Service Pack 2") specifying the last service pack installed. This string can be empty if no service pack has been installed on the system. If the lpszSvPack parameter is a NULL pointer, then it is ignored and no information about the service pack is returned.

REMARKS:The lpszSvPack parameter will be filled with a Unicode string if the application is running as Unicode. Otherwise, it will be filled with an ANSI string (see the IsAppUnicode method). You can call GetPlatformA to get an ANSI string in Unicode applications, or GetPlatformW to get a Unicode string in ANSI applications.