From d01fe7551de4e6a3f110e33ff5a4166af1176fd5 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 2 Nov 2022 17:12:28 +1100 Subject: [PATCH] fix(developer): handle high-bit-set HKL correctly Fixes #7599. MSKLC HKLs have high bit set, which means that we need to explicitly cast from Integer to DWord to avoid range check errors. --- common/windows/delphi/general/Glossary.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/windows/delphi/general/Glossary.pas b/common/windows/delphi/general/Glossary.pas index 2fe92c5745..8cc6f5b983 100644 --- a/common/windows/delphi/general/Glossary.pas +++ b/common/windows/delphi/general/Glossary.pas @@ -112,7 +112,7 @@ begin if OpenKeyReadOnly('\'+SRegKey_KeyboardLayoutSubstitutes_CU) and ValueExists(IntToHex(HIWORD(ahkl), 8)) then begin - Result := StrToIntDef('$'+ReadString(IntToHex(HIWORD(ahkl), 8)), 0); + Result := DWord(StrToIntDef('$'+ReadString(IntToHex(HIWORD(ahkl), 8)), 0)); Exit; end; finally @@ -146,7 +146,7 @@ begin begin if StrToIntDef('$'+ReadString(SRegValue_KeyboardLayoutID), 0) = LayoutID then begin - Result := StrToIntDef('$'+str[i], 0); + Result := DWord(StrToIntDef('$'+str[i], 0)); if Result = 0 then Result := LOWORD(ahkl); Exit; end; @@ -186,7 +186,7 @@ begin ValueExists(SRegValue_KeyboardLayoutID) then if StrToIntDef('$' + ReadString(SRegValue_KeyboardLayoutID), 0) = LayoutID then begin - Result := HIWORD(StrToIntDef('$'+str[i], 0)); + Result := HIWORD(DWord(StrToIntDef('$'+str[i], 0))); Exit; end; finally