Commit 03282df1 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Use the quoted part of the registry value when searching for a file or directory.

parent 6df69c6a
......@@ -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);
......
......@@ -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);
......
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