Selaa lähdekoodia

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

marco 4 vuotta sitten
vanhempi
commit
012973a4a2
2 muutettua tiedostoa jossa 14 lisäystä ja 6 poistoa
  1. 5 2
      packages/winunits-base/src/comserv.pp
  2. 9 4
      rtl/win/sysutils.pp

+ 5 - 2
packages/winunits-base/src/comserv.pp

@@ -205,9 +205,12 @@ end;
 function GetModuleFileName: String;
 function GetModuleFileName: String;
 const
 const
   MAX_PATH_SIZE = 2048;
   MAX_PATH_SIZE = 2048;
+var
+  FileName: WideString;
 begin
 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;
 end;
 
 
 function GetModuleName: String;
 function GetModuleName: String;

+ 9 - 4
rtl/win/sysutils.pp

@@ -870,14 +870,19 @@ end;
                               Locale Functions
                               Locale Functions
 ****************************************************************************}
 ****************************************************************************}
 
 
-function GetLocaleStr(LID, LT: Longint; const Def: string): ShortString;
+function GetLocaleStr(LID, LT: Longint; const Def: string): AnsiString;
 var
 var
   L: Integer;
   L: Integer;
-  Buf: array[0..255] of Char;
+  Buf: unicodestring;
 begin
 begin
-  L := GetLocaleInfoA(LID, LT, Buf, SizeOf(Buf));
+  L := GetLocaleInfoW(LID, LT, nil, 0);
   if L > 0 then
   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
   else
     Result := Def;
     Result := Def;
 end;
 end;