Mark White : kernel32: Fix forward slash path handling to GetVolumePathNameW.
Alexandre Julliard
julliard at winehq.org
Tue Jun 26 04:44:27 CDT 2018
Module: wine
Branch: stable
Commit: 205291791e9f70e73238866114c1cb28c3388074
URL: https://source.winehq.org/git/wine.git/?a=commit;h=205291791e9f70e73238866114c1cb28c3388074
Author: Mark White <chopinbig2 at gmail.com>
Date: Sat Mar 24 01:08:02 2018 -0400
kernel32: Fix forward slash path handling to GetVolumePathNameW.
Signed-off-by: Mark White <chopinbig2 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d37d9860a1b598c5a32e4f42e7c5b40224a60de2)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/kernel32/tests/volume.c | 4 ++++
dlls/kernel32/volume.c | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index 365e38c..c47043d 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -772,6 +772,10 @@ static void test_GetVolumePathNameA(void)
"s:omefile", "S:\\" /* win2k, winxp */, sizeof(volume_path),
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;
DWORD error;
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index b4163f0..3a4edf8 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -1693,6 +1693,10 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
return FALSE;
}
strcpyW( volumenameW, filename );
+
+ /* Normalize path */
+ for (c = volumenameW; *c; c++) if (*c == '/') *c = '\\';
+
stop_pos = 0;
/* stop searching slashes early for NT-type and nearly NT-type paths */
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)
{
- WCHAR *p;
memcpy(volumepathname, filename, last_pos * sizeof(WCHAR));
if (last_pos + 2 <= buflen) volumepathname[last_pos++] = '\\';
volumepathname[last_pos] = '\0';
- /* Normalize path */
- for (p = volumepathname; *p; p++) if (*p == '/') *p = '\\';
-
/* DOS-style paths always return upper-case drive letters */
if (volumepathname[1] == ':')
volumepathname[0] = toupperW(volumepathname[0]);
More information about the wine-cvs
mailing list