Windows10でVerifyVersionInfoAPIを使ってバージョンを調べるとWindows8として認識されます
ソースコード:
#define _WIN32_WINNT 0x0601 //win7
#include <windows.h>
#include <stdio.h>
#include <string.h>
int setOsVer(int setOsVer_i);
int majorv;
int minorv;
char osname[36];
int main()
{
OSVERSIONINFOEX OSver;
ULONGLONG condition = 0;
OSver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
int i;
for (i=0; i<7; i++){
setOsVer(i);
OSver.dwMajorVersion = majorv;
OSver.dwMinorVersion = minorv;
VER_SET_CONDITION( condition, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION( condition, VER_MINORVERSION, VER_EQUAL);
if( VerifyVersionInfo( &OSver, VER_MAJORVERSION | VER_MINORVERSION, condition) )
{
printf("%s\n", &osname);
break;
}
}
return 0;
}
int setOsVer(int setOsVer_i)
{
switch(setOsVer_i) {
case 0:
//windows 2000
strcpy( osname, "Windows 2000" );
majorv=5;
minorv=0;
break;
case 1:
//windows xp
strcpy( osname, "Windows XP" );
majorv=5;
minorv=1;
break;
case 2:
//windows xp professional x64 edition; windows2003server,windows2003serverr2
strcpy( osname, "Windows XP Professional x64 Edition" );
majorv=5;
minorv=2;
break;
case 3:
//windows vista; windowsserver2008
strcpy( osname, "Windows Vista" );
majorv = 6;
minorv = 0;
break;
case 4:
//windows 7; windowsserver2008r2
strcpy( osname, "Windows 7" );
majorv = 6;
minorv = 1;
break;
case 5:
//windows 8; windowsserver2012
strcpy( osname, "Windows 8" );
majorv = 6;
minorv = 2;
break;
case 6:
//windows 8.1
strcpy( osname, "Windows 8.1" );
majorv = 6;
minorv = 3;
break;
default:
return 1;
break;
}
return 0;
}
8.1までしか書いてないので8.1が出力されると思うんですが、
これで実行するとWindows 8が出力されます。
何が原因だと思いますか?