diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index bdf2646f08b..75549347015 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2705,19 +2705,20 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer /* try a shortcut first */ - ret = ntdll_wcstoumbs( 0, name, name_len, unix_name + pos, unix_len - pos - 1, - NULL, &used_default ); - while (name_len && IS_SEPARATOR(*name)) { name++; name_len--; } + unix_name[pos] = '/'; + ret = ntdll_wcstoumbs( 0, name, name_len, unix_name + pos + 1, unix_len - pos - 2, + NULL, &used_default ); + if (ret >= 0 && !used_default) /* if we used the default char the name didn't convert properly */ { char *p; - unix_name[pos + ret] = 0; + unix_name[pos + 1 + ret] = 0; for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/'; if (!name_len || !redirect || (!strstr( unix_name, "/windows/") && strncmp( unix_name, "windows/", 8 ))) {