Discover & Report Windows Version Info from C program


New Member
We had a project built for Win2K, then WinXP, then Win7 that has now been converted from a 32-bit Win7 program using VS2010 to a 64-bit Win10 program using VS2017. The VS2017 project was created from scratch and the old sources where then imported and updated as needed.

When I created the new project, I set the Target Platform (in the project's Configuration, General section) to Windows 10 and since I have no special needs, I set the project to build a manifest automatically.

Today I noticed that the dialog we have that shows the current Windows version info in the program says they we are running under Windows 8.1, internal version number 6.2. When I looked up the GetVersionInfo function I found out that it "lies" for programs that do not have a manifest saying they target Windows 10.
My question is in two parts:
  1. Since I used the VS2017 to target Windows 10 and build the manifest automatically, why is the function that only lies to programs that are NOT targeted to Windows 10 lying to my program? Shouldn't it have built the manifest correctly if it is going to do it at all?
  2. If VS2017 cannot or will not correctly target my program for Windows 10, can anyone help me find an example of how to manually do that with a plain C project? (Microsoft is not helpful with comments like "just add the necessary SXS symbols to your .rc file" -- I'm not going to randomly stick code in the .rc file by hand, hoping I accidentally stick it is the right place!)
I freely admit my ignorance of the manifest stuff. To date, I have not knowingly run into any situation where I needed to know about it.


Thành viên BQT
Proceed like this:

First create a manifest file in your project folder and call it for example manifest.xml, then add it to your project in the Solution Explorer:


It should have this content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
Then right click on your project in the Solution Explorer. And modify the as shown below:



New Member
So, contrary to the Microsoft statement that confused me, there is NOTHING that goes into my .rc file! Thanks, I think I can handle this from here.

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.