msvcrt: Add support for quoted paths in _searchenv_s.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3a67291af4
commit
2e7ad72a8d
|
@ -1763,12 +1763,27 @@ int CDECL MSVCRT__searchenv_s(const char* file, const char* env, char *buf, MSVC
|
|||
for(; *penv; penv = (*end ? end + 1 : end))
|
||||
{
|
||||
end = penv;
|
||||
while(*end && *end != ';') end++; /* Find end of next path */
|
||||
path_len = end - penv;
|
||||
path_len = 0;
|
||||
while(*end && *end != ';' && path_len < MAX_PATH)
|
||||
{
|
||||
if (*end == '"')
|
||||
{
|
||||
end++;
|
||||
while(*end && *end != '"' && path_len < MAX_PATH)
|
||||
{
|
||||
path[path_len++] = *end;
|
||||
end++;
|
||||
}
|
||||
if (*end == '"') end++;
|
||||
continue;
|
||||
}
|
||||
|
||||
path[path_len++] = *end;
|
||||
end++;
|
||||
}
|
||||
if (!path_len || path_len >= MAX_PATH)
|
||||
continue;
|
||||
|
||||
memcpy(path, penv, path_len);
|
||||
if (path[path_len - 1] != '/' && path[path_len - 1] != '\\')
|
||||
path[path_len++] = '\\';
|
||||
if (path_len + fname_len >= MAX_PATH)
|
||||
|
|
Loading…
Reference in New Issue