ntdll: Avoid using wine_get_user_name() from libwine.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-04-27 12:34:45 +02:00
parent 73211637c1
commit 9122bc1096
1 changed files with 18 additions and 3 deletions

View File

@ -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) );