This is wrong.
As of Windows 8, the GetVersionEx functions have been deprecated and this function will return the wrong version information as it pulls from the manifest which isn't updated (read: if upgrading from Windows 8 to 10, it returns a major version of 6 instead of 10). And lest someone think that the VerifyVersionInfo functions in the WINAPI will work, just know that they won't; they are now subject to the same manifest "bug"