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.
This commit is contained in:
Marc Durdin 2022-11-02 17:12:28 +11:00
parent cb9649dc4b
commit d01fe7551d

View file

@ -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