Commit 1416b101 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

- Properly deformat keys written to the registry.

- Because directory mappings can change between the CostFinalize step and the InstallFiles step we need to do a final resolution of the target file name before installing.
parent 9e15a420
...@@ -3171,6 +3171,10 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -3171,6 +3171,10 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
if ((file->State == 1) || (file->State == 2)) if ((file->State == 1) || (file->State == 2))
{ {
LPWSTR p;
INT len;
MSICOMPONENT* comp = NULL;
TRACE("Installing %s\n",debugstr_w(file->File)); TRACE("Installing %s\n",debugstr_w(file->File));
rc = ready_media_for_file(package,file->Sequence,path_to_source, rc = ready_media_for_file(package,file->Sequence,path_to_source,
file->File); file->File);
...@@ -3189,6 +3193,19 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -3189,6 +3193,19 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
create_component_directory( package, file->ComponentIndex); create_component_directory( package, file->ComponentIndex);
/* recalculate file paths because things may have changed */
if (file->ComponentIndex >= 0)
comp = &package->components[file->ComponentIndex];
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
if (file->TargetPath)
HeapFree(GetProcessHeap(),0,file->TargetPath);
file->TargetPath = build_directory_name(2, p, file->FileName);
len = strlenW(path_to_source) + strlenW(file->File) + 2;
file->SourcePath = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
strcpyW(file->SourcePath, path_to_source); strcpyW(file->SourcePath, path_to_source);
strcatW(file->SourcePath, file->File); strcatW(file->SourcePath, file->File);
...@@ -3523,7 +3540,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) ...@@ -3523,7 +3540,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
LPSTR value_data = NULL; LPSTR value_data = NULL;
HKEY root_key, hkey; HKEY root_key, hkey;
DWORD type,size; DWORD type,size;
LPWSTR value, key, name, component; LPWSTR value, key, name, component, deformated;
LPCWSTR szRoot; LPCWSTR szRoot;
INT component_index; INT component_index;
MSIRECORD * uirow; MSIRECORD * uirow;
...@@ -3594,27 +3611,33 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) ...@@ -3594,27 +3611,33 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
goto next; goto next;
} }
size = strlenW(key) + strlenW(szRoot) + 1; deformat_string(package, key , &deformated);
size = strlenW(deformated) + strlenW(szRoot) + 1;
uikey = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR)); uikey = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR));
strcpyW(uikey,szRoot); strcpyW(uikey,szRoot);
strcatW(uikey,key); strcatW(uikey,deformated);
if (RegCreateKeyW( root_key, key, &hkey))
if (RegCreateKeyW( root_key, deformated, &hkey))
{ {
ERR("Could not create key %s\n",debugstr_w(key)); ERR("Could not create key %s\n",debugstr_w(deformated));
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
HeapFree(GetProcessHeap(),0,deformated);
goto next; goto next;
} }
HeapFree(GetProcessHeap(),0,deformated);
value = load_dynamic_stringW(row,5); value = load_dynamic_stringW(row,5);
value_data = parse_value(package, value, &type, &size); value_data = parse_value(package, value, &type, &size);
deformat_string(package, name, &deformated);
if (value_data) if (value_data)
{ {
TRACE("Setting value %s\n",debugstr_w(name)); TRACE("Setting value %s\n",debugstr_w(deformated));
RegSetValueExW(hkey, name, 0, type, value_data, size); RegSetValueExW(hkey, deformated, 0, type, value_data, size);
uirow = MSI_CreateRecord(3); uirow = MSI_CreateRecord(3);
MSI_RecordSetStringW(uirow,2,name); MSI_RecordSetStringW(uirow,2,deformated);
MSI_RecordSetStringW(uirow,1,uikey); MSI_RecordSetStringW(uirow,1,uikey);
if (type == REG_SZ) if (type == REG_SZ)
...@@ -3628,6 +3651,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) ...@@ -3628,6 +3651,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
HeapFree(GetProcessHeap(),0,value_data); HeapFree(GetProcessHeap(),0,value_data);
} }
HeapFree(GetProcessHeap(),0,value); HeapFree(GetProcessHeap(),0,value);
HeapFree(GetProcessHeap(),0,deformated);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
RegCloseKey(hkey); RegCloseKey(hkey);
......
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