0x01.GetVersionEx函数
0x01.原型
BOOL WINAPI GetVersionEx(
_Inout_ LPOSVERSIONINFO lpVersionInfo
);
0x02.参数
lpVersionInfo [in, out]
An `OSVERSIONINFO` or `OSVERSIONINFOEX` structure that receives the operating system information.
Before calling the `GetVersionEx` function, set the `dwOSVersionInfoSize` member of the structure as appropriate to indicate which data structure is being passed to this function.
0x03.返回值
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO or OSVERSIONINFOEX structure.
0x02.结构OSVERSIONINFOEX:
typedef struct {
DWORD dwOSVersionInfoSize; //在使用GetVersionEx之前要将此初始化为结构的大小
DWORD dwMajorVersion; //系统主版本号
DWORD dwMinorVersion; //系统次版本号
DWORD dwBuildNumber; //系统构建号
DWORD dwPlatformId; //系统支持的平台
TCHAR szCSDVersion[128]; //系统补丁包的名称
WORD wServicePackMajor; //系统补丁包的主版本
WORD wServicePackMinor; //系统补丁包的次版本
WORD wSuiteMask; //标识系统上的程序组
BYTE wProductType; //标识系统类型
BYTE wReserved; //保留,未使用
} OSVERSIONINFOEX, *POSVERSIONINFOEX;