|
|
|
|
|
|
|
|
const { any } = require('bbhverse'); |
|
|
const { any } = require('bbhverse'); |
|
|
const fs = require('fs') |
|
|
const fs = require('fs') |
|
|
|
|
|
var path = require('path'); |
|
|
|
|
|
|
|
|
var cli = require('./cliverse') |
|
|
var cli = require('./cliverse') |
|
|
var nodeShellExec = cli.nodeShellExec; |
|
|
var nodeShellExec = cli.nodeShellExec; |
|
|
|
|
|
|
|
|
}).then((exitcode) => { |
|
|
}).then((exitcode) => { |
|
|
console.log('Elevated') |
|
|
console.log('Elevated') |
|
|
__isElevated = true; |
|
|
__isElevated = true; |
|
|
}).catch(() => { |
|
|
|
|
|
|
|
|
shell_verse.acquireElevationState = ()=> Promise.resolve(__isElevated); |
|
|
|
|
|
shell_verse.isElevated = () => { return Promise.resolve(__isElevated)} |
|
|
|
|
|
return __isElevated |
|
|
|
|
|
}).catch((e) => { |
|
|
__isElevated = false; |
|
|
__isElevated = false; |
|
|
console.log('Not Elevated'); |
|
|
|
|
|
}).finally(()=>{ |
|
|
|
|
|
shell_verse.acquireElevationState = ()=> Promise.resolve(__isElevated); |
|
|
shell_verse.acquireElevationState = ()=> Promise.resolve(__isElevated); |
|
|
shell_verse.isElevated = () => { return Promise.resolve(__isElevated)} |
|
|
shell_verse.isElevated = () => { return Promise.resolve(__isElevated)} |
|
|
return __isElevated; |
|
|
|
|
|
|
|
|
console.log('Not Elevated'); |
|
|
|
|
|
return __isElevated |
|
|
}) |
|
|
}) |
|
|
|
|
|
// .finally(()=>{ |
|
|
|
|
|
// shell_verse.acquireElevationState = ()=> Promise.resolve(__isElevated); |
|
|
|
|
|
// shell_verse.isElevated = () => { return Promise.resolve(__isElevated)} |
|
|
|
|
|
// // return __isElevated; // Value returned from finally is not supported by node. |
|
|
|
|
|
// }) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
, getTaskCheckExists : cli.createTask('getTaskCheckExists', 'where') |
|
|
, getTaskCheckExists : cli.createTask('getTaskCheckExists', 'where') |
|
|
|
|
|
|
|
|
console.log('result : ' + JSON.stringify(r)) |
|
|
console.log('result : ' + JSON.stringify(r)) |
|
|
Object.keys(processedArgs).forEach((v) => { v != '_' ? namedArgs.push('--' + v + '=' + processedArgs[v]) : null; }) |
|
|
Object.keys(processedArgs).forEach((v) => { v != '_' ? namedArgs.push('--' + v + '=' + processedArgs[v]) : null; }) |
|
|
// PB : TODO -- Convert all the cli args back to string. |
|
|
// PB : TODO -- Convert all the cli args back to string. |
|
|
var args = [`${selectedinstance.root}/.elxr/run-${taskToRun.runtimestamp}/windowselevate.hta`].concat(processedArgs._) |
|
|
|
|
|
|
|
|
var args = [ path.normalize(`${selectedinstance.root}/.elxr/run-${taskToRun.runtimestamp}/windowselevate.hta`) ].concat(processedArgs._) |
|
|
namedArgs.length > 0 ? args = args.concat(namedArgs.join(' ')) : null; |
|
|
namedArgs.length > 0 ? args = args.concat(namedArgs.join(' ')) : null; |
|
|
args.push('--runas=self'); |
|
|
args.push('--runas=self'); |
|
|
var elevatedruntimestamp = (new Date()).getTime() |
|
|
var elevatedruntimestamp = (new Date()).getTime() |