Fixed MeshCore.js for 32bit Windows.

This commit is contained in:
Ylian Saint-Hilaire 2020-01-22 17:15:59 -08:00
parent 8e9fa0d635
commit b6ff01775f
2 changed files with 11 additions and 7 deletions

View File

@ -42,14 +42,18 @@ function createMeshCore(agent) {
if (process.platform == 'win32' && require('user-sessions').isRoot()) if (process.platform == 'win32' && require('user-sessions').isRoot())
{ {
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value // Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024); try {
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (x) { } var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024);
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (x2) { } } try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (x) { }
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (x2) { } }
} catch (ex) { }
// Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode // Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode
var meshCheck = false; try {
try { meshCheck = require('service-manager').manager.getService('Mesh Agent').isMe(); } catch (mce) { } var meshCheck = false;
if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService('Mesh Agent')) { require('win-bcd').enableSafeModeService('Mesh Agent'); } try { meshCheck = require('service-manager').manager.getService('Mesh Agent').isMe(); } catch (mce) { }
if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService('Mesh Agent')) { require('win-bcd').enableSafeModeService('Mesh Agent'); }
} catch (ex) { }
} }
if (process.platform == 'darwin' && !process.versions) { if (process.platform == 'darwin' && !process.versions) {

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.7-m", "version": "0.4.7-o",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",