Commit 1fb22654 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Append the next directory to search to the current directory when recursing.

parent 4aca381f
...@@ -731,15 +731,18 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue, ...@@ -731,15 +731,18 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
WIN32_FIND_DATAW findData; WIN32_FIND_DATAW findData;
UINT rc = ERROR_SUCCESS; UINT rc = ERROR_SUCCESS;
size_t dirLen = lstrlenW(dir), fileLen = lstrlenW(sig->File); size_t dirLen = lstrlenW(dir), fileLen = lstrlenW(sig->File);
WCHAR subpath[MAX_PATH];
WCHAR *buf; WCHAR *buf;
static const WCHAR dot[] = {'.',0};
static const WCHAR dotdot[] = {'.','.',0};
static const WCHAR starDotStarW[] = { '*','.','*',0 }; static const WCHAR starDotStarW[] = { '*','.','*',0 };
TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir), TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir),
debugstr_w(sig->File), depth); debugstr_w(sig->File), depth);
if (depth < 0) if (depth < 0)
return ERROR_INVALID_PARAMETER; return ERROR_SUCCESS;
*appValue = NULL; *appValue = NULL;
/* We need the buffer in both paths below, so go ahead and allocate it /* We need the buffer in both paths below, so go ahead and allocate it
...@@ -772,7 +775,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue, ...@@ -772,7 +775,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
FindClose(hFind); FindClose(hFind);
} }
if (rc == ERROR_SUCCESS && !*appValue && depth > 0) if (rc == ERROR_SUCCESS && !*appValue)
{ {
lstrcpyW(buf, dir); lstrcpyW(buf, dir);
PathAddBackslashW(buf); PathAddBackslashW(buf);
...@@ -781,18 +784,28 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue, ...@@ -781,18 +784,28 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
hFind = FindFirstFileW(buf, &findData); hFind = FindFirstFileW(buf, &findData);
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
{ {
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
lstrcmpW(findData.cFileName, dot) &&
lstrcmpW(findData.cFileName, dotdot))
{
lstrcpyW(subpath, dir);
PathAppendW(subpath, findData.cFileName);
rc = ACTION_RecurseSearchDirectory(package, appValue, sig, rc = ACTION_RecurseSearchDirectory(package, appValue, sig,
findData.cFileName, subpath, depth - 1);
depth - 1); }
while (rc == ERROR_SUCCESS && !*appValue && while (rc == ERROR_SUCCESS && !*appValue &&
FindNextFileW(hFind, &findData) != 0) FindNextFileW(hFind, &findData) != 0)
{ {
if (!lstrcmpW(findData.cFileName, dot) ||
!lstrcmpW(findData.cFileName, dotdot))
continue;
lstrcpyW(subpath, dir);
PathAppendW(subpath, findData.cFileName);
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
rc = ACTION_RecurseSearchDirectory(package, appValue, rc = ACTION_RecurseSearchDirectory(package, appValue,
sig, findData.cFileName, sig, subpath, depth - 1);
depth - 1);
} }
FindClose(hFind); FindClose(hFind);
......
...@@ -7158,10 +7158,7 @@ static void test_appsearch_drlocator(void) ...@@ -7158,10 +7158,7 @@ static void test_appsearch_drlocator(void)
sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR); sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); 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; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment