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

This commit is contained in:
James Hawkins 2008-10-20 04:20:25 -05:00 committed by Alexandre Julliard
parent 4aca381ff7
commit 1fb22654e4
2 changed files with 21 additions and 11 deletions

View File

@ -731,15 +731,18 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
WIN32_FIND_DATAW findData;
UINT rc = ERROR_SUCCESS;
size_t dirLen = lstrlenW(dir), fileLen = lstrlenW(sig->File);
WCHAR subpath[MAX_PATH];
WCHAR *buf;
static const WCHAR dot[] = {'.',0};
static const WCHAR dotdot[] = {'.','.',0};
static const WCHAR starDotStarW[] = { '*','.','*',0 };
TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir),
debugstr_w(sig->File), depth);
if (depth < 0)
return ERROR_INVALID_PARAMETER;
return ERROR_SUCCESS;
*appValue = NULL;
/* 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,
FindClose(hFind);
}
if (rc == ERROR_SUCCESS && !*appValue && depth > 0)
if (rc == ERROR_SUCCESS && !*appValue)
{
lstrcpyW(buf, dir);
PathAddBackslashW(buf);
@ -781,18 +784,28 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
hFind = FindFirstFileW(buf, &findData);
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,
findData.cFileName,
depth - 1);
subpath, depth - 1);
}
while (rc == ERROR_SUCCESS && !*appValue &&
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)
rc = ACTION_RecurseSearchDirectory(package, appValue,
sig, findData.cFileName,
depth - 1);
sig, subpath, depth - 1);
}
FindClose(hFind);

View File

@ -7158,10 +7158,7 @@ static void test_appsearch_drlocator(void)
sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
r = MsiGetPropertyA(hpkg, "SIGPROP5", 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, "SIGPROP6", prop, &size);