Retrieving per-process environment block?

Herbert Stocker
Wed Nov 30 04:28:00 GMT 2016


On 29.11.2016 17:27, Andrey Repin wrote:
> Greetings, Erik Bray!
>> Thanks for the reply.  The issue here isn't getting the Windows
>> process environment--that can be done, albeit trickily [1].  While
>> it's true there are security implications, in this case that is
>> handled at the OpenProcess call required to obtain a handle to the
>> process.  It's true you can't just read the environment from a process
>> you don't have permission to.
>> The issue here though is reading the Cygwin process's environment
>> which is separate from its Windows environment, and the above
>> technique is inapplicable.
> Update Windows environment block when Cygwin environment is updated.

How about the case where paths are translated from Windows style to
Posix style when the Windows environment is copied to Cygwin environ-
ment on process initialization? Should they be converted back?
And thus psutils has to convert them back again to Posix style?
What will happen if a Cygwin process stores a windows path in its

Maybe each such variable should have a second variable in the Windows
environment block that contains the Posix version of the variable and
psutils picks that, in order to avoid round trip conversion inaccura-

Yea it's me again advocating against round trip conversions.

Or we simply copy the variables unconverted to the Windows environment
block, as the Windows env block is not used for anything else - up to
now it is not updated at all.


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list