0

I wanted to get the os product version as 6.3.9600.17415 when using OSVERSIONINFOEX i successfully get 6.3.9600

how to get the last build number that is 17415

Rahul
  • 441
  • 1
  • 6
  • 16
  • Where did you find the complete version number? I suppose 6300 is the build number of Windows? – Jens Borrisholt Oct 10 '15 at 04:45
  • Are aware that GetVersionEx is strongly deprecated and returns the wrong information unless you manifest support for the executing OS version? – David Heffernan Oct 10 '15 at 07:03
  • so which function to use instead of GetVersionEx, if it is depreciated. My product is intended for Windows 8 and above. – Rahul Oct 10 '15 at 11:21
  • You can use [`RtlGetVersion()`](https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910.aspx) – Remy Lebeau Oct 10 '15 at 19:55

1 Answers1

3

If you really need the exact build number, use GetFileVersionInfo on kernel32.dll. This post explains using GetFileVersionInfo:

https://stackoverflow.com/a/17286050/2501336

This is a documented means of getting the true OS build number and is immune from virtualization:

Getting the System Version

To obtain the full version number for the operating system, call the GetFileVersionInfo function on one of the system DLLs, such as Kernel32.dll, then call VerQueryValue to obtain the \\StringFileInfo\\<lang><codepage>\\ProductVersion subblock of the file version information.

Community
  • 1
  • 1
Brandon Staggs
  • 630
  • 5
  • 16
  • How do you propose to reliably get the **OS** version number from a random executable image's **file** version? – IInspectable Oct 10 '15 at 13:16
  • 3
    I don't propose getting the OS version from a random executable. I suggest getting it from kernel32.dll. That is a system DLL and this is an officially documented way to get the OS build number: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx (edited my answer to include this information) – Brandon Staggs Oct 10 '15 at 13:24
  • This is just one of several ways to get the "true" OS version without worrying about manifest virtualization. Other solutions that are not subject to manifestation include [`RtlGetVersion()`](https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910.aspx), [`NetServerGetInfo()`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa370624.aspx), and [`NetWkstaGetInfo()`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa370663.aspx). – Remy Lebeau Oct 10 '15 at 19:51