1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-03 17:13:16 +00:00

Updated platform check

This commit is contained in:
Bryan Roe
2021-01-20 22:24:36 -08:00
parent b3ad2c360c
commit b9e35c8f2f

View File

@@ -71,26 +71,31 @@ function getStatus()
return (ret);
}
var j = { status: getStatus };
require('events').EventEmitter.call(j, true)
.createEvent('changed');
j._H = require('_GenericMarshal').CreatePointer();
j._EV = require('_GenericMarshal').GetGenericGlobalCallback(1);
j._EV.parent = j;
j._EV.on('GlobalCallback', function (p)
if (process.platform == 'win32' && seccenter != null)
{
if (!this.ObjectToPtr_Verify(this.parent, p)) { return; } // This event is not for us
this.parent.emit('changed');
});
j.on('~', function ()
{
if (seccenter.WscUnRegisterChanges(this._H).Val == 0) { }
});
var j = { status: getStatus };
require('events').EventEmitter.call(j, true)
.createEvent('changed');
j._H = require('_GenericMarshal').CreatePointer();
j._EV = require('_GenericMarshal').GetGenericGlobalCallback(1);
j._EV.parent = j;
j._EV.on('GlobalCallback', function (p)
{
if (!this.ObjectToPtr_Verify(this.parent, p)) { return; } // This event is not for us
this.parent.emit('changed');
});
j.on('~', function ()
{
if (seccenter.WscUnRegisterChanges(this._H).Val == 0) { }
});
if(seccenter.WscRegisterForChanges(0, j._H, j._EV, require('_GenericMarshal').ObjectToPtr(j)).Val == 0)
{
j._H = j._H.Deref();
if (seccenter.WscRegisterForChanges(0, j._H, j._EV, require('_GenericMarshal').ObjectToPtr(j)).Val == 0)
{
j._H = j._H.Deref();
}
module.exports = j;
}
module.exports = j;
else
{
throw ('win-securitycenter not supported on this platform');
}