From: Mark White chopinbig2@gmail.com
Fixes https://bugs.winehq.org/show_bug.cgi?id=42446
GetVolumePathNameW is causing some incompatibity problems with some Windows applications such as Native Instruments "Native Access" because of an inability to handle path names containing forward slash's whereas the Windows GetVolumePathName's behaviour handles path names with both forward and back slash's.
Tested on Debian Stretch and Windows Vista
Signed-off-by: Mark White chopinbig2@gmail.com --- dlls/kernel32/tests/volume.c | 4 ++++ dlls/kernel32/volume.c | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 365e38c444..c47043d288 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 b4163f02eb..ac887b2f3f 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1670,6 +1670,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu WCHAR fallbackpathW[] = { 'C',':','\',0 }; NTSTATUS status = STATUS_SUCCESS; WCHAR *volumenameW = NULL, *c; + WCHAR *fwdslash; int pos, last_pos, stop_pos; UNICODE_STRING nt_name; ANSI_STRING unix_name; @@ -1693,6 +1694,8 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu return FALSE; } strcpyW( volumenameW, filename ); + /* forward slash backslash replace */ + for (fwdslash = volumenameW; *fwdslash; fwdslash++) if (*fwdslash == '/') *fwdslash = '\'; stop_pos = 0; /* stop searching slashes early for NT-type and nearly NT-type paths */ if (strncmpW(ntprefixW, filename, strlenW(ntprefixW)) == 0)
Fixes https://bugs.winehq.org/show_bug.cgi?id=42446
GetVolumePathNameW is causing some incompatibity problems with some Windows applications such as Native Instruments "Native Access" because of an inability to handle path names containing forward slash's whereas the Windows GetVolumePathName's behaviour handles path names with both forward and back slash's. This v2 patch also includes GetVolumePathNameW relative path handling.
Tested on Debian Stretch and Windows Vista
Signed-off-by: Mark White markau0@lycos.com --- dlls/kernel32/volume.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index ac887b2f3f..c5a38e44a8 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1670,7 +1670,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu WCHAR fallbackpathW[] = { 'C',':','\',0 }; NTSTATUS status = STATUS_SUCCESS; WCHAR *volumenameW = NULL, *c; - WCHAR *fwdslash; + WCHAR bufferW[MAX_PATH], *lastpartW = NULL; int pos, last_pos, stop_pos; UNICODE_STRING nt_name; ANSI_STRING unix_name; @@ -1693,9 +1693,8 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; } - strcpyW( volumenameW, filename ); - /* forward slash backslash replace */ - for (fwdslash = volumenameW; *fwdslash; fwdslash++) if (*fwdslash == '/') *fwdslash = '\'; + GetFullPathNameW(filename, MAX_PATH, bufferW, &lastpartW); + strcpyW( volumenameW, bufferW ); stop_pos = 0; /* stop searching slashes early for NT-type and nearly NT-type paths */ if (strncmpW(ntprefixW, filename, strlenW(ntprefixW)) == 0)
Fixes https://bugs.winehq.org/show_bug.cgi?id=42446
v2 breaks tests, revert to v1 or don't use v2. GetVolumePathNameW is causing some incompatibity problems with some Windows applications such as Native Instruments "Native Access" because of an inability to handle path names containing forward slash's whereas the Windows GetVolumePathName's behaviour handles path names with both forward and back slash's.
Tested on Debian Stretch and Windows Vista
Signed-off-by: Mark White markau0@lycos.com --- dlls/kernel32/volume.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index c5a38e44a8..ac887b2f3f 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1670,7 +1670,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu WCHAR fallbackpathW[] = { 'C',':','\',0 }; NTSTATUS status = STATUS_SUCCESS; WCHAR *volumenameW = NULL, *c; - WCHAR bufferW[MAX_PATH], *lastpartW = NULL; + WCHAR *fwdslash; int pos, last_pos, stop_pos; UNICODE_STRING nt_name; ANSI_STRING unix_name; @@ -1693,8 +1693,9 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; } - GetFullPathNameW(filename, MAX_PATH, bufferW, &lastpartW); - strcpyW( volumenameW, bufferW ); + strcpyW( volumenameW, filename ); + /* forward slash backslash replace */ + for (fwdslash = volumenameW; *fwdslash; fwdslash++) if (*fwdslash == '/') *fwdslash = '\'; stop_pos = 0; /* stop searching slashes early for NT-type and nearly NT-type paths */ if (strncmpW(ntprefixW, filename, strlenW(ntprefixW)) == 0)
On Mon, Mar 12, 2018 at 11:18:15AM -0400, Mark White wrote:
From: Mark White chopinbig2@gmail.com
Fixes https://bugs.winehq.org/show_bug.cgi?id=42446
GetVolumePathNameW is causing some incompatibity problems with some Windows applications such as Native Instruments "Native Access" because of an inability to handle path names containing forward slash's whereas the Windows GetVolumePathName's behaviour handles path names with both forward and back slash's.
Hi Mark,
Thanks for your contribution. You need to rework this series into one patch. Currently it's three patches which essentially revert each other. It might be a good time to learn how to use git rebase -i (though there are other ways to achieve this in this case).
Also note that the plural of slash is slashes...
Huw.