Module: wine Branch: master Commit: 7620bb367ff5fa9f3e3f97c7ab794ceb0dfbb992 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7620bb367ff5fa9f3e3f97c7ab...
Author: James Hawkins jhawkins@codeweavers.com Date: Thu Oct 16 01:08:59 2008 -0500
msi: Append a backslash to the AppSearch registry path.
---
dlls/msi/appsearch.c | 54 +++++++++++++++++++++++++++++----------------- dlls/msi/tests/package.c | 5 +--- 2 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index 71ac3cf..b335946 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -743,20 +743,21 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig, LPCWSTR path, int depth, LPWSTR *appValue) { UINT rc; + LPWSTR val = NULL;
TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth, appValue); + if (ACTION_IsFullPath(path)) { if (sig->File) - rc = ACTION_RecurseSearchDirectory(package, appValue, sig, - path, depth); + rc = ACTION_RecurseSearchDirectory(package, &val, sig, path, depth); else { /* Recursively searching a directory makes no sense when the * directory to search is the thing you're trying to find. */ - rc = ACTION_CheckDirectory(package, path, appValue); + rc = ACTION_CheckDirectory(package, path, &val); } } else @@ -766,24 +767,37 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig, int i;
rc = ERROR_SUCCESS; - *appValue = NULL; - for (i = 0; rc == ERROR_SUCCESS && !*appValue && i < 26; i++) - if (drives & (1 << i)) - { - pathWithDrive[0] = 'A' + i; - if (GetDriveTypeW(pathWithDrive) == DRIVE_FIXED) - { - lstrcpynW(pathWithDrive + 3, path, - sizeof(pathWithDrive) / sizeof(pathWithDrive[0]) - 3); - if (sig->File) - rc = ACTION_RecurseSearchDirectory(package, appValue, - sig, pathWithDrive, depth); - else - rc = ACTION_CheckDirectory(package, pathWithDrive, - appValue); - } - } + for (i = 0; rc == ERROR_SUCCESS && !val && i < 26; i++) + { + if (!(drives & (1 << i))) + continue; + + pathWithDrive[0] = 'A' + i; + if (GetDriveTypeW(pathWithDrive) != DRIVE_FIXED) + continue; + + lstrcpynW(pathWithDrive + 3, path, + sizeof(pathWithDrive) / sizeof(pathWithDrive[0]) - 3); + + if (sig->File) + rc = ACTION_RecurseSearchDirectory(package, &val, sig, + pathWithDrive, depth); + else + rc = ACTION_CheckDirectory(package, pathWithDrive, &val); + } } + + if (val && val[lstrlenW(val) - 1] != '\') + { + val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR)); + if (!val) + rc = ERROR_OUTOFMEMORY; + else + PathAddBackslashW(val); + } + + *appValue = val; + TRACE("returning %d\n", rc); return rc; } diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 6bb68dc..b6b3a78 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -6379,10 +6379,7 @@ static void test_appsearch_reglocator(void) sprintf(path, "%s\", CURR_DIR); r = MsiGetPropertyA(hpkg, "SIGPROP13", 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, "SIGPROP14", prop, &size);