Old 18th February 2014, 15:01   #1
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by LoRd_MuldeR View Post
Restricting VerifyVersionInfo() to only accept what would have been accepted by the older Windows version obviously doesn't aid the golad to improve compatibilty.
Well, I don't agree with this at all.

Imagine this program:
Quote:
if (IsVistaOrLater())
DoVistaThing();
else
DoXPThing();
With this code, what happens when you choose a compatibility option in the .exe properties depends on the implementation of the IsVistaOrLater() function in this program. If GetVersion[Ex] was used then the program will fall back to XP behavior like the user requested but if VerifyVersionInfo was used then the users choice is ignored. You could argue that this is not a compatibility issue since the program knows about Vista but perhaps DoVistaThing() stopped working in 7 and you need to fall back to XP behavior for the program to work at all.

Imagine another scenario: A program uses VerifyVersionInfo but one of the 3rd party DLLs it depends on uses GetVersion, the combined program logic will now be out of sync!

VerifyVersionInfo was invented because people wrote broken comparison code like:
Quote:
if (major >= 5 && minor >= 1)
DoXPThing();
else
MessageBox("Not supported on this version of Windows");
(This is broken on Vista and would think it is < XP but works correctly again on 7)
IMHO VerifyVersionInfo should not act like some backdoor that ignores the requested compatibility mode and should just report the same results as GetVersion.


I also don't understand your compatibility != emulation argument. Emulation is exactly what it does, when the program is started the loader replaces standard Windows functions with a different function that is designed to work like it did in the older OS ( http://blogs.technet.com/b/askperf/a...new-stuff.aspx ). A couple of the shims even have Emulate in their name ( http://technet.microsoft.com/en-us/l...=ws.10%29.aspx )

A real world scenario where the version lie is not even about compatibility but the desire to emulate older behavior is/was MSN messenger. On 7 if you want it to use the tray icon mode you have to emulate a OS that does not have the new taskbar api.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th February 2014, 16:55   #2
Lenge
Member
 
Join Date: Oct 2007
Posts: 64
Quote:
Originally Posted by Anders View Post
Well, I don't agree with this at all. [...]
I respectfully disagree. I fully agree with MuldeR in this respect. As a developer, I definitely need a reliable way to detect the exact true Windows version that my application is running on, regardless of whatever manifest or compatibility options have been set.

What I do not need is a vendor that tries to tell me that I wouldn't want to know (or am not even allowed to know). Of course, we're all trying to make our apps as compatible with different versions of Windows as possible. But if I decide to query the real version, I do that for a reason, and I want to be sure that the result is correct.

However, I have no objections against having separate functions for "GetWindowsVersion" and "GetRealWindowsVersion", where the second one is not affected by whatever compatibility setting.
Lenge is offline   Reply With Quote
Old 18th February 2014, 17:46   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by Lenge View Post
I respectfully disagree. I fully agree with MuldeR in this respect. As a developer, I definitely need a reliable way to detect the exact true Windows version that my application is running on, regardless of whatever manifest or compatibility options have been set.
What you are saying does not make any sense to me. The reason the compatibility shims exist in the first place is so people can apply them on broken applications. If you are asking for a way around that then you are just going to end up causing extra pain for end users down the road unless you write perfect bug free software.

For diagnostics, sure, include kernel32 version, registry version or a GetRealWindowsVersion based on VerifyVersionInfo but for decisions made at run-time I don't think it is wise to fight whatever shims someone has applied to your process.

Before 8.1, things in the manifest only unlocked new features and it is sad that MS has decided to change that. I still think it is a good idea to wait for 8.2 to see if the 8.1 guid is enough to unlock GetVersion before we start thinking about ways to bypass everything...


Quote:
Originally Posted by Lenge View Post
What I do not need is a vendor that tries to tell me that I wouldn't want to know (or am not even allowed to know). Of course, we're all trying to make our apps as compatible with different versions of Windows as possible. But if I decide to query the real version, I do that for a reason, and I want to be sure that the result is correct.
When you say vendor, do you mean NSIS or MS?

As a user I feel that it is my machine and if I want to put your application in compatibility mode then that should be my decision and there should not be anything you can do about it. Sadly because the version functions are implemented differently, Win8.1 leaves us in nowhere land where all of this depends on which function the developer chose to use.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th February 2014, 02:13   #4
Lenge
Member
 
Join Date: Oct 2007
Posts: 64
Quote:
Originally Posted by Anders View Post
When you say vendor, do you mean NSIS or MS?
I mean Microsoft (the OS vendor that controls the APIs). NSIS is more like a partner that helps me work around some of their OS design decisions. After all, the entire NSIS concept is a way to avoid the "official standard" (which is MSI).

Quote:
Originally Posted by Anders View Post
As a user I feel that it is my machine and if I want to put your application in compatibility mode then that should be my decision and there should not be anything you can do about it.
Good point, yet still:

1.) While I agree that "GetWindowsVersion" should be the "normal" method to use in most cases, I still sometimes need "GetRealWindowsVersion". And when I do so, I know what I'm doing and why I'm doing that. (And, I promise, it's not for the purpose of insulting the user or making the application break. More of the opposite.) So if there is no cleanly defined "GetRealWindowsVersion" API, I'm forced to use some hack, which in turn is more likely to cause problems than any clean solution.

2.) In the case of Windows 8.1, you (as a user) just cannot decide to not run an application in compatibility mode. Microsoft has already decided that you must run every app in Win8 compatibility mode, unless the app has an explicit 8.1 manifest (which you as a user cannot influence).
Lenge is offline   Reply With Quote
Old 18th February 2014, 19:28   #5
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by Anders View Post
Well, I don't agree with this at all.

Imagine this program:

With this code, what happens when you choose a compatibility option in the .exe properties depends on the implementation of the IsVistaOrLater() function in this program. If GetVersion[Ex] was used then the program will fall back to XP behavior like the user requested but if VerifyVersionInfo was used then the users choice is ignored. You could argue that this is not a compatibility issue since the program knows about Vista but perhaps DoVistaThing() stopped working in 7 and you need to fall back to XP behavior for the program to work at all.

Imagine another scenario: A program uses VerifyVersionInfo but one of the 3rd party DLLs it depends on uses GetVersion, the combined program logic will now be out of sync!

VerifyVersionInfo was invented because people wrote broken comparison code like:

(This is broken on Vista and would think it is < XP but works correctly again on 7)
IMHO VerifyVersionInfo should not act like some backdoor that ignores the requested compatibility mode and should just report the same results as GetVersion.


I also don't understand your compatibility != emulation argument. Emulation is exactly what it does, when the program is started the loader replaces standard Windows functions with a different function that is designed to work like it did in the older OS ( http://blogs.technet.com/b/askperf/a...new-stuff.aspx ). A couple of the shims even have Emulate in their name ( http://technet.microsoft.com/en-us/l...=ws.10%29.aspx )

A real world scenario where the version lie is not even about compatibility but the desire to emulate older behavior is/was MSN messenger. On 7 if you want it to use the tray icon mode you have to emulate a OS that does not have the new taskbar api.
Well, I think we can agree that for any possible behavior of the "compatibility mode" we could probably find a program that (still) won't behave as intended with the "compatibility mode" enabled. I think it's just not possible to fix any broken program out there with just a single "compatibility mode" switch - simply because we cannot know what the programmer had originally in mind or what bugs are present in the program. The actual "compatibility mode", as it exists today, has probably been designed to hack around the most common issues.

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump