Message387984
The reason to avoid the GetVersion API is that certain automatic
compatibility modes will lie about what the version number is, and
people complained that it was wrong (kind of like this complaint ;) ).
Reading the version from a system DLL bypasses that risk.
If your aim is to check the version for API compatibility/behaviour,
then GetVersion is exactly the right thing to use, because it'll be
adapted to match any compatibility options that are in effect. However,
the platform module is not for this purpose, but is for logging system
information. So we read from kernel32.dll instead (which is, yes, a
bootleg way of doing it).
Node.js has some fairly horrible ways of doing this stuff on Windows. I
haven't looked into this one in particular, but if they're not using
GetVersion it wouldn't surprise me if they're running "cmd /C ver" and
reading the output (don't even get me started on the security risks of
that).
The most correct way is to query the system information service via WMI
(which I'm 99% sure is what msinfo32.exe does). However, that's a _big_
step up in complexity, which is why we've avoided doing it to date. It
might be the only viable option here if Windows is getting this good at
shipping incremental rebuilds. |
|
Date |
User |
Action |
Args |
2021-03-02 23:14:30 | steve.dower | set | recipients:
+ steve.dower, paul.moore, tim.golden, zach.ware, corona10, bugale bugale, Orbital |
2021-03-02 23:14:30 | steve.dower | link | issue43284 messages |
2021-03-02 23:14:30 | steve.dower | create | |
|