James Hawkins : msi: Only append a backslash to directories.

Alexandre Julliard julliard at winehq.org
Mon Oct 20 08:00:56 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Mon Oct 20 04:20:20 2008 -0500

msi: Only append a backslash to directories.

---

 dlls/msi/appsearch.c     |    5 ++++-
 dlls/msi/tests/package.c |   10 ++--------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index 55bc472..056cd24 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -837,6 +837,7 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
  LPCWSTR path, int depth, LPWSTR *appValue)
 {
     UINT rc;
+    DWORD attr;
     LPWSTR val = NULL;
 
     TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth,
@@ -881,7 +882,9 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
         }
     }
 
-    if (val && val[lstrlenW(val) - 1] != '\\')
+    attr = GetFileAttributesW(val);
+    if ((attr & FILE_ATTRIBUTE_DIRECTORY) &&
+        val && val[lstrlenW(val) - 1] != '\\')
     {
         val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR));
         if (!val)
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 288e227..981c39e 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -7135,10 +7135,7 @@ static void test_appsearch_drlocator(void)
     sprintf(path, "%s\\FileName1", CURR_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    todo_wine
-    {
-        ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
-    }
+    ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
     sprintf(path, "%s\\", CURR_DIR);
@@ -7187,10 +7184,7 @@ static void test_appsearch_drlocator(void)
     sprintf(path, "%s\\FileName3.dll", CURR_DIR);
     r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    todo_wine
-    {
-        ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
-    }
+    ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
 
     size = MAX_PATH;
     r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);




More information about the wine-cvs mailing list