msi: Only append a backslash to directories.

This commit is contained in:
James Hawkins 2008-10-20 04:20:20 -05:00 committed by Alexandre Julliard
parent 7497f1ab5c
commit 4aca381ff7
2 changed files with 6 additions and 9 deletions

View File

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

View File

@ -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);