dlls/kernel32/volume
stephenmsmith at blueyonder.co.uk
stephenmsmith at blueyonder.co.uk
Mon Jul 19 15:59:08 CDT 2010
From: Stephen M Smith <stephenmsmith at blueyonder.co.uk>
This makes the checks on absent trailing \ in GetVolumeNameForVolumeMountPoint
more specific and match windows behaviour.
If root is C: then current working directory must be C:\ if
Windows is on C: to succeed D: etc will succeed for any working dir.
Nasty edge case.
Allows wine to pass 3 additional and first in fix for bug 20887
Stephen M Smith
---
dlls/kernel32/tests/volume.c | 5 ++---
dlls/kernel32/volume.c | 13 ++++++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index b3b4429..13741ab 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -337,7 +337,6 @@ static void test_GetVolumeInformationA(void)
ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
ret = pGetVolumeInformationA(Root_Dir0, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len);
- todo_wine
ok(ret, "GetVolumeInformationA failed, last error %u\n", GetLastError());
/* check for error on no trailing \ when current dir is windows dir */
@@ -368,7 +367,7 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Dir2, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
- todo_wine ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH),
+ ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_Dir2, GetLastError());
/* try again with device name space */
@@ -376,7 +375,7 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Dir2, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
- todo_wine ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH),
+ ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_Dir2, GetLastError());
/* try again with a directory off the root - should generate error */
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 7596864..4908739 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -526,10 +526,17 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
}
else
{
- if (!root[0] || root[1] != ':' || root[lstrlenW(root)-1] != '\\' )
+ if (!isalphaW(root[0]) || root[1] != ':' || root[lstrlenW(root)-1] != '\\')
{
- SetLastError( ERROR_INVALID_NAME );
- return FALSE;
+ WCHAR curpath[MAX_PATH],winpath[MAX_PATH];
+ GetCurrentDirectoryW(MAX_PATH,curpath);
+ GetWindowsDirectoryW(winpath,MAX_PATH);
+
+ if(lstrlenW(curpath) > 3 && root[0] == winpath[0])
+ {
+ SetLastError( ERROR_INVALID_NAME );
+ return FALSE;
+ }
}
device[4] = root[0];
}
--
1.7.0.4
More information about the wine-patches
mailing list