From a7a03a3920777a685564a2b285f3bdce808b53b6 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 8 Feb 2012 17:45:43 +0000 Subject: [PATCH] * uinfo.cc (cygheap_user::env_userprofile): Convert native userprofile path returned from get_registry_hive_path to Win32 path. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/uinfo.cc | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c531ee268..54510dd2a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2012-02-08 Corinna Vinschen + + * uinfo.cc (cygheap_user::env_userprofile): Convert native + userprofile path returned from get_registry_hive_path to Win32 path. + 2012-02-08 Corinna Vinschen * dll_init.cc: Throughout, drop usage of modname in favor of name. diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index ee90e52d3..eddfcec2b 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -440,7 +440,15 @@ cygheap_user::env_userprofile (const char *name, size_t namelen) cfree_and_set (puserprof, almost_null); if (get_registry_hive_path (get_windows_id (win_id), userprofile_env_buf)) - sys_wcstombs_alloc (&puserprof, HEAP_STR, userprofile_env_buf); + { + PWCHAR up = userprofile_env_buf + 4; + if (!wcsncasecmp (up, L"UNC\\", 4)) + { + up += 2; + *up = L'\\'; + } + sys_wcstombs_alloc (&puserprof, HEAP_STR, up); + } return puserprof; }