msi/tests: Fix package test when run on a different drive than C:\.

Nicolas Le Cam niko.lecam at gmail.com
Mon Apr 20 19:38:23 CDT 2009


---
 dlls/msi/tests/package.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 822667c..691433e 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -8562,7 +8562,7 @@ static void test_appsearch_drlocator(void)
     CHAR prop[MAX_PATH];
     BOOL version;
     LPCSTR str;
-    DWORD size, drives;
+    DWORD size, drives, attr;
     UINT r, i;
 
     version = TRUE;
@@ -8732,7 +8732,27 @@ static void test_appsearch_drlocator(void)
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    drives = GetLogicalDrives();
+    lstrcpyA(path, "A:\\");
+    for (i = 0; i < 26; path[0] = '\0', i++)
+    {
+        if (!(drives & (1 << i)))
+            continue;
+
+        path[0] = 'A' + i;
+        if (GetDriveType(path) != DRIVE_FIXED)
+            continue;
+
+        lstrcatA(path + 3, CURR_DIR + 3);
+        attr = GetFileAttributesA(path);
+        if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
+        {
+            if (path[lstrlenA(path)-1] != '\\')
+                lstrcatA(path, "\\");
+            break;
+        }
+        path[3] = '\0';
+    }
     r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
-- 
1.6.0.4


--=-1PfItE3qLFWcr6v0dEGj--




More information about the wine-patches mailing list