title: How to accurately get Windows OS version with C++?
body: <p>Every link I look at always mentions GetVersionEx, but that doesn't seem very helpful. </p>
  
  <p>My method looks like this,</p>
  
  <pre><code>static int windowsVersion() {
         OSVERSIONINFO osvi;
  
     ZeroMemory(&amp;osvi, sizeof(OSVERSIONINFO));
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
     GetVersionEx(&amp;osvi);
     return osvi.dwMajorVersion;
  }
  </code></pre>
  
  <p>Which I am running <strong>Windows 8</strong> and instead it returns <strong>6</strong>.</p>
  
  <p>If I'm trying to accurately get their version of Windows, that isn't very helpful.</p>
  
  <p>Note: I've also checked all the other variables. the dwMinorVersion returns a 4, build number returns something like 8400.</p>