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)