msi/tests: Fix test when run on a different drive than C:\.
Nicolas Le Cam
niko.lecam at gmail.com
Sun Apr 12 16:50:36 CDT 2009
---
dlls/msi/tests/package.c | 36 ++++++++++++++++++++++++++++++++----
1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index c5c3b67..2825e41 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -8562,8 +8562,8 @@ static void test_appsearch_drlocator(void)
CHAR prop[MAX_PATH];
BOOL version;
LPCSTR str;
- DWORD size;
- UINT r;
+ DWORD size, drives, attr;
+ UINT r, i;
version = TRUE;
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
@@ -8724,10 +8724,38 @@ 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; i++)
+ {
+ if (!(drives & (1 << i)))
+ continue;
+
+ path[0] = 'A' + i;
+ path[3] = '\0';
+ if (GetDriveType(path) != DRIVE_FIXED)
+ continue;
+
+ if (!CURR_DIR[3])
+ break;
+
+ lstrcatA(path + 3, CURR_DIR + 3);
+ attr = GetFileAttributesA(path);
+ if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ lstrcatA(path, "\\");
+ break;
+ }
+ }
+ if (i >= 26)
+ path[0] = '\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);
+ if (CURR_DIR[3])
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+ else
+ todo_wine
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
--
1.6.0.4
--=-CjdyQJuRc08WEkfZ9HNq--
More information about the wine-patches
mailing list