On 20/07/10 14:54, Stephen Mark Smith wrote:
On 20/07/10 14:00, Alexandre Julliard wrote:
[email protected] writes:
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;
+ }
This clearly makes no sense, path syntax doesn't depend on the windows
directory.
I agree it makes no sense however it seems to match windows behavior,
results from my own vista box:
Current directory is C:\Users\Administrator\Documents\Visual Studio
2010\Projects\volumeandfiletests\Debug
GetVolumeInformation succeds with no trailing backslash for E:
Current directory is C:\
GetVolumeInformation succeds with no trailing backslash for C:
GetVolumeInformation succeds with no trailing backslash for E:
Current directory is E:\
GetVolumeInformation succeds with no trailing backslash for E:
Current directory is E:\data
moved executable off C: to see if it was using executables path not
windows path produces more confusing results:
Current directory is F:\
GetVolumeInformation succeds with no trailing backslash for E:
GetVolumeInformation succeds with no trailing backslash for F:
Current directory is C:\
GetVolumeInformation succeds with no trailing backslash for C:
GetVolumeInformation succeds with no trailing backslash for E:
GetVolumeInformation succeds with no trailing backslash for F:
Current directory is E:\
GetVolumeInformation succeds with no trailing backslash for E:
GetVolumeInformation succeds with no trailing backslash for F:
Current directory is E:\data
GetVolumeInformation succeds with no trailing backslash for F:
Attached simpler patch that does not error when CWD is a root dir passes
one additional test case this does not help bug 20887 and does not match
behavior above. My original patch does not cover second set of results
either.
Help greatly welcomed.
Stephen M Smith
>From 2f3b38e0d7f02352d07b4c14201808feba45b599 Mon Sep 17 00:00:00 2001
From: Stephen M Smith <[email protected]>
Date: Tue, 20 Jul 2010 15:32:14 +0100
Subject: GetVolumeInformationW no error on no trailing \ when current dir is
root dir
---
dlls/kernel32/tests/volume.c | 1 -
dlls/kernel32/volume.c | 12 +++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index b3b4429..4e5240c 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 */
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 7596864..3198421 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -526,10 +526,16 @@ 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];
+ GetCurrentDirectoryW(MAX_PATH,curpath);
+
+ if(lstrlenW(curpath) > 3)
+ {
+ SetLastError( ERROR_INVALID_NAME );
+ return FALSE;
+ }
}
device[4] = root[0];
}
--
1.7.0.4