playcom-de / Console

Library for Windows Console Applications using crt.pas
Other
24 stars 4 forks source link

range check error: Ply.Console.pas, Function tConsole.GetKeyboardLayout : TKeyboardLayout; #1

Closed mvanrijnen closed 1 year ago

mvanrijnen commented 1 year ago

range check error: Ply.Console.pas

[code] Function tConsole.GetKeyboardLayout : TKeyboardLayout; Var pwszKLID : Array [0..KL_NameLength] of Char; begin FillChar(pwszKLID,sizeof(pwszKLID),#0); if (GetKeyboardLayoutNameW(pwszKLID)) then begin FKeyboardLayout := StrToInt('$'+StrPas(pwszKLID)); end else begin FKeyboardLayout := _KeyboardLayout_de_DE; end; Result := FKeyboardLayout; end; [/code]

On  the strtoint('$'+ .... line (pwszKLID = ('0', '0', '0', '2', '0', '4', '0', '9', #0 #0)

Solution see: https://en.delphipraxis.net/topic/9353-console-application-crt-unit-console-library/?do=findComment&comment=77878

playcom-de commented 1 year ago

Yes, TKeyboardLayout must be Longword. I fixed it. Thanks!