4

Questions like this one involve issues caused by not setting the proper subsystem version in the PE header. I can do that with /SUBSYSTEM on Visual C++ and -Wl,--(major/minor)-subsystem-version on gcc.

But I noticed there is also an OS version field in the PE header. This is set by -Wl,--(major/minor)-os-version on gcc; I don't see an equivalent option in Microsoft's linker. What's confusing me is that gcc sets both the OS field and the subsystem field to 4.00 by default. So what's the difference between the two?

(Is the "image version" header field related to either of these?)

In addition, I see it is also possible to specify supported Windows versions in a manifest file. This question shows several being used at once.

What's the difference between all these settings and is there any advantage to using one over the other? Or all at the same time?

What if I have a DLL? Do any of these not apply with a DLL if the EXE that links to it isn't set up identically?

Thanks.

Community
  • 1
  • 1
andlabs
  • 11,290
  • 1
  • 31
  • 52
  • 2
    It refers to the *native* operating system. It's been 4.00 for at least the past 20 year and will surely stay that way for a long time to come. But you always target a sub-system in your app. Sane choices are 5.01 for XP, 6.00 for Vista and up. And just recently added, 10.00. If you get it wrong then the executable will not load. – Hans Passant Sep 12 '15 at 14:35
  • All right, so I should just not worry about setting the OS version field then. Thanks! – andlabs Sep 12 '15 at 14:46

0 Answers0