1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Updated os.Name to use wmi instead of registry, because recent versions of windows no longer populates the registry keys correctly

This commit is contained in:
Bryan Roe
2021-11-02 21:37:12 -07:00
parent 443d9a222e
commit 794960350f

View File

@@ -2466,25 +2466,8 @@ void ILibDuktape_ScriptContainer_OS_Push(duk_context *ctx, void *chain)
switch (process.platform)\
{\
case 'win32':\
{\
try\
{\
winstr = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', 'ProductName') + ' - ' +\
require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', 'ReleaseID');\
}\
catch(xx)\
{\
winstr = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', 'ProductName');\
}\
try\
{\
winstr += (' [' + require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion', 'CurrentBuild') + ']');\
}\
catch(ee)\
{\
}\
}\
ret = winstr;\
ret = require('win-wmi').query('ROOT\\\\CIMV2', \"SELECT * FROM Win32_OperatingSystem\", ['Caption','BuildNumber']);\
ret = ret[0].Caption + ' - ' + ret[0].BuildNumber;\
break;\
case 'linux':\
lines = child.stdout.str.split('\\n');\