--- 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: branches/fixes_3_2@49288 -
This commit is contained in:
marco 2021-04-29 11:34:37 +00:00
parent b29cd3117a
commit 012973a4a2
2 changed files with 14 additions and 6 deletions

View File

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

View File

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