From b6ff01775f8ac9aee6d415d2d141a06ca990d2e3 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 22 Jan 2020 17:15:59 -0800 Subject: [PATCH] Fixed MeshCore.js for 32bit Windows. --- agents/meshcore.js | 16 ++++++++++------ package.json | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index a3d42fb0..9ec56dc0 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -42,14 +42,18 @@ function createMeshCore(agent) { if (process.platform == 'win32' && require('user-sessions').isRoot()) { // 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 { 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) { } } + try { + var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024); + 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 - var meshCheck = false; - 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'); } + try { + var meshCheck = false; + 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) { diff --git a/package.json b/package.json index 61d7782a..c2c97a71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.7-m", + "version": "0.4.7-o", "keywords": [ "Remote Management", "Intel AMT",