Skip to content

Corecct ProcessInfo.operationSystemVersion on Windows #2041

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

Merged

Conversation

yamoridon
Copy link
Contributor

At Windows 8.1, Microsoft changed the default behavior of
GetVersionEx not to return actual version number for preventing
compatibility isseus. I think it's better to use the product version
retrived from kernel32.dll as an alternative as Microsoft described in
a document:
https://docs.microsoft.com/en-us/windows/desktop/SysInfo/getting-the-system-version

@spevans spevans requested a review from compnerd March 24, 2019 18:20
Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't do this -- RtlGetVersion is a much more direct approach.

@compnerd
Copy link
Member

The usage here is not for compatibility but rather reporting purposes. I agree with @jakepetroules - we should just resort to RtlGetVersion

@yamoridon
Copy link
Contributor Author

If my understanding is correct, we can't use that approach. RtlGetVersion is a kernel mode function, so application programs can't use it.

@compnerd
Copy link
Member

@yamoridon - no your understanding is not correct. The RtlFunctions are implemented in the kernel, but you can still use them in usermode. It just is a slightly roundabout way - you need to use GetProcAddress. If you want, I can make the change - its pretty easy.

@compnerd compnerd closed this Mar 25, 2019
@compnerd compnerd reopened this Mar 25, 2019
@yamoridon
Copy link
Contributor Author

@compnerd It's interesting. I try it. I think I can do it. Thank you!

@yamoridon
Copy link
Contributor Author

Thank you for advice. How about this? Too long line?

@compnerd
Copy link
Member

Minor naming things, but looks good otherwise!

@compnerd
Copy link
Member

@swift-ci please test

@compnerd
Copy link
Member

Can you also please squash the changes?

@yamoridon
Copy link
Contributor Author

Does it mean following?

  1. Close this PR.
  2. Make a new branch.
  3. Make changes on this PR as one commit on the new branch.
  4. Make a new PR

@compnerd
Copy link
Member

You can use git rebase -i to squash all the commits into a single commit and force push to the existing branch :-).

@yamoridon yamoridon force-pushed the correct-windows-operationg-system-version branch from 7a755cb to 97893d0 Compare March 27, 2019 16:53
@yamoridon
Copy link
Contributor Author

Seems to have succeeded. Thank you for your kind support!

@compnerd compnerd requested a review from jakepetroules March 27, 2019 18:05
@compnerd
Copy link
Member

@swift-ci please test

@compnerd
Copy link
Member

I think that this improves the Windows status quo, so I'm going to go ahead and merge this. If @millenomi has additional suggestions, they can be handled in a follow up.

@compnerd compnerd merged commit 9c7e85d into swiftlang:master Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants