From 90331579af58ef48a1bb5f8e65dbdb4614c13f18 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 29 Apr 2021 11:34:37 +0000 Subject: --- Merging r49244 into '.': U rtl/win/sysutils.pp --- Recording mergeinfo for merge of r49244 into '.': U . --- Merging r49245 into '.': U packages/winunits-base/src/comserv.pp --- Recording mergeinfo for merge of r49245 into '.': G . --- Merging r49250 into '.': G rtl/win/sysutils.pp --- Recording mergeinfo for merge of r49250 into '.': G . # revisions: 49244,49245,49250 r49244 | marco | 2021-04-22 16:00:51 +0200 (Thu, 22 Apr 2021) | 1 line Changed paths: M /trunk/rtl/win/sysutils.pp * use W variant to get localestrs. r49245 | marco | 2021-04-22 17:11:38 +0200 (Thu, 22 Apr 2021) | 1 line Changed paths: M /trunk/packages/winunits-base/src/comserv.pp * patch by Wallaby, mantis 0038382, load filename via -W function r49250 | marco | 2021-04-23 21:06:18 +0200 (Fri, 23 Apr 2021) | 1 line Changed paths: M /trunk/rtl/win/sysutils.pp * avoid rangecheck mantis 0038791 git-svn-id: https://svn.freepascal.org/svn/fpc/branches/fixes_3_2@49288 3ad0048d-3df7-0310-abae-a5850022a9f2 --- packages/winunits-base/src/comserv.pp | 7 +++++-- rtl/win/sysutils.pp | 13 +++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/winunits-base/src/comserv.pp b/packages/winunits-base/src/comserv.pp index d81adc8768..522b6e8ad9 100644 --- a/packages/winunits-base/src/comserv.pp +++ b/packages/winunits-base/src/comserv.pp @@ -205,9 +205,12 @@ end; function GetModuleFileName: String; const MAX_PATH_SIZE = 2048; +var + FileName: WideString; begin - SetLength(Result, MAX_PATH_SIZE); - SetLength(Result, Windows.GetModuleFileName(HInstance, @Result[1], MAX_PATH_SIZE)); + SetLength(FileName, MAX_PATH_SIZE); + SetLength(FileName, Windows.GetModuleFileNameW(HInstance, @FileName[1], MAX_PATH_SIZE)); + Result := FileName; end; function GetModuleName: String; diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp index 6d65f9f94e..95abd310e2 100644 --- a/rtl/win/sysutils.pp +++ b/rtl/win/sysutils.pp @@ -870,14 +870,19 @@ end; Locale Functions ****************************************************************************} -function GetLocaleStr(LID, LT: Longint; const Def: string): ShortString; +function GetLocaleStr(LID, LT: Longint; const Def: string): AnsiString; var L: Integer; - Buf: array[0..255] of Char; + Buf: unicodestring; begin - L := GetLocaleInfoA(LID, LT, Buf, SizeOf(Buf)); + L := GetLocaleInfoW(LID, LT, nil, 0); if L > 0 then - SetString(Result, @Buf[0], L - 1) + begin + SetLength(Buf,L-1); // L includes terminating NULL + if l>1 Then + L := GetLocaleInfoW(LID, LT, @Buf[1], L); + result:=buf; + end else Result := Def; end; -- cgit v1.2.1