mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to fix some of the issues with GetVolumePathName.
This commit is contained in:
parent
a118c9b4bd
commit
749bdd1781
@ -345,6 +345,7 @@ kernel32-GetVolumePathName.ok:
|
||||
$(call APPLY_FILE,kernel32-GetVolumePathName/0002-kernel32-Convert-GetVolumePathName-tests-into-a-list.patch)
|
||||
$(call APPLY_FILE,kernel32-GetVolumePathName/0003-kernel32-Add-a-bunch-more-GetVolumePathName-tests.patch)
|
||||
$(call APPLY_FILE,kernel32-GetVolumePathName/0004-kernel32-tests-Add-a-lot-of-picky-GetVolumePathName-.patch)
|
||||
$(call APPLY_FILE,kernel32-GetVolumePathName/0005-kernel32-Fix-some-of-the-issues-in-GetVolumePathName.patch)
|
||||
@( \
|
||||
echo '+ { "kernel32-GetVolumePathName", "Erich E. Hoover", "Implement GetVolumePathName." },'; \
|
||||
) > kernel32-GetVolumePathName.ok
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 0212da21b4edcceee7b3907f3da39c9c2b815621 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 2 Sep 2014 05:36:15 +0200
|
||||
Subject: kernel32: Fix some of the issues in GetVolumePathNameW.
|
||||
|
||||
---
|
||||
dlls/kernel32/volume.c | 17 ++++++-----------
|
||||
1 file changed, 6 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
|
||||
index b723e9c..3c29901 100644
|
||||
--- a/dlls/kernel32/volume.c
|
||||
+++ b/dlls/kernel32/volume.c
|
||||
@@ -1886,7 +1886,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
if (filename[0] != '\\')
|
||||
{
|
||||
/* DOS-style paths revert to C:\ (anything not beginning with a slash) */
|
||||
- last_pos = strlenW(fallbackpathW);
|
||||
+ last_pos = strlenW(fallbackpathW) - 1; /* points to \\ */
|
||||
filename = fallbackpathW;
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1898,18 +1898,13 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
|
||||
}
|
||||
}
|
||||
|
||||
- /* include the terminating backslash unless returning the full path */
|
||||
- if (filename[last_pos] != '\0')
|
||||
- last_pos++;
|
||||
- /* require room to NULL terminate the string */
|
||||
- if ((filename[last_pos] == '\\' && last_pos * sizeof(WCHAR) <= buflen)
|
||||
- || (last_pos+1) * sizeof(WCHAR) <= buflen)
|
||||
+ if (last_pos + 1 <= buflen)
|
||||
{
|
||||
- memcpy(volumepathname, filename, last_pos*sizeof(WCHAR));
|
||||
- /* remove the terminating backslash if the buffer is one byte short */
|
||||
- if (filename[last_pos] == '\\' && (last_pos+1) * sizeof(WCHAR) > buflen)
|
||||
- last_pos--;
|
||||
+ WCHAR *p;
|
||||
+ memcpy(volumepathname, filename, last_pos * sizeof(WCHAR));
|
||||
+ if (last_pos + 2 <= buflen) volumepathname[last_pos++] = '\\';
|
||||
volumepathname[last_pos] = '\0';
|
||||
+ for (p = volumepathname; *p; p++) if (*p == '/') *p = '\\';
|
||||
}
|
||||
else
|
||||
status = STATUS_NAME_TOO_LONG;
|
||||
--
|
||||
2.1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user