Properly handle -1 as a registry key root.

This commit is contained in:
Aric Stewart 2005-06-24 11:51:29 +00:00 committed by Alexandre Julliard
parent 9a9f4cdab5
commit 0713f098ec

View File

@ -1700,12 +1700,11 @@ static UINT ITERATE_CostFinalizeConditions(MSIRECORD *row, LPVOID param)
LPCWSTR Condition; LPCWSTR Condition;
Condition = MSI_RecordGetString(row,3); Condition = MSI_RecordGetString(row,3);
if (MSI_EvaluateConditionW(package,Condition) == if (MSI_EvaluateConditionW(package,Condition) == MSICONDITION_TRUE)
MSICONDITION_TRUE)
{ {
int level = MSI_RecordGetInteger(row,2); int level = MSI_RecordGetInteger(row,2);
TRACE("Reseting feature %s to level %i\n", TRACE("Reseting feature %s to level %i\n", debugstr_w(Feature),
debugstr_w(Feature), level); level);
package->features[feature_index].Level = level; package->features[feature_index].Level = level;
} }
} }
@ -1875,8 +1874,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
return SetFeatureStates(package); return SetFeatureStates(package);
} }
/* OK this value is "interpreted" and then formatted based on the /* OK this value is "interpreted" and then formatted based on the
first few characters */ first few characters */
static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type, static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
@ -2056,6 +2053,23 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
/* get the root key */ /* get the root key */
switch (root) switch (root)
{ {
case -1:
{
static const WCHAR szALLUSER[] = {'A','L','L','U','S','E','R','S',0};
LPWSTR all_users = load_dynamic_property(package, szALLUSER, NULL);
if (all_users && all_users[0] == '1')
{
root_key = HKEY_LOCAL_MACHINE;
szRoot = szHLM;
}
else
{
root_key = HKEY_CURRENT_USER;
szRoot = szHCU;
}
HeapFree(GetProcessHeap(),0,all_users);
}
break;
case 0: root_key = HKEY_CLASSES_ROOT; case 0: root_key = HKEY_CLASSES_ROOT;
szRoot = szHCR; szRoot = szHCR;
break; break;