neovars: fix keyboard LEDs (DllCall + unicode string)

This commit is contained in:
ferdinym 2020-09-30 17:21:36 +02:00
parent 00649b9409
commit 2687ece681
1 changed files with 4 additions and 9 deletions

View File

@ -39,16 +39,13 @@ KeyboardLED(LEDvalue, Cmd){ ; LEDvalue: ScrollLock=1, NumLock=2, CapsLock=4 ; Cm
KeyLED:=LEDvalue & (GetKeyState("ScrollLock","T") + 2*GetKeyState("NumLock","T") + 4*GetKeyState("CapsLock","T"))
}
; EncodeIntegerLED(KeyLED,1,&input,2) ;input bit pattern (KeyLED): bit 0 = scrolllock ;bit 1 = numlock ;bit 2 = capslock
input:=Chr(1) Chr(1) Chr(KeyLED)
input:=Chr(1)
input=
success:=DllCall("DeviceIoControl"
, "uint", h_device
, "ptr" , h_device
, "uint", CTL_CODE_LED( 0x0000000b ; FILE_DEVICE_KEYBOARD
, 2
, 0 ; METHOD_BUFFERED
, 0 ) ; FILE_ANY_ACCESS
, "uint", &input
, "int*", KeyLED << 16
, "uint", input_size
, "uint", 0
, "uint", 0
@ -77,10 +74,8 @@ NtCreateFileLED(ByRef wfilename,desiredaccess,sharemode,createdist,flags,fattrib
}
SetUnicodeStrLED(ByRef out, str_){
VarSetCapacity(st1, 8, 0)
InsertIntegerLED(0x530025, st1)
VarSetCapacity(out, (StrLen(str_)+1)*2, 0)
DllCall("wsprintfW", "str", out, "str", st1, "str", str_, "Cdecl UInt")
VarSetCapacity(out, 2*StrPut(str_, "utf-16"))
StrPut(str_, &out, "utf-16")
}
ExtractIntegerLED(ByRef pSource, pOffset = 0, pIsSigned = false, pSize = 4){