summaryrefslogtreecommitdiff
path: root/ACE/ace/Process.cpp
diff options
context:
space:
mode:
authormitza <mitza@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-07-31 15:12:19 +0000
committermitza <mitza@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-07-31 15:12:19 +0000
commit2e295eb6ac00ce44602cb14eceed9940eceb6d1d (patch)
tree6023901f7e5ad2dbe22c19ebad6acf9fa7d52b67 /ACE/ace/Process.cpp
parente109305c0c7ca8467851b3a2620e4a538ef4ce21 (diff)
downloadATCD-2e295eb6ac00ce44602cb14eceed9940eceb6d1d.tar.gz
ChangeLogTag: Thu Jul 31 15:10:16 UTC 2008 Adam Mitz <mitza@ociweb.com>
Diffstat (limited to 'ACE/ace/Process.cpp')
-rw-r--r--ACE/ace/Process.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp
index fe9ee80dbc0..51671ff70bd 100644
--- a/ACE/ace/Process.cpp
+++ b/ACE/ace/Process.cpp
@@ -855,7 +855,28 @@ ACE_Process_Options::inherit_environment (void)
environment_inherited_ = 1;
// Get the existing environment.
- ACE_TCHAR *existing_environment = ACE_OS::getenvstrings ();
+ ACE_TCHAR *existing_environment = 0;
+#ifndef ACE_USES_WCHAR
+ WCHAR *existing_wide_env = 0;
+ ACE_Vector<char> temp_narrow_env;
+ if (this->use_unicode_environment_)
+ {
+ existing_wide_env = ::GetEnvironmentStringsW ();
+ for (WCHAR *iter = existing_wide_env; *iter; ++iter)
+ {
+ ACE_Wide_To_Ascii wta (iter);
+ size_t len = ACE_OS::strlen (wta.char_rep ());
+ size_t idx = temp_narrow_env.size ();
+ temp_narrow_env.resize (idx + len + 1, 0);
+ ACE_OS::strncpy (&temp_narrow_env[idx], wta.char_rep (), len);
+ iter += len;
+ }
+ temp_narrow_env.push_back (0);
+ existing_environment = &temp_narrow_env[0];
+ }
+ else
+#endif
+ existing_environment = ACE_OS::getenvstrings ();
size_t slot = 0;
@@ -876,6 +897,11 @@ ACE_Process_Options::inherit_environment (void)
slot += len + 1;
}
+#ifndef ACE_USES_WCHAR
+ if (this->use_unicode_environment_)
+ ::FreeEnvironmentStringsW (existing_wide_env);
+ else
+#endif
ACE_TEXT_FreeEnvironmentStrings (existing_environment);
}