Arno Garrels wrote:
> Francois Piette wrote:
>>> Please see my previous post, I use it but.. obviously you have to
>>> check the result, because on my system it randomly returns one item
>>> that is not a valid name/value pair i.e. "=::=::\".
>> 
>> You have not shown your code. The environment string is terminated by a
>> double-nul byte. Here is another code I use in a CGI and never saw
>> failing:
> [..]
>> Can you check on your system and see if it gives bad data ?
> 
> Your procedure behaves the same.
> First try, and first item shows "=::=::\".

It appears to be some kind of current directory information.

CreateProcess:
 
"pEnvironment

[..]
If an application provides an environment block, rather than passing NULL for 
this parameter, the current directory information of the system drives is not 
automatically propagated to the new process.
If the current directory on drive C is \MSVC\MFC, there is an environment 
variable called =C: whose value is C:\MSVC\MFC. As noted in the previous 
description of lpEnvironment, such current directory information for a system's 
drives does not automatically propagate to a new process when the CreateProcess 
function's lpEnvironment parameter is non-NULL. An application must manually 
pass the current directory information to the new process. To do so, the 
application must explicitly create the =X environment variable strings, get 
them into alphabetical order (because Windows NT and Windows 95 use a sorted 
environment), and then put them into the environment block specified by 
lpEnvironment. Typically, they will go at the front of the environment block, 
due to the previously mentioned environment block sorting. 

One way to obtain the current directory variable for a drive X is to call 
GetFullPathName("X:",. .). That avoids an application having to scan the 
environment block. If the full path returned is X:\, there is no need to pass 
that value on as environment data, since the root directory is the default 
current directory for drive X of a new process.

Arno Garrels

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to