[4/4] (Try4) msi/tests: Fix package test when run on root drive directory.

Nicolas Le Cam niko.lecam at gmail.com
Sun Apr 12 17:09:32 CDT 2009


James,

Here are updated patches for part 3 & 4 of my previous patch set. Tell
me if you think I could submit them to wine-patches.

For patch 3, the only todo_wine is when launched from root drive dir
as explained in my previous mail.
For patch 4, I skip a test if test is executed on root drive dir, as
it doesn't make sense to execute it in this case.

If needed I can remove the skip and change expected value to be first
fixed drive when test is run on root drive dir. But this is already
tested by patch 3 (when run on a root drive dir).

-- 
Nicolas Le Cam
-------------- next part --------------
From 5ffbc8a513d97c0c7c488b4dc692c7aab8e728f9 Mon Sep 17 00:00:00 2001
From: Nicolas Le Cam <niko.lecam at gmail.com>
Date: Sun, 12 Apr 2009 23:50:36 +0200
Subject: msi/tests: Fix test when run on a different drive than C:\.

---
 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
-------------- next part --------------
From 16ab3f313dcdacfe954c75e9f1d4ae519f7bfc7b Mon Sep 17 00:00:00 2001
From: Nicolas Le Cam <niko.lecam at gmail.com>
Date: Sun, 12 Apr 2009 23:51:23 +0200
Subject: msi/tests: Fix package test when run on root drive directory.

---
 dlls/msi/tests/package.c |  157 +++++++++++++++++++++++-----------------------
 1 files changed, 78 insertions(+), 79 deletions(-)

diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 2825e41..63eee56 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -31,6 +31,8 @@
 
 static const char msifile[] = "winetest.msi";
 char CURR_DIR[MAX_PATH];
+char FULL_DIR[MAX_PATH];
+DWORD DIR_LEN;
 
 static void get_user_sid(LPSTR *usersid)
 {
@@ -220,8 +222,7 @@ static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
 
     RegCreateKeyA(HKEY_LOCAL_MACHINE, comppath, &hkey);
 
-    lstrcpyA(path, CURR_DIR);
-    lstrcatA(path, "\\");
+    lstrcpyA(path, FULL_DIR);
     if (!dir) lstrcatA(path, filename);
 
     RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
@@ -7512,43 +7513,43 @@ static void test_appsearch_complocator(void)
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName2", CURR_DIR);
+    sprintf(path, "%sFileName2", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName3", CURR_DIR);
+    sprintf(path, "%sFileName3", FULL_DIR);
     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);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName4", CURR_DIR);
+    sprintf(path, "%sFileName4", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName5", CURR_DIR);
+    sprintf(path, "%sFileName5", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -7564,7 +7565,7 @@ static void test_appsearch_complocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName8.dll", CURR_DIR);
+    sprintf(path, "%sFileName8.dll", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -7575,7 +7576,7 @@ static void test_appsearch_complocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName10.dll", CURR_DIR);
+    sprintf(path, "%sFileName10.dll", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -7708,12 +7709,12 @@ static void test_appsearch_reglocator(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     create_test_file("FileName1");
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
-    sprintf(path, "%s\\FileName2", CURR_DIR);
+    sprintf(path, "%sFileName2", FULL_DIR);
     res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -7728,29 +7729,29 @@ static void test_appsearch_reglocator(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
-    sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+    sprintf(path, "%sFileName3.dll", FULL_DIR);
     res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
-    sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+    sprintf(path, "%sFileName4.dll", FULL_DIR);
     res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
-    sprintf(path, "%s\\FileName5.dll", CURR_DIR);
+    sprintf(path, "%sFileName5.dll", FULL_DIR);
     res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
-    sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
+    sprintf(path, "\"%sFileName1\" -option", FULL_DIR);
     res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
 
-    space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
-    sprintf(path, "%s\\FileName1 -option", CURR_DIR);
+    space = (strchr(FULL_DIR, ' ')) ? TRUE : FALSE;
+    sprintf(path, "%sFileName1 -option", FULL_DIR);
     res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
                          (const BYTE *)path, lstrlenA(path) + 1);
 
@@ -8030,10 +8031,15 @@ static void test_appsearch_reglocator(void)
     r = add_signature_entry(hdb, str);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    ptr = strrchr(CURR_DIR, '\\') + 1;
-    sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
-    r = add_signature_entry(hdb, path);
-    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+    if (DIR_LEN > 3)
+    {
+        ptr = strrchr(CURR_DIR, '\\') + 1;
+        sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
+        r = add_signature_entry(hdb, path);
+        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+    }
+    else
+        skip("Running on a root drive directory.\n");
 
     str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
     r = add_signature_entry(hdb, str);
@@ -8120,7 +8126,7 @@ static void test_appsearch_reglocator(void)
        "Expected \"##regszdata\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8131,7 +8137,7 @@ static void test_appsearch_reglocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8142,7 +8148,7 @@ static void test_appsearch_reglocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8192,7 +8198,7 @@ static void test_appsearch_reglocator(void)
     if (version)
     {
         size = MAX_PATH;
-        sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+        sprintf(path, "%sFileName3.dll", FULL_DIR);
         r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8203,7 +8209,7 @@ static void test_appsearch_reglocator(void)
         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
         size = MAX_PATH;
-        sprintf(path, "%s\\FileName5.dll", CURR_DIR);
+        sprintf(path, "%sFileName5.dll", FULL_DIR);
         r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8218,15 +8224,18 @@ static void test_appsearch_reglocator(void)
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
-    size = MAX_PATH;
-    r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
-    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+    if (DIR_LEN > 3)
+    {
+        size = MAX_PATH;
+        r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
+        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+        ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+    }
 
     size = MAX_PATH;
     r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
@@ -8239,13 +8248,13 @@ static void test_appsearch_reglocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     if (space)
@@ -8325,24 +8334,24 @@ static void test_appsearch_inilocator(void)
     WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
 
     create_test_file("FileName1");
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
 
     WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
 
-    sprintf(path, "%s\\IDontExist", CURR_DIR);
+    sprintf(path, "%sIDontExist", FULL_DIR);
     WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
 
     create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
-    sprintf(path, "%s\\FileName2.dll", CURR_DIR);
+    sprintf(path, "%sFileName2.dll", FULL_DIR);
     WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
 
     create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
-    sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+    sprintf(path, "%sFileName3.dll", FULL_DIR);
     WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
 
     create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
-    sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+    sprintf(path, "%sFileName4.dll", FULL_DIR);
     WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
 
     hdb = create_package_db();
@@ -8491,7 +8500,7 @@ static void test_appsearch_inilocator(void)
        "Expected \"keydata,field2\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8502,13 +8511,13 @@ static void test_appsearch_inilocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8529,7 +8538,7 @@ static void test_appsearch_inilocator(void)
     if (version)
     {
         size = MAX_PATH;
-        sprintf(path, "%s\\FileName2.dll", CURR_DIR);
+        sprintf(path, "%sFileName2.dll", FULL_DIR);
         r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8540,7 +8549,7 @@ static void test_appsearch_inilocator(void)
         ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
         size = MAX_PATH;
-        sprintf(path, "%s\\FileName4.dll", CURR_DIR);
+        sprintf(path, "%sFileName4.dll", FULL_DIR);
         r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8712,13 +8721,13 @@ static void test_appsearch_drlocator(void)
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\FileName1", CURR_DIR);
+    sprintf(path, "%sFileName1", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\", CURR_DIR);
+    lstrcpyA(path, FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8736,22 +8745,19 @@ static void test_appsearch_drlocator(void)
         if (GetDriveType(path) != DRIVE_FIXED)
             continue;
 
-        if (!CURR_DIR[3])
+        if (DIR_LEN == 3)
             break;
 
-        lstrcatA(path + 3, CURR_DIR + 3);
+        lstrcatA(path + 3, FULL_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);
-    if (CURR_DIR[3])
+    if (DIR_LEN > 3)
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
     else
         todo_wine
@@ -8763,7 +8769,7 @@ static void test_appsearch_drlocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
+    sprintf(path, "%sone\\two\\three\\FileName2", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8774,7 +8780,7 @@ static void test_appsearch_drlocator(void)
     ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
 
     size = MAX_PATH;
-    sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
+    sprintf(path, "%sone\\two\\three\\FileName2", FULL_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -8782,7 +8788,7 @@ static void test_appsearch_drlocator(void)
     if (version)
     {
         size = MAX_PATH;
-        sprintf(path, "%s\\FileName3.dll", CURR_DIR);
+        sprintf(path, "%sFileName3.dll", FULL_DIR);
         r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
         ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
@@ -9225,8 +9231,7 @@ static void test_installprops(void)
     int res;
     UINT r;
 
-    GetCurrentDirectory(MAX_PATH, path);
-    lstrcat(path, "\\");
+    lstrcpy(path, FULL_DIR);
     lstrcat(path, msifile);
 
     hdb = create_package_db();
@@ -9614,8 +9619,8 @@ static void test_complocator(void)
     r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    lstrcpyA(expected, CURR_DIR);
-    lstrcatA(expected, "\\abelisaurus");
+    lstrcpyA(expected, FULL_DIR);
+    lstrcatA(expected, "abelisaurus");
     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
        "Expected %s or empty string, got %s\n", expected, prop);
 
@@ -9638,8 +9643,7 @@ static void test_complocator(void)
     r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    lstrcpyA(expected, CURR_DIR);
-    lstrcatA(expected, "\\");
+    lstrcpyA(expected, FULL_DIR);
     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
        "Expected %s or empty string, got %s\n", expected, prop);
 
@@ -9682,8 +9686,7 @@ static void test_complocator(void)
     r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    lstrcpyA(expected, CURR_DIR);
-    lstrcatA(expected, "\\");
+    lstrcpyA(expected, FULL_DIR);
     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
        "Expected %s or empty string, got %s\n", expected, prop);
 
@@ -9691,8 +9694,8 @@ static void test_complocator(void)
     r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    lstrcpyA(expected, CURR_DIR);
-    lstrcatA(expected, "\\neosodon\\");
+    lstrcpyA(expected, FULL_DIR);
+    lstrcatA(expected, "neosodon\\");
     ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
        "Expected %s or empty string, got %s\n", expected, prop);
 
@@ -9769,8 +9772,7 @@ static void test_MsiGetSourcePath(void)
     DWORD size;
     UINT r;
 
-    lstrcpyA(cwd, CURR_DIR);
-    lstrcatA(cwd, "\\");
+    lstrcpyA(cwd, FULL_DIR);
 
     lstrcpyA(subsrc, cwd);
     lstrcatA(subsrc, "subsource");
@@ -10205,8 +10207,7 @@ static void test_shortlongsource(void)
     DWORD size;
     UINT r;
 
-    lstrcpyA(cwd, CURR_DIR);
-    lstrcatA(cwd, "\\");
+    lstrcpyA(cwd, FULL_DIR);
 
     lstrcpyA(subsrc, cwd);
     lstrcatA(subsrc, "long");
@@ -10540,8 +10541,7 @@ static void test_sourcedir(void)
     DWORD size;
     UINT r;
 
-    lstrcpyA(cwd, CURR_DIR);
-    lstrcatA(cwd, "\\");
+    lstrcpyA(cwd, FULL_DIR);
 
     lstrcpyA(subsrc, cwd);
     lstrcatA(subsrc, "long");
@@ -11178,7 +11178,6 @@ static void test_MsiGetProductProperty(void)
 {
     MSIHANDLE hprod, hdb;
     CHAR val[MAX_PATH];
-    CHAR path[MAX_PATH];
     CHAR query[MAX_PATH];
     CHAR keypath[MAX_PATH*2];
     CHAR prodcode[MAX_PATH];
@@ -11198,9 +11197,6 @@ static void test_MsiGetProductProperty(void)
     }
     CloseServiceHandle(scm);
 
-    GetCurrentDirectoryA(MAX_PATH, path);
-    lstrcatA(path, "\\");
-
     create_test_guid(prodcode, prod_squashed);
     get_user_sid(&usersid);
 
@@ -11262,8 +11258,8 @@ static void test_MsiGetProductProperty(void)
     res = RegCreateKeyA(userkey, "InstallProperties", &props);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
-    lstrcpyA(val, path);
-    lstrcatA(val, "\\winetest.msi");
+    lstrcpyA(val, FULL_DIR);
+    lstrcatA(val, "winetest.msi");
     res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
                          (const BYTE *)val, lstrlenA(val) + 1);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -11513,7 +11509,10 @@ static void test_MsiSetProperty(void)
 
 START_TEST(package)
 {
-    GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
+    DIR_LEN = GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
+    lstrcpyA(FULL_DIR, CURR_DIR);
+    if (DIR_LEN > 3)
+        lstrcatA(FULL_DIR, "\\");
 
     test_createpackage();
     test_doaction();
-- 
1.6.0.4


More information about the wine-devel mailing list