msi: Check HKLM/Software/Classes/Installer/Components path while looking for components.

This commit is contained in:
Piotr Caban 2015-09-09 09:55:35 +02:00 committed by Alexandre Julliard
parent b3cb1e4d40
commit e8f4fea5a0
2 changed files with 51 additions and 2 deletions

View File

@ -173,6 +173,10 @@ static const WCHAR szUserComponents[] = {
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'I','n','s','t','a','l','l','e','r','\\','C','o','m','p','o','n','e','n','t','s','\\',0};
static const WCHAR szInstaller_Components[] = {
'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\',
'I','n','s','t','a','l','l','e','r','\\','C','o','m','p','o','n','e','n','t','s','\\',0};
static const WCHAR szUserFeatures[] = {
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\',0};
@ -650,6 +654,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
{
WCHAR squished_cc[GUID_SIZE], keypath[0x200];
UINT ret;
if (!squash_guid(szComponent, squished_cc)) return ERROR_FUNCTION_FAILED;
TRACE("%s squished %s\n", debugstr_w(szComponent), debugstr_w(squished_cc));
@ -658,7 +663,12 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
strcatW(keypath, squished_cc);
if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
ret = RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
if (ret != ERROR_FILE_NOT_FOUND) return ret;
strcpyW(keypath, szInstaller_Components);
strcatW(keypath, squished_cc);
return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)

View File

@ -5854,10 +5854,14 @@ static void test_publish_components(void)
{
static const char keypath[] =
"Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
static const char keypath2[] =
"Software\\Classes\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
UINT r;
LONG res;
HKEY key;
BYTE *data;
DWORD size;
if (is_process_limited())
{
@ -5879,11 +5883,46 @@ static void test_publish_components(void)
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
size = 0;
r = MsiProvideQualifiedComponentA("{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}",
"english.txt", INSTALLMODE_DEFAULT, NULL, &size);
ok(r == ERROR_SUCCESS, "MsiProvideQualifiedCompontent returned %d\n", r);
res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, &size);
ok(res == ERROR_SUCCESS, "value not found %d\n", res);
data = HeapAlloc(GetProcessHeap(), 0, size);
res = RegQueryValueExA(key, "english.txt", NULL, NULL, data, &size);
ok(res == ERROR_SUCCESS, "value not found %d\n", res);
RegCloseKey(key);
res = RegDeleteKeyA(HKEY_CURRENT_USER, keypath);
ok(res == ERROR_SUCCESS, "RegDeleteKey failed %d\n", res);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath2, &key);
ok(res == ERROR_SUCCESS, "RegCreateKey failed %d\n", res);
res = RegSetValueExA(key, "english.txt", 0, REG_MULTI_SZ, data, size);
ok(res == ERROR_SUCCESS, "RegSetValueEx failed %d\n", res);
RegCloseKey(key);
size = 0;
r = MsiProvideQualifiedComponentA("{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}",
"english.txt", INSTALLMODE_DEFAULT, NULL, &size);
ok(r == ERROR_SUCCESS, "MsiProvideQualifiedCompontent returned %d\n", r);
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, keypath2);
ok(res == ERROR_SUCCESS, "RegDeleteKey failed %d\n", res);
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &key);
ok(res == ERROR_SUCCESS, "RegCreateKey failed %d\n", res);
res = RegSetValueExA(key, "english.txt", 0, REG_MULTI_SZ, data, size);
ok(res == ERROR_SUCCESS, "RegSetValueEx failed %d\n", res);
HeapFree(GetProcessHeap(), 0, data);
RegCloseKey(key);
r = MsiInstallProductA(msifile, "REMOVE=ALL");