mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Added support for mesage-box to display on lock/login screen on Windows
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -156,8 +156,15 @@ function childContainer()
|
||||
if ((tsid = require('user-sessions').getProcessOwnerName(process.pid).tsid) == 0)
|
||||
{
|
||||
// We are running as LocalSystem
|
||||
child_options.uid = options.uid;
|
||||
child_options.type = require('child_process').SpawnTypes.USER;
|
||||
if (process.platform == 'win32' && options.uid == -1)
|
||||
{
|
||||
child_options.type = require('child_process').SpawnTypes.WINLOGON;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_options.uid = options.uid;
|
||||
child_options.type = require('child_process').SpawnTypes.USER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -69,11 +69,19 @@ function messageBox()
|
||||
{
|
||||
ret.options.uid = sid == null ? require('user-sessions').consoleUid() : sid;
|
||||
if (ret.options.uid == require('user-sessions').getProcessOwnerName(process.pid).tsid) { delete ret.options.uid; }
|
||||
if (sid == null && require('user-sessions').locked()) { ret.options.uid = -1; }
|
||||
}
|
||||
catch (ee)
|
||||
{
|
||||
ret._rej('No logged on users');
|
||||
return (ret);
|
||||
if (sid == null)
|
||||
{
|
||||
ret.options.uid = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret._rej(ee);
|
||||
return (ret);
|
||||
}
|
||||
}
|
||||
|
||||
ret._ipc = require('child-container').create(ret.options);
|
||||
|
||||
@@ -65,7 +65,12 @@ function UserSessions()
|
||||
require('events').EventEmitter.call(this, true)
|
||||
.createEvent('changed')
|
||||
.createEvent('locked')
|
||||
.createEvent('unlocked');
|
||||
.createEvent('unlocked')
|
||||
.addMethod('locked', function () { return (this._locked); })
|
||||
.addMethod('unlocked', function () { return (!this._locked); });
|
||||
this._locked = false;
|
||||
this.on('locked', function () { this._locked = true; });
|
||||
this.on('unlocked', function () { this._locked = false; });
|
||||
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user