kernel32: Fix forward slash path handling to GetVolumePathNameW.
Signed-off-by: Mark White <chopinbig2@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fb48a8f47e
commit
d37d9860a1
|
@ -772,6 +772,10 @@ static void test_GetVolumePathNameA(void)
|
||||||
"s:omefile", "S:\\" /* win2k, winxp */, sizeof(volume_path),
|
"s:omefile", "S:\\" /* win2k, winxp */, sizeof(volume_path),
|
||||||
ERROR_FILE_NOT_FOUND, NO_ERROR
|
ERROR_FILE_NOT_FOUND, NO_ERROR
|
||||||
},
|
},
|
||||||
|
{ /* test 42: a reasonable forward slash path that is guaranteed to exist */
|
||||||
|
"C:/windows/system32", "C:\\", sizeof(volume_path),
|
||||||
|
NO_ERROR, NO_ERROR
|
||||||
|
},
|
||||||
};
|
};
|
||||||
BOOL ret, success;
|
BOOL ret, success;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
|
|
@ -1693,6 +1693,10 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpyW( volumenameW, filename );
|
strcpyW( volumenameW, filename );
|
||||||
|
|
||||||
|
/* Normalize path */
|
||||||
|
for (c = volumenameW; *c; c++) if (*c == '/') *c = '\\';
|
||||||
|
|
||||||
stop_pos = 0;
|
stop_pos = 0;
|
||||||
/* stop searching slashes early for NT-type and nearly NT-type paths */
|
/* stop searching slashes early for NT-type and nearly NT-type paths */
|
||||||
if (strncmpW(ntprefixW, filename, strlenW(ntprefixW)) == 0)
|
if (strncmpW(ntprefixW, filename, strlenW(ntprefixW)) == 0)
|
||||||
|
@ -1776,14 +1780,10 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||||
|
|
||||||
if (last_pos + 1 <= buflen)
|
if (last_pos + 1 <= buflen)
|
||||||
{
|
{
|
||||||
WCHAR *p;
|
|
||||||
memcpy(volumepathname, filename, last_pos * sizeof(WCHAR));
|
memcpy(volumepathname, filename, last_pos * sizeof(WCHAR));
|
||||||
if (last_pos + 2 <= buflen) volumepathname[last_pos++] = '\\';
|
if (last_pos + 2 <= buflen) volumepathname[last_pos++] = '\\';
|
||||||
volumepathname[last_pos] = '\0';
|
volumepathname[last_pos] = '\0';
|
||||||
|
|
||||||
/* Normalize path */
|
|
||||||
for (p = volumepathname; *p; p++) if (*p == '/') *p = '\\';
|
|
||||||
|
|
||||||
/* DOS-style paths always return upper-case drive letters */
|
/* DOS-style paths always return upper-case drive letters */
|
||||||
if (volumepathname[1] == ':')
|
if (volumepathname[1] == ':')
|
||||||
volumepathname[0] = toupperW(volumepathname[0]);
|
volumepathname[0] = toupperW(volumepathname[0]);
|
||||||
|
|
Loading…
Reference in New Issue