[Mono-dev] [PATCH] System.Environment fixes for Windows
Robert Jordan
robertj at gmx.net
Thu Dec 25 09:29:27 EST 2008
James Mansion wrote:
> Miguel de Icaza wrote:
>>> Calling Environment.SetEnvironmentVariable (...,
>>> EnvironmentVariableTarget.User) does not notify the OS that a variable
>>> has changed.
>>> See http://msdn.microsoft.com/en-us/library/ms682653(VS.85).aspx
>>>
> ...
>>> * Environment.cs (SetEnvironmentVariable) : Adding a call to
>>> internalBroadcastSettingChange to notify Windows that an environment
>>> variable has changed.
>>>
>
> Apologies that I'm not in a position to verify this - but can I question
> this? The broadcast is for
> when you change the settings that new processes started by the shell etc
> will not, not
> for changes to this process' environment. For changing this process'
> env, you should
> just need to call SetEnvironmentVariable.
>
> The comments at least are a bit misleading.
From MSDN's docs for
Environment.SetEnvironmentVariable Method (String, String,
EnvironmentVariableTarget)
"If target is User or Machine, other applications are notified of the
set operation by a Windows WM_SETTINGCHANGE message."
Hence the patch (and the ChangeLog comment) is correct.
Robert
More information about the Mono-devel-list
mailing list