mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 07:05:52 -05:00
Updated MeshAgents, all except FreeBSD and MacOS.
This commit is contained in:
parent
d780efd219
commit
e508687e96
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1165,7 +1165,6 @@ function createMeshCore(agent) {
|
||||
this.httprequest._dispatcher.ws = this;
|
||||
this.httprequest._dispatcher.on('connection', function (c)
|
||||
{
|
||||
console.log('client connected');
|
||||
this.ws._term = c;
|
||||
c.pipe(this.ws, { dataTypeSkip: 1 });
|
||||
this.ws.pipe(c, { dataTypeSkip: 1 });
|
||||
|
@ -146,6 +146,10 @@ function windows_terminal() {
|
||||
|
||||
this.StartEx = function Start(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT, terminalTarget)
|
||||
{
|
||||
// The older windows terminal does not support
|
||||
CONSOLE_SCREEN_WIDTH = 80;
|
||||
CONSOLE_SCREEN_HEIGHT = 25;
|
||||
|
||||
if (this._stream != null)
|
||||
{
|
||||
throw ('Concurrent terminal sessions are not supported on Windows.');
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019-2020 Intel Corporation
|
||||
Copyright 2019 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -47,12 +47,16 @@ function vt()
|
||||
|
||||
var GM = require('_GenericMarshal');
|
||||
var k32 = GM.CreateNativeProxy('kernel32.dll');
|
||||
k32.CreateMethod('CancelIoEx');
|
||||
k32.CreateMethod('CreatePipe');
|
||||
k32.CreateMethod('CreateProcessW');
|
||||
k32.CreateMethod('CreatePseudoConsole');
|
||||
k32.CreateMethod('CloseHandle');
|
||||
k32.CreateMethod('ClosePseudoConsole');
|
||||
k32.CreateMethod('GetProcessHeap');
|
||||
k32.CreateMethod('HeapAlloc');
|
||||
k32.CreateMethod('InitializeProcThreadAttributeList');
|
||||
k32.CreateMethod('ResizePseudoConsole');
|
||||
k32.CreateMethod('UpdateProcThreadAttribute');
|
||||
k32.CreateMethod('WriteFile');
|
||||
k32.CreateMethod('ReadFile');
|
||||
@ -101,16 +105,46 @@ function vt()
|
||||
{
|
||||
if (this.terminal._process)
|
||||
{
|
||||
this.terminal.k32.TerminateProcess(this.terminal._process, 0);
|
||||
this.terminal._process = null;
|
||||
this.terminal.k32.ReadFile.async.abort();
|
||||
k32.ClosePseudoConsole(this._obj._h.Deref());
|
||||
}
|
||||
flush();
|
||||
}
|
||||
});
|
||||
ds._obj = ret;
|
||||
ret._waiter = require('DescriptorEvents').addDescriptor(pi.Deref(0));
|
||||
ret._waiter.ds = ds;
|
||||
ret._waiter.on('signaled', function () { this.ds.push(null); });
|
||||
ret._waiter._obj = ret;
|
||||
ret._waiter.on('signaled', function ()
|
||||
{
|
||||
k32.CancelIoEx(this._obj._output.Deref(), 0);
|
||||
|
||||
// Child process has exited
|
||||
this.ds.push(null);
|
||||
|
||||
if (this._obj._process)
|
||||
{
|
||||
this._obj._process = null;
|
||||
k32.ClosePseudoConsole(this._obj._h.Deref());
|
||||
}
|
||||
k32.CloseHandle(this._obj._input.Deref());
|
||||
k32.CloseHandle(this._obj._output.Deref());
|
||||
|
||||
k32.CloseHandle(this._obj._consoleInput.Deref());
|
||||
k32.CloseHandle(this._obj._consoleOutput.Deref());
|
||||
});
|
||||
ds.resizeTerminal = function (w, h)
|
||||
{
|
||||
console.setDestination(console.Destinations.LOGFILE);
|
||||
console.log('resizeTerminal(' + w + ', ' + h + ')');
|
||||
var hr;
|
||||
if((hr=k32.ResizePseudoConsole(this._obj._h.Deref(), (h << 16) | w).Val) != 0)
|
||||
{
|
||||
console.log('HResult=' + hr);
|
||||
throw ('Resize returned HRESULT: ' + hr);
|
||||
}
|
||||
console.log('SUCCESS');
|
||||
};
|
||||
|
||||
ds.terminal = ret;
|
||||
ds._rpbuf = GM.CreateVariable(4096);
|
||||
@ -121,6 +155,8 @@ function vt()
|
||||
this._rp.then(function ()
|
||||
{
|
||||
var len = this.parent._rpbufRead.toBuffer().readUInt32LE();
|
||||
if (len <= 0) { return; }
|
||||
|
||||
this.parent.push(this.parent._rpbuf.toBuffer().slice(0, len));
|
||||
this.parent.__read();
|
||||
});
|
||||
@ -131,7 +167,6 @@ function vt()
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('FAILED!');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user