GetVolumeInformationW no error on no trailing \ when current dir is root dir

Stephen M Smith stephenmsmith at blueyonder.co.uk
Tue Jul 20 09:32:14 CDT 2010


---
 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


--------------000806080801050303050308--




More information about the wine-devel mailing list