求用C编写的获得操作系统版本的代码,要求使用GetVersionEx函数。十分。

来源:百度知道 编辑:UC知道 时间:2024/06/05 06:46:57

GetVersionEx function obtains extended information about the version of the operating system that is currently running.

Windows 2000/XP: To compare the current system version to a required version, use the VerifyVersionInfo function instead of using GetVersionEx to perform the comparison yourself.

BOOL GetVersionEx(
LPOSVERSIONINFO lpVersionInfo // version information
);
Parameters
lpVersionInfo
[in/out] Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information.
Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).

Windows NT 4.0 SP6 and later: This member can be a pointer to an OSVERSIONINFOEX structure. Set the dwOSVersionInfoSize member to sizeof(OSVERSIONINFOEX) to identify the structure type.

Return Values
If the function succeeds, the return value is a nonzer