-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Dialog OS Version #3696
About Dialog OS Version #3696
Conversation
Some thoughts:
|
@Biswa96 |
|
Unless I'm mistaken to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! I think this is fine, but I'm going to hold off signing off until the headers get removed.
@@ -8,6 +8,9 @@ | |||
|
|||
#include <LibraryResources.h> | |||
|
|||
#include <Windows.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure these should actually already both be included in LibraryIncludes
in pch.h
, so they shouldn't be needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah pch.h
was including them. Committed the fix to this.
@@ -166,7 +166,7 @@ Temporarily using the Windows Terminal default settings. | |||
<value>About</value> | |||
</data> | |||
<data name="VersionLabelText" xml:space="preserve"> | |||
<value>Version:</value> | |||
<value>WT Version:</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd personally leave this unchanged, but maybe that's a personal stylistic choice. @DHowett-MSFT /@cinnamon-msft do you have thoughts here?
(TBH you don't need to change this back unless someone else agrees with me here)
If you can, you might want to try your changed Terminal in Windows 10 version 1909 (the November 2019 update). I'm worried it will not correctly report the Windows build number of 18363 for that version - because of the way 1909 is delivered (it is 1903 plus a small "enablement package" update to change a feature flag value), all Windows file versions in 1909 match those of 1903. Hence, if an application checks kernelbase.dll's version like you do here, it'll get 1903's build number of 18362, not 1909's build number of 18363. |
Also, while @Biswa96 is correct that |
@metathinker updated to Windows version 1909, and as you expected the update was not reflected in the DLL. Looking at the DLL modules WT is utilizing, none of them reflect this new version change either. Definitely seems questionable to use undocumented functionality, but I could implement it if needed. |
|
I apologize for sounding nitpicky, but when programs start doing things that Microsoft doesn't support for use outside of Windows itself, they rapidly create trouble for themselves and for Microsoft's Windows application compatibility team.
Only the kernel-mode version of RtlGetVersion in ntoskrnl.exe is documented. The user-mode version in ntdll.dll is undocumented, as is almost every function exported by ntdll.dll.
Yes, you can do that, but that doesn't mean you should. RtlGetVersion is probably okay, but if you start calling things like NtDirectGraphicsCall (to pick a random export from ntdll) then you are going to be in real trouble in a few years, or less if you're lucky.
It's true that the user-mode version of RtlGetVersion merely reads the process environment block. But there is a good reason we (Microsoft) don't document the version number fields in the PEB so you could just read from it yourself: We don't want people checking the version of Windows. Inevitably people do version checks wrong, so often that we added a feature to Windows such that documented version-check APIs lie to you by default. As it happens, calling RtlGetVersion is currently a way to bypass that check. But it is undocumented precisely to tell you "maybe you should try another path". |
@metathinker and @Biswa96 thanks for all the feedback and info. I'll start looking into implementing this with |
@mkitzan sorry -- i think the message was corrupted in transit. I don't think we should move forward with |
@DHowett-MSFT probably was haha. I'll hold fast then, thanks. |
Co-Authored-By: Michael Niksa <[email protected]>
A suggestion. Is there any reason why we cannot or should not read the |
I have a nitpick that hopefully might be accepted from a visual perspective. Could we make "WT Version" and "OS Version" display in bold? |
I am asking the expert on Windows OS versioning what the most appropriate way is to retrieve this data. I know that checking |
FYI, I am pretty sure his answer is going to be "don't check the OS version for anything." I'm also not certain that we have anything in here that is strictly dependent on the OS version anymore. |
We still require the OS Version for submitting issues, which is what this PR is addressing. A problem brought up for Terminal may in fact be for ConPTY or conhost but with the About Dialog, we can quickly copy/paste the OS Version so in future versions of Windows, we can still quickly determine if the issue brought up was resolved already or even a potential regression. Also, we need to ensure that Windows 10x is supported as well. (probably will be but just a sanity check) |
This is a brain dead hack, but we probably could open a ConPTY connection, have it execute |
I have heard the word of our savior, the OS versioning master himself.
|
Bless the OS versioning master for condescending themselves to this most humble of issues 🙏 |
Well... calling GetVersion() instead of RtlGetVersion() will subject you to the version lie by default that I mentioned above, and the manifest opt out only works for a particular major version of Windows, but as long as Windows' main version is stuck at 10, I doubt that will matter :) I believe you'd want to modify this file: https://github.com/microsoft/terminal/blob/master/src/cascadia/WindowsTerminal/WindowsTerminal.manifest Or at least you would so modify that file, but it already appears to have the right |
Correct. That's why we're going to prefer using the more supported-from-user-mode-code |
Thanks for the |
Nnnnnnn.
Or we should just give it up and take the version number out of the template or something. @DHowett-MSFT, opinion? |
I'm okay with the suppression. The value in having the OS version is reduced every time we take a component out-of-box, though, so I dunno if we even need this. It is nice to have a one-stop shop for version numbers though. |
Suppressing a warning and using a deprecated function for a garnish feature like this seems a little off. I can close this PR, and just keep the branch live on my fork. If we ever get a fully supported option, then it'll be easy to plug it into branch and re-open the PR. Let me know your thoughts, @miniksa / @DHowett-MSFT, before I go for it. |
@mkitzan you’ve got good instincts :) |
(Also, thank you!) |
Thanks for all the reviewing and advice on this one! I wouldn't have guessed OS versioning would be such a tricky subject. |
Summary of the Pull Request
Adds the user's full Windows version to the About dialog page. This reduces the amount of work a user must perform to open an Issue.
References
https://docs.microsoft.com/en-us/windows/win32/sysinfo/getting-the-system-version
PR Checklist
Detailed Description of the Pull Request / Additional comments
PR adds a function
_GetWindowVersion
toTerminalPage
which queries the version of an important Sytem32 DLL. The About dialog page uses this function to query the system version. While the referenced link on getting the Windows version suggests queryingkernel32.dll
, I found its version number was inconsistent compared to the version given whenver
is run in acmd
terminal. This implementation queriesKernelBase.dll
instead which gives the correct version.PR also changes the Windows Terminal version line to read
WT Version: x.x.x.x
to clearly differentiate the OS and WT versions.Validation Steps Performed
To validate the correctness of the About dialog OS version:
ver
in acmd
terminalTo test error checking and case where DLL does not exist, I replaced
KernelBase.dll
withdoes_not_exist.dll
and re-ran WT and got the expectedOS Version: 0.0.0.0 <arch>
.