Guy Albertelli : kernel32/tests: Add more tests for GetVolumeNameForVolumeMountPointA.

Alexandre Julliard julliard at winehq.org
Mon May 11 09:10:48 CDT 2009


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

Author: Guy Albertelli <galberte at neo.rr.com>
Date:   Fri May  8 23:57:05 2009 -0400

kernel32/tests: Add more tests for GetVolumeNameForVolumeMountPointA.

---

 dlls/kernel32/tests/volume.c |   48 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index 19fc6f0..498c2d8 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -114,7 +114,8 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
 {
     BOOL ret;
     char volume[MAX_PATH], path[] = "c:\\";
-    DWORD len = sizeof(volume);
+    DWORD len = sizeof(volume), reti;
+    char temp_path[MAX_PATH];
 
     /* not present before w2k */
     if (!pGetVolumeNameForVolumeMountPointA) {
@@ -122,6 +123,10 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
         return;
     }
 
+    reti = GetTempPathA(MAX_PATH, temp_path);
+    ok(reti != 0, "GetTempPathA error %d\n", GetLastError());
+    ok(reti < MAX_PATH, "temp path should fit into MAX_PATH\n");
+
     ret = pGetVolumeNameForVolumeMountPointA(path, volume, 0);
     ok(ret == FALSE, "GetVolumeNameForVolumeMountPointA succeeded\n");
 
@@ -135,6 +140,47 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
 
     ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
     ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
+    ok(!strncmp( volume, "\\\\?\\Volume{", 11),
+        "GetVolumeNameForVolumeMountPointA failed to return valid string <%s>\n",
+        volume);
+
+    /* test with too small buffer */
+    ret = pGetVolumeNameForVolumeMountPointA(path, volume, 10);
+todo_wine
+    ok(ret == FALSE && GetLastError() == ERROR_FILENAME_EXCED_RANGE,
+            "GetVolumeNameForVolumeMountPointA failed, wrong error returned, was %d, should be ERROR_FILENAME_EXCED_RANGE\n",
+             GetLastError());
+
+    /* Try on a arbitrary directory */
+    ret = pGetVolumeNameForVolumeMountPointA(temp_path, volume, len);
+todo_wine
+    ok(ret == FALSE && GetLastError() == ERROR_NOT_A_REPARSE_POINT,
+        "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+        temp_path, GetLastError());
+
+    /* Try on a non-existent dos drive */
+    path[2] = 0;
+    for (;path[0] <= 'z'; path[0]++) {
+        ret = QueryDosDeviceA( path, volume, len);
+        if(!ret) break;
+    }
+    if (path[0] <= 'z')
+    {
+        path[2] = '\\';
+        ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
+todo_wine
+        ok(ret == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND,
+            "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+            path, GetLastError());
+
+        /* Try without trailing \ and on a non-existent dos drive  */
+        path[2] = 0;
+        ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
+todo_wine
+        ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
+            "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
+            path, GetLastError());
+    }
 }
 
 static void test_GetVolumeNameForVolumeMountPointW(void)




More information about the wine-cvs mailing list