Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Wrong os.release() #25896

Closed
maxrimue opened this issue Aug 25, 2015 · 12 comments
Closed

Wrong os.release() #25896

maxrimue opened this issue Aug 25, 2015 · 12 comments
Labels

Comments

@maxrimue
Copy link

On Windows 10, 'os.release()' gets me '6.3.9600', however, the correct output for Windows 10 should be something with '10.0'. I'm running Node.js v0.12.7 64-bit on a 64-bit Windows 10, and I installed it after I upgraded to Windows 10, if that's important.

@dnakamura
Copy link

Whats the output of ver command https://en.wikipedia.org/wiki/Ver_(command)

@maxrimue
Copy link
Author

Microsoft Windows [Version 10.0.10240]

@dnakamura
Copy link

As it turns this is caused by a change on Microsofts part. Node uses GetVersionEx() on windows to get the version number. Apparently the change occurred beginning /w version 8.1. if an application is not manifested for win 8.1, or 10 the function always returns the version num of win 8, otherwise it always returns the lesser of version number in the manifest, or the actual version number. At the moment I'm looking at a clean way to work around this behavior. It seems the only way to do it is to read the value directly from the registry (which seems kinda hacky)

MS documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx

@maxrimue
Copy link
Author

I'm not that much into C/C++, but I found the following methods:

  • Execute ver and filter the output to only return the desired numbers
  • Query the registry for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion, CurrentVersion + CurrentBuild
  • Use GetVersionEx(), and if the version equals Windows 8.1, use the booleans of the Version Helper functions

I'm glad to help, however, I won't be able to provide actual code.

@joaocgreis
Copy link
Member

This seems related: nodejs/node#2332

@maxrimue
Copy link
Author

Yep, that's the same issue. Seems like it can be solved pretty easily.

@dnakamura
Copy link

@maxrimue
yeah the first 2 options would work, now I'm considering the which is the most robust/future proof. The version helper functions is not appealing since it would require updating the code every time a new build of windows shows up

@maxrimue
Copy link
Author

@dnakamura Since the ver command has been available since Windows 1.0, and still is, I don't see Microsoft removing that command any time soon.

@dnakamura
Copy link

@maxrimue Yeah, the ver command seems the most appealing

@joaocgreis
Copy link
Member

This will be fixed when nodejs/node#2843 lands.

@maxrimue
Copy link
Author

@joaocgreis Nice!

@joaocgreis
Copy link
Member

Done. Should make the v0.12.8 release!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants