Commit 9122bc10 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Avoid using wine_get_user_name() from libwine.

parent 73211637
......@@ -27,6 +27,9 @@
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......@@ -386,15 +389,27 @@ static void set_wow64_environment( WCHAR **env )
UNICODE_STRING valW = { 0, sizeof(buf), buf };
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
const char *p, *name;
const char *p;
const char *home = getenv( "HOME" );
const char *name = getenv( "USER" );
WCHAR *val;
HANDLE hkey;
DWORD i;
if (!home || !name)
{
struct passwd *pwd = getpwuid( getuid() );
if (pwd)
{
if (!home) home = pwd->pw_dir;
if (!name) name = pwd->pw_name;
}
}
/* set the Wine paths */
set_wine_path_variable( env, winedatadirW, wine_get_data_dir() );
set_wine_path_variable( env, winehomedirW, getenv("HOME") );
set_wine_path_variable( env, winehomedirW, home );
set_wine_path_variable( env, winebuilddirW, wine_get_build_dir() );
set_wine_path_variable( env, wineconfigdirW, config_dir );
for (i = 0; (p = wine_dll_enum_load_path( i )); i++)
......@@ -407,7 +422,7 @@ static void set_wow64_environment( WCHAR **env )
/* set user name */
name = wine_get_user_name();
if (!name) name = "wine";
if ((p = strrchr( name, '/' ))) name = p + 1;
if ((p = strrchr( name, '\\' ))) name = p + 1;
ntdll_umbstowcs( name, strlen(name) + 1, buf, ARRAY_SIZE(buf) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment