[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Win32] putenv modifications not inherited by child processed (Was:
From: |
Bastien ROUCARIES |
Subject: |
Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv) |
Date: |
Tue, 19 Feb 2013 08:08:53 +0100 |
On Fri, Feb 15, 2013 at 11:24 PM, Eric Blake <address@hidden> wrote:
> On 02/15/2013 08:10 AM, Michael Goffioul wrote:
>> The problem is that the "environ" variable is just a mirror of the
>> environment that is manipulated through GetEnvironmentVariable and
>> SetEnvironmentVariable. Manipulating the "environ" variable directly has no
>> effect at the OS level and will only affect the current process (only calls
>> to _putenv will actually propagate the changes through Win32 API). Child
>> processes will not see the modified environment. Moreover even in the
>> current process, I believe the values returned by GetEnvironmentVariable
>> and "environ" (or getenv) will not be in sync.
>
> How are you spawning your child processes? Is it simple enough to wrap
> all calls that create child processes so that those call sites iterate
> through environ and shove it back into the OS level environment, so that
> the child inherits the right thing, while not worrying about the OS
> level environment for the rest of the process?
Yes ntcreateprocess is hotpatchable (something like ldpreload)
see for example blog post
http://ge0-it.blogspot.fr/2011/07/hot-patching-function-little-example.html
Bastien
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), (continued)
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Paul Eggert, 2013/02/18
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), John W. Eaton, 2013/02/19
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Paul Eggert, 2013/02/19
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), John W. Eaton, 2013/02/19
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Michael Goffioul, 2013/02/21
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Paul Eggert, 2013/02/22
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Michael Goffioul, 2013/02/22
- Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Paul Eggert, 2013/02/22
Re: [Win32] putenv modifications not inherited by child processed (Was: Heap corruption in putenv), Eric Blake, 2013/02/15