Module: wine Branch: master Commit: f2060812418bc049105c2a30ceb039ee6d5f0fd7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=f2060812418bc049105c2a30c...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Nov 28 19:16:56 2019 +0100
ntdll: Keep a valid DOS name if the initial current directory is a Unix dir.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48114 Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/env.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 79a1805618..ebeda01ff8 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -622,8 +622,17 @@ static void get_current_directory( UNICODE_STRING *dir ) if (!wine_unix_to_nt_file_name( &unix_name, &nt_name )) { /* skip the ??\ prefix */ - dir->Length = nt_name.Length - 4 * sizeof(WCHAR); - memcpy( dir->Buffer, nt_name.Buffer + 4, dir->Length ); + if (nt_name.Length > 6 * sizeof(WCHAR*) && nt_name.Buffer[5] == ':') + { + dir->Length = nt_name.Length - 4 * sizeof(WCHAR); + memcpy( dir->Buffer, nt_name.Buffer + 4, dir->Length ); + } + else /* change ??\ to \?\ */ + { + dir->Length = nt_name.Length; + memcpy( dir->Buffer, nt_name.Buffer, dir->Length ); + dir->Buffer[1] = '\'; + } RtlFreeUnicodeString( &nt_name ); } }