Updated win-terminal.js to fix PowerShell.

This commit is contained in:
Ylian Saint-Hilaire 2019-08-15 13:43:54 -07:00
parent 7eb96283b7
commit f82ceec25b
3 changed files with 11 additions and 7 deletions

View File

@ -148,7 +148,7 @@ function windows_terminal() {
{ {
if (this._stream != null) if (this._stream != null)
{ {
throw ('Concurrent terminal sessions are not supported on Windows.'); throw ('Concurrent Terminal sessions are not supported on Windows');
} }
this.stopping = null; this.stopping = null;
if (this._kernel32.GetConsoleWindow().Val == 0) { if (this._kernel32.GetConsoleWindow().Val == 0) {
@ -397,7 +397,11 @@ function windows_terminal() {
} }
} }
} }
this._WriteCharacter = function (key, bControlKey) { this._WriteCharacter = function (key, bControlKey)
{
var scanCode = this._user32.VkKeyScanA(key).Val;
if (scanCode < 0 || scanCode > 255) { return; }
var rec = GM.CreateVariable(20); var rec = GM.CreateVariable(20);
rec.Deref(0, 2).toBuffer().writeUInt16LE(KEY_EVENT); // rec.EventType rec.Deref(0, 2).toBuffer().writeUInt16LE(KEY_EVENT); // rec.EventType
rec.Deref(4, 4).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.bKeyDown rec.Deref(4, 4).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.bKeyDown
@ -405,7 +409,7 @@ function windows_terminal() {
rec.Deref(14, 1).toBuffer()[0] = key; // rec.Event.KeyEvent.uChar.AsciiChar rec.Deref(14, 1).toBuffer()[0] = key; // rec.Event.KeyEvent.uChar.AsciiChar
rec.Deref(8, 2).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.wRepeatCount rec.Deref(8, 2).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.wRepeatCount
rec.Deref(10, 2).toBuffer().writeUInt16LE(this._user32.VkKeyScanA(key).Val); // rec.Event.KeyEvent.wVirtualKeyCode rec.Deref(10, 2).toBuffer().writeUInt16LE(this._user32.VkKeyScanA(key).Val); // rec.Event.KeyEvent.wVirtualKeyCode
rec.Deref(12, 2).toBuffer().writeUInt16LE(this._user32.MapVirtualKeyA(this._user32.VkKeyScanA(key).Val, MAPVK_VK_TO_VSC).Val); rec.Deref(12, 2).toBuffer().writeUInt16LE(this._user32.MapVirtualKeyA(scanCode, MAPVK_VK_TO_VSC).Val);
var dwWritten = GM.CreateVariable(4); var dwWritten = GM.CreateVariable(4);
if (this._kernel32.WriteConsoleInputA(this._stdinput, rec, 1, dwWritten).Val == 0) { return (false); } if (this._kernel32.WriteConsoleInputA(this._stdinput, rec, 1, dwWritten).Val == 0) { return (false); }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.9-z", "version": "0.4.0-a",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",