[Mono-bugs] [Bug 72260][Nor] Changed - SetEnvironmentVariable win32 API has no effect on Mono

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 6 Feb 2005 10:52:01 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by robertj@gmx.net.

http://bugzilla.ximian.com/show_bug.cgi?id=72260

--- shadow/72260	2005-02-06 08:47:00.000000000 -0500
+++ shadow/72260.tmp.29208	2005-02-06 10:52:01.000000000 -0500
@@ -63,6 +63,28 @@
 
 Environment variable "Foo" is set to "Some Value".
 
 How often does this happen? 
 
 Always.
+
+------- Additional Comments From robertj@gmx.net  2005-02-06 10:52 -------
+It's rather a glib or MSVCRT bug. The following C-code shows that
+Win32's SetEnvironmentVariable has no effect on getenv, which
+in turn is used by glib's g_getenv which in turn is used
+by Mono's Environment.GetEnvironmentVariable:
+
+/* compile with MS' "cl" */
+
+#include <stdlib.h>
+#include <windows.h>
+
+int main(void)
+{
+    SetEnvironmentVariable("HELLO", "world");
+
+    /* putenv works: */
+    /* putenv("HELLO=world"); */
+
+    printf("%s\n", getenv("HELLO"));
+}
+