James Hawkins : msi: Use the quoted part of the registry value when searching for a file or directory .
Alexandre Julliard
julliard at winehq.org
Mon Oct 20 08:00:58 CDT 2008
Module: wine
Branch: master
Commit: 03282df13d69a11f0922f3691dbaa76802a61c75
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03282df13d69a11f0922f3691dbaa76802a61c75
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Mon Oct 20 04:20:46 2008 -0500
msi: Use the quoted part of the registry value when searching for a file or directory.
---
dlls/msi/appsearch.c | 10 ++++++++--
dlls/msi/tests/package.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index 1679d80..5f40ada 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -372,6 +372,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNAT
'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0};
LPWSTR keyPath = NULL, valueName = NULL;
LPWSTR deformatted = NULL;
+ LPWSTR ptr = NULL, end;
int root, type;
HKEY rootKey, key = NULL;
DWORD sz = 0, regType;
@@ -444,13 +445,18 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNAT
if (sz == 0)
goto end;
+ if ((ptr = strchrW((LPWSTR)value, '"')) && (end = strchrW(++ptr, '"')))
+ *end = '\0';
+ else
+ ptr = (LPWSTR)value;
+
switch (type & 0x0f)
{
case msidbLocatorTypeDirectory:
- rc = ACTION_SearchDirectory(package, sig, (LPWSTR)value, 0, appValue);
+ rc = ACTION_SearchDirectory(package, sig, ptr, 0, appValue);
break;
case msidbLocatorTypeFileName:
- *appValue = app_search_file((LPWSTR)value, sig);
+ *appValue = app_search_file(ptr, sig);
break;
case msidbLocatorTypeRawValue:
ACTION_ConvertRegValue(regType, value, sz, appValue);
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 0e7a821..0f002a2 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -6254,6 +6254,14 @@ static void test_appsearch_reglocator(void)
(const BYTE *)path, lstrlenA(path) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
+ sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
+ res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+
+ sprintf(path, "%s\\FileName1 -option", CURR_DIR);
+ res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
+ (const BYTE *)path, lstrlenA(path) + 1);
+
hdb = create_package_db();
ok(hdb, "Expected a valid database handle\n");
@@ -6344,6 +6352,12 @@ static void test_appsearch_reglocator(void)
r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
+ 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);
@@ -6487,6 +6501,16 @@ static void test_appsearch_reglocator(void)
r = add_reglocator_entry(hdb, str);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
+ str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
+ r = add_reglocator_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
+ str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
+ r = add_reglocator_entry(hdb, str);
+ 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);
@@ -6523,6 +6547,14 @@ static void test_appsearch_reglocator(void)
r = add_signature_entry(hdb, str);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
+ r = add_signature_entry(hdb, str);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
hpkg = package_from_db(hdb);
ok(hpkg, "Expected a valid package handle\n");
@@ -6692,6 +6724,17 @@ static void test_appsearch_reglocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+ size = MAX_PATH;
+ sprintf(path, "%s\\FileName1", CURR_DIR);
+ r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
+
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
+
RegSetValueA(hklm, NULL, REG_SZ, "", 0);
RegDeleteValueA(hklm, "Value1");
RegDeleteValueA(hklm, "Value2");
@@ -6708,6 +6751,8 @@ static void test_appsearch_reglocator(void)
RegDeleteValueA(hklm, "Value13");
RegDeleteValueA(hklm, "Value14");
RegDeleteValueA(hklm, "Value15");
+ RegDeleteValueA(hklm, "Value16");
+ RegDeleteValueA(hklm, "Value17");
RegDeleteKeyA(hklm, "");
RegCloseKey(hklm);
More information about the wine-cvs
mailing list