Enabled integrated RDP shortcuts.
Ylian Saint-Hilaire committed
May 7, 2022 at 18:15 UTC
129f13e7c31585fafdf0135c532fdcd31b29dd73
1 file changed
+71
-18
public/scripts/agent-rdp-0.0.1.js
+71
-18
@@ -182,32 +182,85 @@ var CreateRDPDesktop = function (canvasid) {
182
}
183
obj.m.SendKeyMsgKC = function (action, kc, extendedKey) {
184
if (obj.State != 3) return;
185
-
186
- console.log('SendKeyMsgKC', action);
187
-
188
- /*
185
if (typeof action == 'object') { for (var i in action) { obj.m.SendKeyMsgKC(action[i][0], action[i][1], action[i][2]); } }
186
else {
191
- console.log(action, kc, extendedKey);
192
- obj.socket.send(JSON.stringify(['scancode', kc, (action == 1)]));
193
-
194
- if (action == 1) { // Key Down
195
- if (obj.pressedKeys.indexOf(kc) == -1) { obj.pressedKeys.unshift(kc); } // Add key press to start of array
196
- } else if (action == 2) { // Key Up
197
- var i = obj.pressedKeys.indexOf(kc);
198
- if (i != -1) { obj.pressedKeys.splice(i, 1); } // Remove the key press from the pressed array
187
+ var scan = shortcutToScan[kc];
188
+ //console.log(action, kc, extendedKey, scan);
189
+ if (scan != null) {
190
+ //console.log('SEND', ['scancode', scan, ((action & 1) != 0)]);
191
+ obj.socket.send(JSON.stringify(['scancode', scan, ((action & 1) != 0)]));
192
}
200
- if (obj.debugmode > 0) { console.log('Sending Key ' + kc + ', action ' + action); }
201
-
202
- var up = (action - 1);
203
- if (extendedKey) { if (up == 1) { up = 3; } else { up = 4; } }
204
- obj.send(String.fromCharCode(0x00, obj.InputType.KEY, 0x00, 0x06, up, kc));
193
}
206
- */
194
}
195
obj.m.mousedblclick = function () { }
196
obj.m.handleKeyPress = function () { }
197
obj.m.setRotation = function () { }
198
+ obj.m.sendcad = function () { // Ctrl-Alt-Del
199
+ obj.socket.send(JSON.stringify(['scancode', 29, true])); // CTRL
200
+ obj.socket.send(JSON.stringify(['scancode', 56, true])); // ALT
201
+ obj.socket.send(JSON.stringify(['scancode', 57427, true])); // DEL
202
+ obj.socket.send(JSON.stringify(['scancode', 57427, false]));
203
+ obj.socket.send(JSON.stringify(['scancode', 56, false]));
204
+ obj.socket.send(JSON.stringify(['scancode', 29, false]));
205
+ }
206
+
207
+ var shortcutToScan = {
208
+ 9: 15, // Tab
209
+ 16: 42, // Shift
210
+ 17: 29, // Ctrl
211
+ 18: 56, // Alt
212
+ 27: 1, // ESC
213
+ 33: 57417, // Page Up
214
+ 34: 57425, // Page Down
215
+ 35: 57423, // End
216
+ 36: 57415, // Home
217
+ 37: 57419, // Left
218
+ 38: 57416, // Up
219
+ 39: 57421, // Right
220
+ 40: 57424, // Down
221
+ 44: 57399, // Print Screen
222
+ 45: 57426, // Insert
223
+ 46: 57427, // Del
224
+ 65: 30, // A
225
+ 66: 48, // B
226
+ 67: 46, // C
227
+ 68: 32, // D
228
+ 69: 18, // E
229
+ 70: 33, // F
230
+ 71: 34, // G
231
+ 72: 35, // H
232
+ 73: 23, // I
233
+ 74: 36, // J
234
+ 75: 37, // K
235
+ 76: 38, // L
236
+ 77: 50, // M
237
+ 78: 49, // N
238
+ 79: 24, // O
239
+ 80: 25, // P
240
+ 81: 16, // Q
241
+ 82: 19, // R
242
+ 83: 31, // S
243
+ 84: 20, // T
244
+ 85: 22, // U
245
+ 86: 47, // V
246
+ 87: 17, // W
247
+ 88: 45, // X
248
+ 89: 21, // Y
249
+ 90: 44, // Z
250
+ 91: 57435, // Windows left
251
+ 112: 59, // F1
252
+ 113: 60, // F2
253
+ 114: 61, // F3
254
+ 115: 62, // F4
255
+ 116: 63, // F5
256
+ 117: 64, // F6
257
+ 118: 65, // F7
258
+ 119: 66, // F8
259
+ 120: 67, // F9
260
+ 121: 68, // F10
261
+ 122: 87, // F11
262
+ 123: 88 // F12
263
+ }
264
265
return obj;
266
}