[4/4] (Try2) msi/tests: Fix package test when run on a different drive than C:\.

Nicolas Le Cam niko.lecam at gmail.com
Wed Apr 22 14:05:47 CDT 2009


Try2: Use helper function added in second patch, as suggested by James.

This one finally fixes current relative path test to expect correct
value.

--
Nicolas Le Cam
-------------- next part --------------
>From af958ca5bd236d80701e8f0d3da6e919b03b59c7 Mon Sep 17 00:00:00 2001
From: Nicolas Le Cam <niko.lecam at gmail.com>
Date: Tue, 21 Apr 2009 02:38:23 +0200
Subject: msi/tests: Fix package test when run on a different drive than C:\.

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



More information about the wine-patches mailing list