1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-21 02:33:24 +00:00

Added support for parallel installs, using alternative service names

This commit is contained in:
Bryan Roe
2020-10-24 13:26:02 -07:00
parent f94758c7e6
commit aeef17e649
9 changed files with 538 additions and 226 deletions

View File

@@ -17,6 +17,26 @@ limitations under the License.
const exeJavaScriptGuid = 'B996015880544A19B7F7E9BE44914C18';
const exeMeshPolicyGuid = 'B996015880544A19B7F7E9BE44914C19';
function mshLength()
{
var exesize = require('fs').statSync(process.execPath).size;
var fd = require('fs').openSync(process.execPath, "rb");
var buffer = Buffer.alloc(20);
require('fs').readSync(fd, buffer, 0, buffer.length, exesize - 20);
if(buffer.slice(4).toString('hex') == exeMeshPolicyGuid)
{
return (buffer.readUInt32BE(0));
}
else
{
return (0);
}
}
// Changes a Windows Executable to add the MSH inside of it.
// This method will write to destination stream and close it.
/*
@@ -152,6 +172,7 @@ function addMsh(options)
try
{
module.exports = addMsh;
module.exports.len = mshLength;
}
catch(e)
{
@@ -171,6 +192,10 @@ catch(e)
case '-i':
inputFile = process.argv[i + 1];
break;
case '-mshlen':
console.log('Integrated MSH Length: ' + mshLength());
process.exit();
break;
default:
console.log('unrecognized parameter: ' + process.argv[i]);
break;