Alexandre Julliard : kernel32: Fix last error code in GetVolumeInformationW when an explicit subdir is requested .

Alexandre Julliard julliard at winehq.org
Wed Oct 20 13:24:37 CDT 2010


Module: wine
Branch: master
Commit: 14556047045a08a98442e7e44bffb7cff29e67de
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=14556047045a08a98442e7e44bffb7cff29e67de

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 20 12:29:45 2010 +0200

kernel32: Fix last error code in GetVolumeInformationW when an explicit subdir is requested.

---

 dlls/kernel32/tests/volume.c |    2 +-
 dlls/kernel32/volume.c       |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index c63dd72..482ff16 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -435,7 +435,7 @@ static void test_GetVolumeInformationA(void)
     SetLastError(0xdeadbeef);
     ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
             &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
-    todo_wine ok(!ret && (GetLastError()==ERROR_DIR_NOT_ROOT ||
+    ok(!ret && (GetLastError()==ERROR_DIR_NOT_ROOT ||
          broken(GetLastError()==ERROR_BAD_PATHNAME/* win9x */)),
           "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError());
     /* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index b65d67b..17e70e5 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -568,7 +568,13 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
     p = memchrW( nt_name.Buffer + 4, '\\', (nt_name.Length - 4) / sizeof(WCHAR) );
     if (p != nt_name.Buffer + nt_name.Length / sizeof(WCHAR) - 1)
     {
-        SetLastError( ERROR_INVALID_NAME );
+        /* check if root contains an explicit subdir */
+        if (root[0] && root[1] == ':') root += 2;
+        while (*root == '\\') root++;
+        if (strchrW( root, '\\' ))
+            SetLastError( ERROR_DIR_NOT_ROOT );
+        else
+            SetLastError( ERROR_INVALID_NAME );
         goto done;
     }
 




More information about the wine-cvs mailing list