From c35856dd09b78abf8142d1cbc02baa20af4292b4 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 25 May 2010 12:19:02 +0200 Subject: [PATCH] msi: End the search for a directory signature if the parent cannot be found. --- dlls/msi/appsearch.c | 8 +++++--- dlls/msi/tests/package.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index 18b95ac7c2a..336bfcae0f8 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -929,7 +929,8 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU 'D','r','L','o','c','a','t','o','r',' ', 'w','h','e','r','e',' ', 'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0}; - LPWSTR parentName = NULL, parent = NULL; + LPWSTR parent = NULL; + LPCWSTR parentName; WCHAR path[MAX_PATH]; WCHAR expanded[MAX_PATH]; MSIRECORD *row; @@ -949,14 +950,15 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU } /* check whether parent is set */ - parentName = msi_dup_record_field(row,2); + parentName = MSI_RecordGetString(row, 2); if (parentName) { MSISIGNATURE parentSig; rc = ACTION_AppSearchSigName(package, parentName, &parentSig, &parent); ACTION_FreeSignature(&parentSig); - msi_free(parentName); + if (!parent) + return ERROR_SUCCESS; } sz = MAX_PATH; diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index ce15c66e588..d2514ce5a7f 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -8742,6 +8742,9 @@ static void test_appsearch_drlocator(void) r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = create_drlocator_table(hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -8800,6 +8803,18 @@ static void test_appsearch_drlocator(void) r = add_drlocator_entry(hdb, path); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = create_reglocator_table(hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* parent */ + r = add_reglocator_entry(hdb, "'NewSignature12', 2, 'htmlfile\\shell\\open\\nonexistent', '', 1"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* parent is in RegLocator, no path, depth 0, no signature */ + sprintf(path, "'NewSignature13', 'NewSignature12', '', 0"); + r = add_drlocator_entry(hdb, path); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = create_signature_table(hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -8906,6 +8921,12 @@ static void test_appsearch_drlocator(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); + size = MAX_PATH; + strcpy(path, "c:\\"); + r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!prop[0], "Expected \"\", got \"%s\"\n", prop); + DeleteFileA("FileName1"); DeleteFileA("FileName3.dll"); DeleteFileA("FileName4.dll");