From 587d74dee4841ec36ef085e39fb4f33fdbf3f025 Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Fri, 18 Sep 2026 20:48:56 +1000 Subject: [PATCH] fix(windows): apply batched suggestions from code review Co-authored-by: Marc Durdin --- common/windows/delphi/general/utilstr.pas | 22 +++++++++---------- windows/src/desktop/kmshell/main/initprog.pas | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common/windows/delphi/general/utilstr.pas b/common/windows/delphi/general/utilstr.pas index 59a897ad2e..8319c37d04 100644 --- a/common/windows/delphi/general/utilstr.pas +++ b/common/windows/delphi/general/utilstr.pas @@ -62,21 +62,21 @@ function WideQuotedStr(const str: WideString): WideString; deprecated; // I3310 * Creates the compiled keyboard filename by inserting the base keyboard ID * before the .kmx extension. * - * @param KeyboardFileName Keyboard filename, in the form keyboardname.kmx. - * @param BaseKeyboardIDHex Base keyboard ID in hexadecimal form. - * @return Compiled keyboard filename, in the form keyboardname-.kmx. + * @param KeyboardFileName Keyboard filename, in the form '[path\]keyboardid[.kmx]' + * @param BaseKeyboardIDHex Base keyboard KLID in eight digit hexadecimal form + * @return Compiled keyboard filename, in the form '[path\]keyboardid-.kmx' *) -function InsertBKLIDFilename(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; +function GetKeyboardFilenameWithBaseKeyboardID(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; (** * Creates the dead-key compiled keyboard filename by inserting the base * keyboard ID and -d suffix before the .kmx extension. * - * @param KeyboardFileName Keyboard filename, in the form keyboardname.kmx. - * @param BaseKeyboardIDHex Base keyboard ID in hexadecimal form. - * @return Dead-key compiled keyboard filename, in the form keyboardname--d.kmx. + * @param KeyboardFileName Keyboard filename, in the form '[path]\keyboardid[.kmx]' + * @param BaseKeyboardIDHex Base keyboard KLID in eight digit hexadecimal form + * @return Dead-key compiled keyboard filename, in the form '[path\]keyboardid--d.kmx' *) -function InsertBKLIDDeadkeyFilename(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; +function GetKeyboardFilenameWithBaseKeyboardIDAndDeadkey(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; implementation @@ -436,14 +436,14 @@ begin Result.Bottom := StrToIntDef(s, 0); end; -function InsertBKLIDFilename(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; +function GetKeyboardFilenameWithBaseKeyboardID(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; begin Result := ChangeFileExt(KeyboardFileName, '') + '-' + BaseKeyboardIDHex + '.kmx'; end; -function InsertBKLIDDeadkeyFilename(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; +function GetKeyboardFilenameWithBaseKeyboardIDAndDeadkey(const KeyboardFileName: string; BaseKeyboardIDHex: string): string; begin - Result := ChangeFileExt(KeyboardFileName, '') + '-' + BaseKeyboardIDHex + '-d.kmx' + Result := ChangeFileExt(KeyboardFileName, '') + '-' + BaseKeyboardIDHex + '-d.kmx'; end; end. diff --git a/windows/src/desktop/kmshell/main/initprog.pas b/windows/src/desktop/kmshell/main/initprog.pas index f2392d6913..3010dae5cc 100644 --- a/windows/src/desktop/kmshell/main/initprog.pas +++ b/windows/src/desktop/kmshell/main/initprog.pas @@ -266,6 +266,7 @@ begin else if s = '-basekeyboard' then FMode := fmBaseKeyboard // I4169 else if s = '-mcompilekbds' then begin + // Requires elevated context FMode := fmMCompileKbds; Inc(i); if i > ParamCount then Exit;