msi: Use the quoted part of the registry value when searching for a file or directory.
This commit is contained in:
parent
6df69c6aaa
commit
03282df13d
|
@ -372,6 +372,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNAT
|
||||||
'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0};
|
'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0};
|
||||||
LPWSTR keyPath = NULL, valueName = NULL;
|
LPWSTR keyPath = NULL, valueName = NULL;
|
||||||
LPWSTR deformatted = NULL;
|
LPWSTR deformatted = NULL;
|
||||||
|
LPWSTR ptr = NULL, end;
|
||||||
int root, type;
|
int root, type;
|
||||||
HKEY rootKey, key = NULL;
|
HKEY rootKey, key = NULL;
|
||||||
DWORD sz = 0, regType;
|
DWORD sz = 0, regType;
|
||||||
|
@ -444,13 +445,18 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNAT
|
||||||
if (sz == 0)
|
if (sz == 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
if ((ptr = strchrW((LPWSTR)value, '"')) && (end = strchrW(++ptr, '"')))
|
||||||
|
*end = '\0';
|
||||||
|
else
|
||||||
|
ptr = (LPWSTR)value;
|
||||||
|
|
||||||
switch (type & 0x0f)
|
switch (type & 0x0f)
|
||||||
{
|
{
|
||||||
case msidbLocatorTypeDirectory:
|
case msidbLocatorTypeDirectory:
|
||||||
rc = ACTION_SearchDirectory(package, sig, (LPWSTR)value, 0, appValue);
|
rc = ACTION_SearchDirectory(package, sig, ptr, 0, appValue);
|
||||||
break;
|
break;
|
||||||
case msidbLocatorTypeFileName:
|
case msidbLocatorTypeFileName:
|
||||||
*appValue = app_search_file((LPWSTR)value, sig);
|
*appValue = app_search_file(ptr, sig);
|
||||||
break;
|
break;
|
||||||
case msidbLocatorTypeRawValue:
|
case msidbLocatorTypeRawValue:
|
||||||
ACTION_ConvertRegValue(regType, value, sz, appValue);
|
ACTION_ConvertRegValue(regType, value, sz, appValue);
|
||||||
|
|
|
@ -6254,6 +6254,14 @@ static void test_appsearch_reglocator(void)
|
||||||
(const BYTE *)path, lstrlenA(path) + 1);
|
(const BYTE *)path, lstrlenA(path) + 1);
|
||||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
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();
|
hdb = create_package_db();
|
||||||
ok(hdb, "Expected a valid database handle\n");
|
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'");
|
r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
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);
|
r = create_reglocator_table(hdb);
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
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);
|
r = add_reglocator_entry(hdb, str);
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
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);
|
r = create_signature_table(hdb);
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
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);
|
r = add_signature_entry(hdb, str);
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
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);
|
hpkg = package_from_db(hdb);
|
||||||
ok(hpkg, "Expected a valid package handle\n");
|
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(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||||
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
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);
|
RegSetValueA(hklm, NULL, REG_SZ, "", 0);
|
||||||
RegDeleteValueA(hklm, "Value1");
|
RegDeleteValueA(hklm, "Value1");
|
||||||
RegDeleteValueA(hklm, "Value2");
|
RegDeleteValueA(hklm, "Value2");
|
||||||
|
@ -6708,6 +6751,8 @@ static void test_appsearch_reglocator(void)
|
||||||
RegDeleteValueA(hklm, "Value13");
|
RegDeleteValueA(hklm, "Value13");
|
||||||
RegDeleteValueA(hklm, "Value14");
|
RegDeleteValueA(hklm, "Value14");
|
||||||
RegDeleteValueA(hklm, "Value15");
|
RegDeleteValueA(hklm, "Value15");
|
||||||
|
RegDeleteValueA(hklm, "Value16");
|
||||||
|
RegDeleteValueA(hklm, "Value17");
|
||||||
RegDeleteKeyA(hklm, "");
|
RegDeleteKeyA(hklm, "");
|
||||||
RegCloseKey(hklm);
|
RegCloseKey(hklm);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue