mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-11 18:08:15 +02:00
* don't truncate environment variable strings in GetEnvironmentString()
* set the correct code page for the result of GetEnvironmentString() on Windows and NativeNT git-svn-id: branches/cpstrrtl@25103 -
This commit is contained in:
parent
08099c8558
commit
8b77f62873
@ -1108,6 +1108,7 @@ begin
|
||||
len:=UnicodeToUTF8(Nil, hp, 0);
|
||||
SetLength(Result, len);
|
||||
UnicodeToUTF8(PChar(Result), hp, len);
|
||||
SetCodePage(RawByteString(Result),CP_UTF8,false);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -66,11 +66,11 @@ begin
|
||||
Result:='';
|
||||
while assigned(EP^) and (Index>1) do
|
||||
begin
|
||||
Dec(Index);
|
||||
inc(EP);
|
||||
dec(Index);
|
||||
inc(EP);
|
||||
end;
|
||||
If Assigned(EP^) then
|
||||
Result:=StrPas(EP^);
|
||||
if Assigned(EP^) then
|
||||
Result:=EP^;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1026,13 +1026,16 @@ begin
|
||||
hp:=p;
|
||||
If (Hp<>Nil) then
|
||||
begin
|
||||
while (hp^<>#0) and (Index>1) do
|
||||
begin
|
||||
Dec(Index);
|
||||
hp:=hp+strlen(hp)+1;
|
||||
end;
|
||||
while (hp^<>#0) and (Index>1) do
|
||||
begin
|
||||
Dec(Index);
|
||||
hp:=hp+strlen(hp)+1;
|
||||
end;
|
||||
If (hp^<>#0) then
|
||||
Result:=StrPas(HP);
|
||||
begin
|
||||
Result:=HP;
|
||||
SetCodePage(RawByteString(Result),CP_OEMCP,false);
|
||||
end;
|
||||
end;
|
||||
FreeEnvironmentStringsA(p);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user