S
S
sitev_ru2016-10-31 20:19:18
C++ / C#
sitev_ru, 2016-10-31 20:19:18

Why might GetVersionEx not work correctly?

OSVERSIONINFOEX ovi;

  ZeroMemory(&ovi, sizeof(OSVERSIONINFOEX));
  ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

  GetVersionEx((OSVERSIONINFO*)&ovi);

  printf("dwMajorVersion = %d\n", ovi.dwMajorVersion);

Under Windows 10, it gives a value of 6, although it should be 10. Why is that?
P.S. Manifest is disabled

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
15432, 2016-10-31
@15432

According to the documentation, starting with Win8.1, this function returns the version from the application manifest, or 6.2 if it doesn't exist
https://msdn.microsoft.com/en-us/library/windows/d...
Ibid to determine the version system is recommended to use this feature set
https://msdn.microsoft.com/en-us/library/windows/d...

S
sitev_ru, 2016-11-01
@sitev_ru

LPBYTE pinfoRawData{};
  if (NERR_Success == NetWkstaGetInfo(NULL, 100, &pinfoRawData))
  {
    WKSTA_INFO_100* pworkstationInfo = (WKSTA_INFO_100*)pinfoRawData;
    int major = pworkstationInfo->wki100_ver_major;
    int minor = pworkstationInfo->wki100_ver_minor;

    printf("major = %d\n", major);
    printf("minor = %d\n", minor);

    NetApiBufferFree(pinfoRawData);

  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question