title: Getting Windows OS version programmatically
body: <p>I am trying to fetch Windows version with C# on my Windows 10 machine.</p>
  
  <p>I always get those values (with C#\C++):</p>
  
  <blockquote>
    <p>Major: 6 </p>
    
    <p>Minor: 2</p>
  </blockquote>
  
  <p>Which is Windows 8 OS, <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx">accordingly to MSDN</a></p>
  
  <p><strong>C# code:</strong> </p>
  
  <pre><code>var major = OperatingSystem.Version.Major
  var minor  = OperatingSystem.Version.Minor
  </code></pre>
  
  <p><strong>C++ code</strong></p>
  
  <pre><code>void print_os_info()
  {
      //http://stackoverflow.com/questions/1963992/check-windows-version
      OSVERSIONINFOW info;
      ZeroMemory(&amp;info, sizeof(OSVERSIONINFOW));
      info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
  
      LPOSVERSIONINFOW lp_info = &amp;info;
      GetVersionEx(lp_info);
  
      printf("Windows version: %u.%u\n", info.dwMajorVersion, info.dwMinorVersion);
  }
  </code></pre>
  
  <p>Windows 10 suppose to be with those:</p>
  
  <blockquote>
    <p>Major: 10</p>
    
    <p>Minor: 0*</p>
  </blockquote>
  
  <ul>
  <li>(When I am taking a dump file from running process I can see that the OS version of that file is set to 10.0)</li>
  </ul>
  
  <blockquote>
    <p>built by: 10.0.10586.0 (th2_release.151029-1700)</p>
  </blockquote>
  
  <p>What am I missing here?</p>