[PATCH v3 3/3] kernel32: Add forward slash path handling to GetVolumePathNameW revert to v1.
Mark White
markau0 at lycos.com
Mon Mar 12 10:18:17 CDT 2018
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 at 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)
--
2.11.0
More information about the wine-devel
mailing list