2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/string.h>
6 #include <msvcrt/msvcrtdbg.h>
9 extern int BlockEnvToEnviron(); // defined in misc/dllmain.c
11 int _wputenv(const wchar_t* val)
17 DPRINT("_wputenv('%S')\n", val);
18 epos = wcsrchr(val, L'=');
21 buffer = (char*)malloc((epos - val + 1) * sizeof(wchar_t));
24 wcsncpy(buffer, val, epos - val);
25 buffer[epos - val] = 0;
26 res = SetEnvironmentVariableW(buffer, epos+1);
28 if (BlockEnvToEnviron())