Browse Source

Merged revisions 863-864 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@884 -

peter 20 years ago
parent
commit
67228d8bb3
2 changed files with 24 additions and 3 deletions
  1. 22 1
      fcl/inc/custapp.pp
  2. 2 2
      fcl/win32/custapp.inc

+ 22 - 1
fcl/inc/custapp.pp

@@ -82,7 +82,6 @@ Type
 
 
 Implementation
 Implementation
 
 
-{$i custapp.inc}
 
 
 { TCustomApplication }
 { TCustomApplication }
 
 
@@ -91,6 +90,28 @@ begin
   Result:=Paramstr(0);
   Result:=Paramstr(0);
 end;
 end;
 
 
+Procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);
+
+var
+   s : string;
+   i,l,j,count : longint;
+
+begin
+  count:=GetEnvironmentVariableCount;
+  if count>0 then
+    for j:=1 to count  do
+     begin
+       s:=GetEnvironmentString(j);
+       l:=Length(s);
+       If NamesOnly then
+          begin
+            I:=pos('=',s);
+            If (I>0) then
+              S:=Copy(S,1,I-1);
+          end;
+       List.Add(S);
+    end;
+end;
 
 
 function TCustomApplication.GetEnvironmentVar(VarName : String): String;
 function TCustomApplication.GetEnvironmentVar(VarName : String): String;
 begin
 begin

+ 2 - 2
fcl/win32/custapp.inc

@@ -13,8 +13,8 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-function GetEnvironmentStrings : pchar; external 'kernel32' name 'GetEnvironmentStringsA';
-function FreeEnvironmentStrings(p : pchar) : longbool; external 'kernel32' name 'FreeEnvironmentStringsA';
+function GetEnvironmentStrings : pchar; stdcall; external 'kernel32' name 'GetEnvironmentStringsA';
+function FreeEnvironmentStrings(p : pchar) : longbool; stdcall; external 'kernel32' name 'FreeEnvironmentStringsA';
 
 
 Procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);
 Procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);