From: Egor Poleshko somedevfox@gmail.com
--- dlls/ntdll/unix/env.c | 1 + dlls/ntdll/unix/loader.c | 11 ++++++----- dlls/ntdll/unix/unix_private.h | 1 + dlls/secur32/secur32.c | 14 +++++++++++++- 4 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 36949b905fb..4edd740774a 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1099,6 +1099,7 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size ) add_system_dll_path_var( env, pos, size ); append_envA( env, pos, size, "WINELOADER", wineloader ); append_envA( env, pos, size, "WINEUSERNAME", user_name ); + append_envA( env, pos, size, "WINEDISPLAYUSERNAME", display_user_name); append_envA( env, pos, size, "WINEDLLOVERRIDES", overrides ); if (unix_cp.CodePage != CP_UTF8) { diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 19fbfb2b68c..dbf60ccd8b2 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -160,6 +160,7 @@ const char *config_dir = NULL; const char **dll_paths = NULL; const char **system_dll_paths = NULL; const char *user_name = NULL; +const char *display_user_name = NULL; SECTION_IMAGE_INFORMATION main_image_info = { NULL };
/* adjust an array of pointers to make them into RVAs */ @@ -410,17 +411,17 @@ static void set_system_dll_path(void) system_dll_paths[count] = NULL; }
- static void set_home_dir(void) { + struct passwd *pwd = getpwuid( getuid() ); const char *home = getenv( "HOME" ); const char *name = getenv( "USER" ); + const char *display_name = (pwd == NULL) ? "Wine" : pwd->pw_gecos; const char *p;
- if (!home || !name) + if(!home || !name) { - struct passwd *pwd = getpwuid( getuid() ); - if (pwd) + if(pwd) { if (!home) home = pwd->pw_dir; if (!name) name = pwd->pw_name; @@ -431,9 +432,9 @@ static void set_home_dir(void) if ((p = strrchr( name, '\' ))) name = p + 1; home_dir = strdup( home ); user_name = strdup( name ); + display_user_name = strdup( display_name ); }
- static void set_config_dir(void) { char *p, *dir; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 6cd88a5acc0..26601224619 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -161,6 +161,7 @@ extern const char *data_dir; extern const char *build_dir; extern const char *config_dir; extern const char *user_name; +extern const char *display_user_name; extern const char **dll_paths; extern const char **system_dll_paths; extern pthread_key_t teb_key; diff --git a/dlls/secur32/secur32.c b/dlls/secur32/secur32.c index f757ea6d34f..ce253e7a647 100644 --- a/dlls/secur32/secur32.c +++ b/dlls/secur32/secur32.c @@ -1158,9 +1158,21 @@ BOOLEAN WINAPI GetUserNameExW( return FALSE; }
+ case NameDisplay: + { + DWORD len = GetEnvironmentVariableW( L"WINEDISPLAYUSERNAME", lpNameBuffer, *nSize ); + BOOL ret; + + if (!len) return FALSE; + if ((ret = (len < *nSize))) len++; + else SetLastError( ERROR_INSUFFICIENT_BUFFER ); + *nSize = len; + + return ret; + } + case NameUnknown: case NameFullyQualifiedDN: - case NameDisplay: case NameUniqueId: case NameCanonical: case NameUserPrincipal: