diff --git a/patches/kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch b/patches/kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch index 3fc82278..2c0b8105 100644 --- a/patches/kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch +++ b/patches/kernel32-GetVolumePathName/0001-kernel32-Implement-GetVolumePathName.patch @@ -1,12 +1,12 @@ -From c8a873013240a0511789c5e9d38b8d1fab18658b Mon Sep 17 00:00:00 2001 +From 98c28e54799dc51257ec44389eac5384b2ddb609 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Sat, 25 Jan 2014 09:47:12 -0700 Subject: kernel32: Implement GetVolumePathName. --- - dlls/kernel32/tests/volume.c | 3 - - dlls/kernel32/volume.c | 132 +++++++++++++++++++++++++++++++++++++----- - 2 files changed, 116 insertions(+), 19 deletions(-) + dlls/kernel32/tests/volume.c | 3 - + dlls/kernel32/volume.c | 129 ++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 115 insertions(+), 17 deletions(-) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 61da509..4b3bdf5 100644 @@ -29,7 +29,7 @@ index 61da509..4b3bdf5 100644 /* test an invalid path */ diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c -index d396764..75bc20f 100644 +index d396764..b723e9c 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1786,7 +1786,7 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl @@ -41,7 +41,7 @@ index d396764..75bc20f 100644 if (filename && !(filenameW = FILE_name_AtoW( filename, FALSE ))) return FALSE; -@@ -1802,37 +1802,137 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl +@@ -1802,12 +1802,27 @@ BOOL WINAPI GetVolumePathNameA(LPCSTR filename, LPSTR volumepathname, DWORD bufl /*********************************************************************** * GetVolumePathNameW (KERNEL32.@) @@ -69,20 +69,21 @@ index d396764..75bc20f 100644 - FIXME("(%s, %p, %d), stub!\n", debugstr_w(filename), volumepathname, buflen); + TRACE("(%s, %p, %d)\n", debugstr_w(filename), volumepathname, buflen); -- if (!filename || !volumepathname || !buflen) -+ if (!filename || !volumepathname || buflen == 0) -+ { -+ SetLastError( ERROR_INVALID_PARAMETER ); -+ return FALSE; -+ } + if (!filename || !volumepathname || !buflen) + { +@@ -1815,24 +1830,110 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu + return FALSE; + } + +- if (p && tolowerW(p[0]) >= 'a' && tolowerW(p[0]) <= 'z' && p[1] ==':' && p[2] == '\\') + last_pos = pos = strlenW( filename ); + /* allocate enough memory for searching the path (need room for a slash and a NULL terminator) */ + if (!(volumenameW = HeapAlloc( GetProcessHeap(), 0, (pos + 2) * sizeof(WCHAR) ))) { -- SetLastError(ERROR_INVALID_PARAMETER); +- if (buflen < 4) + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - return FALSE; - } ++ return FALSE; ++ } + strcpyW( volumenameW, filename ); + stop_pos = 0; + /* stop searching slashes early for NT-type and nearly NT-type paths */ @@ -101,7 +102,9 @@ index d396764..75bc20f 100644 + status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); + RtlFreeUnicodeString( &nt_name ); + if (status == STATUS_SUCCESS) -+ { + { +- SetLastError(ERROR_FILENAME_EXCED_RANGE); +- return FALSE; + if (stat( unix_name.Buffer, &st ) != 0) + { + RtlFreeAnsiString( &unix_name ); @@ -125,16 +128,12 @@ index d396764..75bc20f 100644 + if (c != NULL) + pos = c-volumenameW; + } while (c != NULL && pos > stop_pos); - -- if (p && tolowerW(p[0]) >= 'a' && tolowerW(p[0]) <= 'z' && p[1] ==':' && p[2] == '\\') ++ + if (status != STATUS_SUCCESS) - { -- if (buflen < 4) ++ { + /* the path was completely invalid */ + if (filename[0] != '\\') - { -- SetLastError(ERROR_FILENAME_EXCED_RANGE); -- return FALSE; ++ { + /* DOS-style paths revert to C:\ (anything not beginning with a slash) */ + last_pos = strlenW(fallbackpathW); + filename = fallbackpathW; @@ -195,5 +194,5 @@ index d396764..75bc20f 100644 * GetVolumePathNamesForVolumeNameA (KERNEL32.@) */ -- -1.7.9.5 +2.1.0