summaryrefslogtreecommitdiffstats
path: root/misc.c
diff options
context:
space:
mode:
authorHeiko Hund <heiko.hund@sophos.com>2011-12-07 18:59:21 +0100
committerDavid Sommerseth <davids@redhat.com>2012-02-05 17:24:19 +0100
commita23f8579d37186559d3e1f6cd87a27b2331d4766 (patch)
tree2573426ee5b3a78beab6b9668e925d62da7789a5 /misc.c
parent04d66ef064d5ac1ade4b30329b87239aac95d821 (diff)
downloadopenvpn-a23f8579d37186559d3e1f6cd87a27b2331d4766.tar.gz
openvpn-a23f8579d37186559d3e1f6cd87a27b2331d4766.tar.xz
openvpn-a23f8579d37186559d3e1f6cd87a27b2331d4766.zip
set Windows environment variables as UCS-2
Windows uses 16 bit wide characters to represent Unicode in the process environment. Convert UTF-8 to UCS-2 and use the wide character API to set environment variables. Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index 884f2b2..1aa1be4 100644
--- a/misc.c
+++ b/misc.c
@@ -1082,8 +1082,8 @@ setenv_str_ex (struct env_set *es,
{
#if defined(WIN32)
{
- /*msg (M_INFO, "SetEnvironmentVariable '%s' '%s'", name_tmp, val_tmp ? val_tmp : "NULL");*/
- if (!SetEnvironmentVariable (name_tmp, val_tmp))
+ if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
+ wide_string (val_tmp, &gc)))
msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
name_tmp,
val_tmp ? val_tmp : "NULL");