Extending upon Mike McCormack's cleanup to use MSI_RecordGetString.

This commit is contained in:
Aric Stewart 2005-06-09 20:30:59 +00:00 committed by Alexandre Julliard
parent c28bb54f7a
commit 09b0abaa1c

View File

@ -1224,6 +1224,7 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
action = MSI_RecordGetString(row,1); action = MSI_RecordGetString(row,1);
if (!action) if (!action)
{ {
ERR("Error in retrieving action name\n");
rc = ERROR_FUNCTION_FAILED; rc = ERROR_FUNCTION_FAILED;
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
break; break;
@ -1236,9 +1237,9 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
/* this is a hack to skip errors in the condition code */ /* this is a hack to skip errors in the condition code */
if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE) if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE)
{ {
msiobj_release(&row->hdr);
TRACE("Skipping action: %s (condition is false)\n", TRACE("Skipping action: %s (condition is false)\n",
debugstr_w(action)); debugstr_w(action));
msiobj_release(&row->hdr);
continue; continue;
} }
} }
@ -1323,9 +1324,9 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
/* this is a hack to skip errors in the condition code */ /* this is a hack to skip errors in the condition code */
if (MSI_EvaluateConditionW(package,cond) == MSICONDITION_FALSE) if (MSI_EvaluateConditionW(package,cond) == MSICONDITION_FALSE)
{ {
msiobj_release(&row->hdr);
TRACE("Skipping action: %s (condition is false)\n", TRACE("Skipping action: %s (condition is false)\n",
debugstr_w(action)); debugstr_w(action));
msiobj_release(&row->hdr);
continue; continue;
} }
} }
@ -1814,8 +1815,7 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
static UINT load_file(MSIPACKAGE* package, MSIRECORD * row) static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
{ {
DWORD index = package->loaded_files; DWORD index = package->loaded_files;
DWORD i; LPCWSTR component;
LPWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -1829,18 +1829,13 @@ static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
memset(&package->files[index],0,sizeof(MSIFILE)); memset(&package->files[index],0,sizeof(MSIFILE));
package->files[index].File = load_dynamic_stringW(row, 1); package->files[index].File = load_dynamic_stringW(row, 1);
buffer = load_dynamic_stringW(row, 2);
package->files[index].ComponentIndex = -1; component = MSI_RecordGetString(row, 2);
for (i = 0; i < package->loaded_components; i++) package->files[index].ComponentIndex = get_loaded_component(package,
if (strcmpW(package->components[i].Component,buffer)==0) component);
{
package->files[index].ComponentIndex = i;
break;
}
if (package->files[index].ComponentIndex == -1) if (package->files[index].ComponentIndex == -1)
ERR("Unfound Component %s\n",debugstr_w(buffer)); ERR("Unfound Component %s\n",debugstr_w(component));
HeapFree(GetProcessHeap(), 0, buffer);
package->files[index].FileName = load_dynamic_stringW(row,3); package->files[index].FileName = load_dynamic_stringW(row,3);
reduce_to_longfilename(package->files[index].FileName); reduce_to_longfilename(package->files[index].FileName);
@ -2033,7 +2028,8 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
'W','H','E','R','E',' ', '`', 'D','i','r','e','c','t', 'o','r','y','`', 'W','H','E','R','E',' ', '`', 'D','i','r','e','c','t', 'o','r','y','`',
' ','=',' ','\'','%','s','\'', ' ','=',' ','\'','%','s','\'',
0}; 0};
LPWSTR ptargetdir, targetdir, parent, srcdir; LPWSTR ptargetdir, targetdir, srcdir;
LPCWSTR parent;
LPWSTR shortname = NULL; LPWSTR shortname = NULL;
MSIRECORD * row = 0; MSIRECORD * row = 0;
INT index = -1; INT index = -1;
@ -2119,7 +2115,7 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
HeapFree(GetProcessHeap(), 0, ptargetdir); HeapFree(GetProcessHeap(), 0, ptargetdir);
TRACE(" SourceDefault = %s\n",debugstr_w(package->folders[index].SourceDefault)); TRACE(" SourceDefault = %s\n",debugstr_w(package->folders[index].SourceDefault));
parent = load_dynamic_stringW(row,2); parent = MSI_RecordGetString(row,2);
if (parent) if (parent)
{ {
i = load_folder(package,parent); i = load_folder(package,parent);
@ -2131,7 +2127,6 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
} }
else else
package->folders[index].ParentIndex = -2; package->folders[index].ParentIndex = -2;
HeapFree(GetProcessHeap(), 0, parent);
package->folders[index].Property = load_dynamic_property(package, dir,NULL); package->folders[index].Property = load_dynamic_property(package, dir,NULL);
@ -2149,6 +2144,9 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
TRACE("Working to resolve %s\n",debugstr_w(name)); TRACE("Working to resolve %s\n",debugstr_w(name));
if (!name)
return NULL;
/* special resolving for Target and Source root dir */ /* special resolving for Target and Source root dir */
if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0) if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
{ {
@ -3366,19 +3364,13 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
} }
component = MSI_RecordGetString(row,2); component = MSI_RecordGetString(row,2);
if (!component)
{
ERR("Unable to get component\n");
msiobj_release(&row->hdr);
break;
}
component_index = get_loaded_component(package,component); component_index = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, component_index,
INSTALLSTATE_LOCAL)) INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping copy due to disabled component\n"); TRACE("Skipping copy due to disabled component %s\n",
debugstr_w(component));
/* the action taken was the same as the current install state */ /* the action taken was the same as the current install state */
package->components[component_index].Action = package->components[component_index].Action =
@ -3469,7 +3461,7 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *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, WCHAR *value, DWORD *type, static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
DWORD *size) DWORD *size)
{ {
LPSTR data = NULL; LPSTR data = NULL;
@ -3553,7 +3545,7 @@ static LPSTR parse_value(MSIPACKAGE *package, WCHAR *value, DWORD *type,
else else
{ {
static const WCHAR szMulti[] = {'[','~',']',0}; static const WCHAR szMulti[] = {'[','~',']',0};
WCHAR *ptr; LPCWSTR ptr;
*type=REG_SZ; *type=REG_SZ;
if (value[0]=='#') if (value[0]=='#')
@ -3621,8 +3613,8 @@ 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, deformated; LPWSTR deformated;
LPCWSTR szRoot; LPCWSTR szRoot, component, name, key, value;
INT component_index; INT component_index;
MSIRECORD * uirow; MSIRECORD * uirow;
LPWSTR uikey; LPWSTR uikey;
@ -3642,13 +3634,14 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
uikey = NULL; uikey = NULL;
name = NULL; name = NULL;
component = load_dynamic_stringW(row, 6); component = MSI_RecordGetString(row, 6);
component_index = get_loaded_component(package,component); component_index = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, component_index,
INSTALLSTATE_LOCAL)) INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping write due to disabled component\n"); TRACE("Skipping write due to disabled component %s\n",
debugstr_w(component));
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
package->components[component_index].Action = package->components[component_index].Action =
@ -3659,7 +3652,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
package->components[component_index].Action = INSTALLSTATE_LOCAL; package->components[component_index].Action = INSTALLSTATE_LOCAL;
name = load_dynamic_stringW(row, 4); name = MSI_RecordGetString(row, 4);
if( MSI_RecordIsNull(row,5) && name ) if( MSI_RecordIsNull(row,5) && name )
{ {
/* null values can have special meanings */ /* null values can have special meanings */
@ -3670,16 +3663,12 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
} }
else if ((name[0]=='+' && name[1] == 0) || else if ((name[0]=='+' && name[1] == 0) ||
(name[0] == '*' && name[1] == 0)) (name[0] == '*' && name[1] == 0))
{
HeapFree(GetProcessHeap(),0,name);
name = NULL; name = NULL;
check_first = TRUE; check_first = TRUE;
}
} }
root = MSI_RecordGetInteger(row,2); root = MSI_RecordGetInteger(row,2);
key = load_dynamic_stringW(row, 3); key = MSI_RecordGetString(row, 3);
/* get the root key */ /* get the root key */
switch (root) switch (root)
@ -3723,7 +3712,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
} }
HeapFree(GetProcessHeap(),0,deformated); HeapFree(GetProcessHeap(),0,deformated);
value = load_dynamic_stringW(row,5); value = MSI_RecordGetString(row,5);
if (value) if (value)
value_data = parse_value(package, value, &type, &size); value_data = parse_value(package, value, &type, &size);
else else
@ -3759,7 +3748,8 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
{ {
TRACE("Checked and setting value %s of %s\n", TRACE("Checked and setting value %s of %s\n",
debugstr_w(deformated), debugstr_w(uikey)); debugstr_w(deformated), debugstr_w(uikey));
RegSetValueExW(hkey, deformated, 0, type, value_data, size); if (deformated || size)
RegSetValueExW(hkey, deformated, 0, type, value_data, size);
} }
} }
@ -3776,16 +3766,12 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
HeapFree(GetProcessHeap(),0,value_data); HeapFree(GetProcessHeap(),0,value_data);
HeapFree(GetProcessHeap(),0,value);
HeapFree(GetProcessHeap(),0,deformated); HeapFree(GetProcessHeap(),0,deformated);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
RegCloseKey(hkey); RegCloseKey(hkey);
next: next:
HeapFree(GetProcessHeap(),0,uikey); HeapFree(GetProcessHeap(),0,uikey);
HeapFree(GetProcessHeap(),0,key);
HeapFree(GetProcessHeap(),0,name);
HeapFree(GetProcessHeap(),0,component);
} }
MSI_ViewClose(view); MSI_ViewClose(view);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
@ -3885,8 +3871,8 @@ static UINT ACTION_LaunchConditions(MSIPACKAGE *package)
rc = ERROR_SUCCESS; rc = ERROR_SUCCESS;
while (rc == ERROR_SUCCESS) while (rc == ERROR_SUCCESS)
{ {
LPWSTR cond = NULL; LPCWSTR cond = NULL;
LPWSTR message = NULL; LPCWSTR message = NULL;
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
@ -3895,19 +3881,17 @@ static UINT ACTION_LaunchConditions(MSIPACKAGE *package)
break; break;
} }
cond = load_dynamic_stringW(row,1); cond = MSI_RecordGetString(row,1);
if (MSI_EvaluateConditionW(package,cond) != MSICONDITION_TRUE) if (MSI_EvaluateConditionW(package,cond) != MSICONDITION_TRUE)
{ {
LPWSTR deformated; LPWSTR deformated;
message = load_dynamic_stringW(row,2); message = MSI_RecordGetString(row,2);
deformat_string(package,message,&deformated); deformat_string(package,message,&deformated);
MessageBoxW(NULL,deformated,title,MB_OK); MessageBoxW(NULL,deformated,title,MB_OK);
HeapFree(GetProcessHeap(),0,message);
HeapFree(GetProcessHeap(),0,deformated); HeapFree(GetProcessHeap(),0,deformated);
rc = ERROR_FUNCTION_FAILED; rc = ERROR_FUNCTION_FAILED;
} }
HeapFree(GetProcessHeap(),0,cond);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
} }
MSI_ViewClose(view); MSI_ViewClose(view);
@ -3929,7 +3913,8 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, INT
{ {
MSIRECORD * row = 0; MSIRECORD * row = 0;
UINT root,len; UINT root,len;
LPWSTR key,deformated,buffer,name,deformated_name; LPWSTR deformated,buffer,deformated_name;
LPCWSTR key,name;
static const WCHAR ExecSeqQuery[] = static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','R','e','g','i','s','t','r','y','`',' ', '`','R','e','g','i','s','t','r','y','`',' ',
@ -3944,8 +3929,8 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, INT
return NULL; return NULL;
root = MSI_RecordGetInteger(row,2); root = MSI_RecordGetInteger(row,2);
key = load_dynamic_stringW(row, 3); key = MSI_RecordGetString(row, 3);
name = load_dynamic_stringW(row, 4); name = MSI_RecordGetString(row, 4);
deformat_string(package, key , &deformated); deformat_string(package, key , &deformated);
deformat_string(package, name, &deformated_name); deformat_string(package, name, &deformated_name);
@ -3960,9 +3945,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, INT
else else
sprintfW(buffer,fmt,root,deformated); sprintfW(buffer,fmt,root,deformated);
HeapFree(GetProcessHeap(),0,key);
HeapFree(GetProcessHeap(),0,deformated); HeapFree(GetProcessHeap(),0,deformated);
HeapFree(GetProcessHeap(),0,name);
HeapFree(GetProcessHeap(),0,deformated_name); HeapFree(GetProcessHeap(),0,deformated_name);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
@ -4325,10 +4308,8 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
while (1) while (1)
{ {
WCHAR component[0x100]; LPCWSTR component;
DWORD sz;
INT index; INT index;
LPWSTR guid;
typelib_struct tl_struct; typelib_struct tl_struct;
HMODULE module; HMODULE module;
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0}; static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
@ -4340,9 +4321,7 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
break; break;
} }
sz = 0x100; component = MSI_RecordGetString(row,3);
MSI_RecordGetStringW(row,3,component,&sz);
index = get_loaded_component(package,component); index = get_loaded_component(package,component);
if (index < 0) if (index < 0)
{ {
@ -4372,12 +4351,14 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
continue; continue;
} }
guid = load_dynamic_stringW(row,1);
module = LoadLibraryExW(package->files[index].TargetPath, NULL, module = LoadLibraryExW(package->files[index].TargetPath, NULL,
LOAD_LIBRARY_AS_DATAFILE); LOAD_LIBRARY_AS_DATAFILE);
if (module != NULL) if (module != NULL)
{ {
LPWSTR guid;
guid = load_dynamic_stringW(row,1);
CLSIDFromString(guid, &tl_struct.clsid); CLSIDFromString(guid, &tl_struct.clsid);
HeapFree(GetProcessHeap(),0,guid);
tl_struct.source = strdupW(package->files[index].TargetPath); tl_struct.source = strdupW(package->files[index].TargetPath);
tl_struct.path = NULL; tl_struct.path = NULL;
@ -4386,14 +4367,14 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
if (tl_struct.path != NULL) if (tl_struct.path != NULL)
{ {
LPWSTR help; LPWSTR help = NULL;
WCHAR helpid[0x100]; LPCWSTR helpid;
HRESULT res; HRESULT res;
sz = 0x100; helpid = MSI_RecordGetString(row,6);
MSI_RecordGetStringW(row,6,helpid,&sz);
if (helpid)
help = resolve_folder(package,helpid,FALSE,FALSE,NULL); help = resolve_folder(package,helpid,FALSE,FALSE,NULL);
res = RegisterTypeLib(tl_struct.ptLib,tl_struct.path,help); res = RegisterTypeLib(tl_struct.ptLib,tl_struct.path,help);
HeapFree(GetProcessHeap(),0,help); HeapFree(GetProcessHeap(),0,help);
@ -4431,7 +4412,7 @@ static INT load_appid(MSIPACKAGE* package, MSIRECORD *row)
{ {
DWORD index = package->loaded_appids; DWORD index = package->loaded_appids;
DWORD sz; DWORD sz;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4448,9 +4429,8 @@ static INT load_appid(MSIPACKAGE* package, MSIRECORD *row)
MSI_RecordGetStringW(row, 1, package->appids[index].AppID, &sz); MSI_RecordGetStringW(row, 1, package->appids[index].AppID, &sz);
TRACE("loading appid %s\n",debugstr_w(package->appids[index].AppID)); TRACE("loading appid %s\n",debugstr_w(package->appids[index].AppID));
buffer = load_dynamic_stringW(row,2); buffer = MSI_RecordGetString(row,2);
deformat_string(package,buffer,&package->appids[index].RemoteServerName); deformat_string(package,buffer,&package->appids[index].RemoteServerName);
HeapFree(GetProcessHeap(),0,buffer);
package->appids[index].LocalServer = load_dynamic_stringW(row,3); package->appids[index].LocalServer = load_dynamic_stringW(row,3);
package->appids[index].ServiceParameters = load_dynamic_stringW(row,4); package->appids[index].ServiceParameters = load_dynamic_stringW(row,4);
@ -4499,7 +4479,7 @@ static INT load_given_class(MSIPACKAGE *package, LPCWSTR classid);
static INT load_progid(MSIPACKAGE* package, MSIRECORD *row) static INT load_progid(MSIPACKAGE* package, MSIRECORD *row)
{ {
DWORD index = package->loaded_progids; DWORD index = package->loaded_progids;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4515,17 +4495,15 @@ static INT load_progid(MSIPACKAGE* package, MSIRECORD *row)
package->progids[index].ProgID = load_dynamic_stringW(row,1); package->progids[index].ProgID = load_dynamic_stringW(row,1);
TRACE("loading progid %s\n",debugstr_w(package->progids[index].ProgID)); TRACE("loading progid %s\n",debugstr_w(package->progids[index].ProgID));
buffer = load_dynamic_stringW(row,2); buffer = MSI_RecordGetString(row,2);
package->progids[index].ParentIndex = load_given_progid(package,buffer); package->progids[index].ParentIndex = load_given_progid(package,buffer);
if (package->progids[index].ParentIndex < 0 && buffer) if (package->progids[index].ParentIndex < 0 && buffer)
FIXME("Unknown parent ProgID %s\n",debugstr_w(buffer)); FIXME("Unknown parent ProgID %s\n",debugstr_w(buffer));
HeapFree(GetProcessHeap(),0,buffer);
buffer = load_dynamic_stringW(row,3); buffer = MSI_RecordGetString(row,3);
package->progids[index].ClassIndex = load_given_class(package,buffer); package->progids[index].ClassIndex = load_given_class(package,buffer);
if (package->progids[index].ClassIndex< 0 && buffer) if (package->progids[index].ClassIndex< 0 && buffer)
FIXME("Unknown class %s\n",debugstr_w(buffer)); FIXME("Unknown class %s\n",debugstr_w(buffer));
HeapFree(GetProcessHeap(),0,buffer);
package->progids[index].Description = load_dynamic_stringW(row,4); package->progids[index].Description = load_dynamic_stringW(row,4);
@ -4549,10 +4527,9 @@ static INT load_progid(MSIPACKAGE* package, MSIRECORD *row)
} }
else else
{ {
buffer = load_dynamic_stringW(row,5); buffer = MSI_RecordGetString(row,5);
if (buffer) if (buffer)
build_icon_path(package,buffer,&(package->progids[index].IconPath)); build_icon_path(package,buffer,&(package->progids[index].IconPath));
HeapFree(GetProcessHeap(),0,buffer);
} }
package->progids[index].CurVerIndex = -1; package->progids[index].CurVerIndex = -1;
@ -4610,7 +4587,7 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
{ {
DWORD index = package->loaded_classes; DWORD index = package->loaded_classes;
DWORD sz,i; DWORD sz,i;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4628,10 +4605,9 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
TRACE("loading class %s\n",debugstr_w(package->classes[index].CLSID)); TRACE("loading class %s\n",debugstr_w(package->classes[index].CLSID));
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row, 2, package->classes[index].Context, &sz); MSI_RecordGetStringW(row, 2, package->classes[index].Context, &sz);
buffer = load_dynamic_stringW(row,3); buffer = MSI_RecordGetString(row,3);
package->classes[index].ComponentIndex = get_loaded_component(package, package->classes[index].ComponentIndex = get_loaded_component(package,
buffer); buffer);
HeapFree(GetProcessHeap(),0,buffer);
package->classes[index].ProgIDText = load_dynamic_stringW(row,4); package->classes[index].ProgIDText = load_dynamic_stringW(row,4);
package->classes[index].ProgIDIndex = package->classes[index].ProgIDIndex =
@ -4639,13 +4615,12 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
package->classes[index].Description = load_dynamic_stringW(row,5); package->classes[index].Description = load_dynamic_stringW(row,5);
buffer = load_dynamic_stringW(row,6); buffer = MSI_RecordGetString(row,6);
if (buffer) if (buffer)
package->classes[index].AppIDIndex = package->classes[index].AppIDIndex =
load_given_appid(package, buffer); load_given_appid(package, buffer);
else else
package->classes[index].AppIDIndex = -1; package->classes[index].AppIDIndex = -1;
HeapFree(GetProcessHeap(),0,buffer);
package->classes[index].FileTypeMask = load_dynamic_stringW(row,7); package->classes[index].FileTypeMask = load_dynamic_stringW(row,7);
@ -4670,10 +4645,9 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
} }
else else
{ {
buffer = load_dynamic_stringW(row,8); buffer = MSI_RecordGetString(row,8);
if (buffer) if (buffer)
build_icon_path(package,buffer,&(package->classes[index].IconPath)); build_icon_path(package,buffer,&(package->classes[index].IconPath));
HeapFree(GetProcessHeap(),0,buffer);
} }
if (!MSI_RecordIsNull(row,10)) if (!MSI_RecordIsNull(row,10))
@ -4705,13 +4679,11 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
reduce_to_longfilename(package->classes[index].DefInprocHandler32); reduce_to_longfilename(package->classes[index].DefInprocHandler32);
} }
} }
buffer = load_dynamic_stringW(row,11); buffer = MSI_RecordGetString(row,11);
deformat_string(package,buffer,&package->classes[index].Argument); deformat_string(package,buffer,&package->classes[index].Argument);
HeapFree(GetProcessHeap(),0,buffer);
buffer = load_dynamic_stringW(row,12); buffer = MSI_RecordGetString(row,12);
package->classes[index].FeatureIndex = get_loaded_feature(package,buffer); package->classes[index].FeatureIndex = get_loaded_feature(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
package->classes[index].Attributes = MSI_RecordGetInteger(row,13); package->classes[index].Attributes = MSI_RecordGetInteger(row,13);
@ -4762,7 +4734,7 @@ static INT load_mime(MSIPACKAGE* package, MSIRECORD *row)
{ {
DWORD index = package->loaded_mimes; DWORD index = package->loaded_mimes;
DWORD sz; DWORD sz;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4779,10 +4751,9 @@ static INT load_mime(MSIPACKAGE* package, MSIRECORD *row)
package->mimes[index].ContentType = load_dynamic_stringW(row,1); package->mimes[index].ContentType = load_dynamic_stringW(row,1);
TRACE("loading mime %s\n",debugstr_w(package->mimes[index].ContentType)); TRACE("loading mime %s\n",debugstr_w(package->mimes[index].ContentType));
buffer = load_dynamic_stringW(row,2); buffer = MSI_RecordGetString(row,2);
package->mimes[index].ExtensionIndex = load_given_extension(package, package->mimes[index].ExtensionIndex = load_given_extension(package,
buffer); buffer);
HeapFree(GetProcessHeap(),0,buffer);
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row,3,package->mimes[index].CLSID,&sz); MSI_RecordGetStringW(row,3,package->mimes[index].CLSID,&sz);
@ -4828,7 +4799,7 @@ static INT load_extension(MSIPACKAGE* package, MSIRECORD *row)
{ {
DWORD index = package->loaded_extensions; DWORD index = package->loaded_extensions;
DWORD sz; DWORD sz;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4847,23 +4818,20 @@ static INT load_extension(MSIPACKAGE* package, MSIRECORD *row)
TRACE("loading extension %s\n", TRACE("loading extension %s\n",
debugstr_w(package->extensions[index].Extension)); debugstr_w(package->extensions[index].Extension));
buffer = load_dynamic_stringW(row,2); buffer = MSI_RecordGetString(row,2);
package->extensions[index].ComponentIndex = package->extensions[index].ComponentIndex =
get_loaded_component(package,buffer); get_loaded_component(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
package->extensions[index].ProgIDText = load_dynamic_stringW(row,3); package->extensions[index].ProgIDText = load_dynamic_stringW(row,3);
package->extensions[index].ProgIDIndex = load_given_progid(package, package->extensions[index].ProgIDIndex = load_given_progid(package,
package->extensions[index].ProgIDText); package->extensions[index].ProgIDText);
buffer = load_dynamic_stringW(row,4); buffer = MSI_RecordGetString(row,4);
package->extensions[index].MIMEIndex = load_given_mime(package,buffer); package->extensions[index].MIMEIndex = load_given_mime(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
buffer = load_dynamic_stringW(row,5); buffer = MSI_RecordGetString(row,5);
package->extensions[index].FeatureIndex = package->extensions[index].FeatureIndex =
get_loaded_feature(package,buffer); get_loaded_feature(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
return index; return index;
} }
@ -4910,7 +4878,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
{ {
MSIPACKAGE* package = (MSIPACKAGE*)param; MSIPACKAGE* package = (MSIPACKAGE*)param;
DWORD index = package->loaded_verbs; DWORD index = package->loaded_verbs;
LPWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
@ -4923,23 +4891,20 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
memset(&package->verbs[index],0,sizeof(MSIVERB)); memset(&package->verbs[index],0,sizeof(MSIVERB));
buffer = load_dynamic_stringW(row,1); buffer = MSI_RecordGetString(row,1);
package->verbs[index].ExtensionIndex = load_given_extension(package,buffer); package->verbs[index].ExtensionIndex = load_given_extension(package,buffer);
if (package->verbs[index].ExtensionIndex < 0 && buffer) if (package->verbs[index].ExtensionIndex < 0 && buffer)
ERR("Verb unable to find loaded extension %s\n", debugstr_w(buffer)); ERR("Verb unable to find loaded extension %s\n", debugstr_w(buffer));
HeapFree(GetProcessHeap(),0,buffer);
package->verbs[index].Verb = load_dynamic_stringW(row,2); package->verbs[index].Verb = load_dynamic_stringW(row,2);
TRACE("loading verb %s\n",debugstr_w(package->verbs[index].Verb)); TRACE("loading verb %s\n",debugstr_w(package->verbs[index].Verb));
package->verbs[index].Sequence = MSI_RecordGetInteger(row,3); package->verbs[index].Sequence = MSI_RecordGetInteger(row,3);
buffer = load_dynamic_stringW(row,4); buffer = MSI_RecordGetString(row,4);
deformat_string(package,buffer,&package->verbs[index].Command); deformat_string(package,buffer,&package->verbs[index].Command);
HeapFree(GetProcessHeap(),0,buffer);
buffer = load_dynamic_stringW(row,5); buffer = MSI_RecordGetString(row,5);
deformat_string(package,buffer,&package->verbs[index].Argument); deformat_string(package,buffer,&package->verbs[index].Argument);
HeapFree(GetProcessHeap(),0,buffer);
/* assosiate the verb with the correct extension */ /* assosiate the verb with the correct extension */
if (package->verbs[index].ExtensionIndex >= 0) if (package->verbs[index].ExtensionIndex >= 0)
@ -4962,17 +4927,17 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
{ {
LPWSTR clsid; LPCWSTR clsid;
LPWSTR context; LPCWSTR context;
LPWSTR buffer; LPCWSTR buffer;
INT component_index; INT component_index;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
INT i; INT i;
BOOL match = FALSE; BOOL match = FALSE;
clsid = load_dynamic_stringW(rec,1); clsid = MSI_RecordGetString(rec,1);
context = load_dynamic_stringW(rec,2); context = MSI_RecordGetString(rec,2);
buffer = load_dynamic_stringW(rec,3); buffer = MSI_RecordGetString(rec,3);
component_index = get_loaded_component(package,buffer); component_index = get_loaded_component(package,buffer);
for (i = 0; i < package->loaded_classes; i++) for (i = 0; i < package->loaded_classes; i++)
@ -4988,10 +4953,6 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
} }
} }
HeapFree(GetProcessHeap(),0,buffer);
HeapFree(GetProcessHeap(),0,clsid);
HeapFree(GetProcessHeap(),0,context);
if (!match) if (!match)
load_class(package, rec); load_class(package, rec);
@ -5017,15 +4978,15 @@ static VOID load_all_classes(MSIPACKAGE *package)
static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param) static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
{ {
LPWSTR buffer; LPCWSTR buffer;
LPWSTR extension; LPCWSTR extension;
INT component_index; INT component_index;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
BOOL match = FALSE; BOOL match = FALSE;
INT i; INT i;
extension = load_dynamic_stringW(rec,1); extension = MSI_RecordGetString(rec,1);
buffer = load_dynamic_stringW(rec,2); buffer = MSI_RecordGetString(rec,2);
component_index = get_loaded_component(package,buffer); component_index = get_loaded_component(package,buffer);
for (i = 0; i < package->loaded_extensions; i++) for (i = 0; i < package->loaded_extensions; i++)
@ -5039,9 +5000,6 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
} }
} }
HeapFree(GetProcessHeap(),0,buffer);
HeapFree(GetProcessHeap(),0,extension);
if (!match) if (!match)
load_extension(package, rec); load_extension(package, rec);
@ -5067,12 +5025,11 @@ static VOID load_all_extensions(MSIPACKAGE *package)
static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param) static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
{ {
LPWSTR buffer; LPCWSTR buffer;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
buffer = load_dynamic_stringW(rec,1); buffer = MSI_RecordGetString(rec,1);
load_given_progid(package,buffer); load_given_progid(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -5112,12 +5069,11 @@ static VOID load_all_verbs(MSIPACKAGE *package)
static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param) static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
{ {
LPWSTR buffer; LPCWSTR buffer;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
buffer = load_dynamic_stringW(rec,1); buffer = MSI_RecordGetString(rec,1);
load_given_mime(package,buffer); load_given_mime(package,buffer);
HeapFree(GetProcessHeap(),0,buffer);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -5782,7 +5738,8 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
while (1) while (1)
{ {
LPWSTR target_file, target_folder; LPWSTR target_file, target_folder;
WCHAR buffer[0x100]; LPCWSTR buffer;
WCHAR filename[0x100];
DWORD sz; DWORD sz;
DWORD index; DWORD index;
static const WCHAR szlnk[]={'.','l','n','k',0}; static const WCHAR szlnk[]={'.','l','n','k',0};
@ -5794,9 +5751,7 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
break; break;
} }
sz = 0x100; buffer = MSI_RecordGetString(row,4);
MSI_RecordGetStringW(row,4,buffer,&sz);
index = get_loaded_component(package,buffer); index = get_loaded_component(package,buffer);
if (index < 0) if (index < 0)
@ -5839,23 +5794,21 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
continue; continue;
} }
sz = 0x100; buffer = MSI_RecordGetString(row,2);
MSI_RecordGetStringW(row,2,buffer,&sz);
target_folder = resolve_folder(package, buffer,FALSE,FALSE,NULL); target_folder = resolve_folder(package, buffer,FALSE,FALSE,NULL);
/* may be needed because of a bug somehwere else */ /* may be needed because of a bug somehwere else */
create_full_pathW(target_folder); create_full_pathW(target_folder);
sz = 0x100; sz = 0x100;
MSI_RecordGetStringW(row,3,buffer,&sz); MSI_RecordGetStringW(row,3,filename,&sz);
reduce_to_longfilename(buffer); reduce_to_longfilename(filename);
if (!strchrW(buffer,'.') || strcmpiW(strchrW(buffer,'.'),szlnk)) if (!strchrW(filename,'.') || strcmpiW(strchrW(filename,'.'),szlnk))
strcatW(buffer,szlnk); strcatW(filename,szlnk);
target_file = build_directory_name(2, target_folder, buffer); target_file = build_directory_name(2, target_folder, filename);
HeapFree(GetProcessHeap(),0,target_folder); HeapFree(GetProcessHeap(),0,target_folder);
sz = 0x100; buffer = MSI_RecordGetString(row,5);
MSI_RecordGetStringW(row,5,buffer,&sz);
if (strchrW(buffer,'[')) if (strchrW(buffer,'['))
{ {
LPWSTR deformated; LPWSTR deformated;
@ -5875,8 +5828,7 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
if (!MSI_RecordIsNull(row,6)) if (!MSI_RecordIsNull(row,6))
{ {
LPWSTR deformated; LPWSTR deformated;
sz = 0x100; buffer = MSI_RecordGetString(row,6);
MSI_RecordGetStringW(row,6,buffer,&sz);
deformat_string(package,buffer,&deformated); deformat_string(package,buffer,&deformated);
IShellLinkW_SetArguments(sl,deformated); IShellLinkW_SetArguments(sl,deformated);
HeapFree(GetProcessHeap(),0,deformated); HeapFree(GetProcessHeap(),0,deformated);
@ -5884,10 +5836,8 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
if (!MSI_RecordIsNull(row,7)) if (!MSI_RecordIsNull(row,7))
{ {
LPWSTR deformated; buffer = MSI_RecordGetString(row,7);
deformated = load_dynamic_stringW(row,7); IShellLinkW_SetDescription(sl,buffer);
IShellLinkW_SetDescription(sl,deformated);
HeapFree(GetProcessHeap(),0,deformated);
} }
if (!MSI_RecordIsNull(row,8)) if (!MSI_RecordIsNull(row,8))
@ -5898,8 +5848,7 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
WCHAR *Path = NULL; WCHAR *Path = NULL;
INT index; INT index;
sz = 0x100; buffer = MSI_RecordGetString(row,9);
MSI_RecordGetStringW(row,9,buffer,&sz);
build_icon_path(package,buffer,&Path); build_icon_path(package,buffer,&Path);
index = MSI_RecordGetInteger(row,10); index = MSI_RecordGetInteger(row,10);
@ -5914,8 +5863,7 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
if (!MSI_RecordIsNull(row,12)) if (!MSI_RecordIsNull(row,12))
{ {
LPWSTR Path; LPWSTR Path;
sz = 0x100; buffer = MSI_RecordGetString(row,12);
MSI_RecordGetStringW(row,12,buffer,&sz);
Path = resolve_folder(package, buffer, FALSE, FALSE, NULL); Path = resolve_folder(package, buffer, FALSE, FALSE, NULL);
IShellLinkW_SetWorkingDirectory(sl,Path); IShellLinkW_SetWorkingDirectory(sl,Path);
HeapFree(GetProcessHeap(), 0, Path); HeapFree(GetProcessHeap(), 0, Path);
@ -5999,8 +5947,8 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
while (1) while (1)
{ {
HANDLE the_file; HANDLE the_file;
WCHAR *FilePath=NULL; LPWSTR FilePath=NULL;
WCHAR *FileName=NULL; LPCWSTR FileName=NULL;
CHAR buffer[1024]; CHAR buffer[1024];
rc = MSI_ViewFetch(view,&row); rc = MSI_ViewFetch(view,&row);
@ -6010,7 +5958,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
break; break;
} }
FileName = load_dynamic_stringW(row,1); FileName = MSI_RecordGetString(row,1);
if (!FileName) if (!FileName)
{ {
ERR("Unable to get FileName\n"); ERR("Unable to get FileName\n");
@ -6020,8 +5968,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
build_icon_path(package,FileName,&FilePath); build_icon_path(package,FileName,&FilePath);
HeapFree(GetProcessHeap(),0,FileName);
TRACE("Creating icon file at %s\n",debugstr_w(FilePath)); TRACE("Creating icon file at %s\n",debugstr_w(FilePath));
the_file = CreateFileW(FilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, the_file = CreateFileW(FilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
@ -6175,7 +6121,7 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
while (1) while (1)
{ {
LPWSTR component,filename,dirproperty,section,key,value,identifier; LPCWSTR component,section,key,value,identifier,filename,dirproperty;
LPWSTR deformated_section, deformated_key, deformated_value; LPWSTR deformated_section, deformated_key, deformated_value;
LPWSTR folder, fullname = NULL; LPWSTR folder, fullname = NULL;
MSIRECORD * uirow; MSIRECORD * uirow;
@ -6188,14 +6134,14 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
break; break;
} }
component = load_dynamic_stringW(row, 8); component = MSI_RecordGetString(row, 8);
component_index = get_loaded_component(package,component); component_index = get_loaded_component(package,component);
HeapFree(GetProcessHeap(),0,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, component_index,
INSTALLSTATE_LOCAL)) INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping ini file due to disabled component\n"); TRACE("Skipping ini file due to disabled component %s\n",
debugstr_w(component));
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
package->components[component_index].Action = package->components[component_index].Action =
@ -6206,12 +6152,12 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
package->components[component_index].Action = INSTALLSTATE_LOCAL; package->components[component_index].Action = INSTALLSTATE_LOCAL;
identifier = load_dynamic_stringW(row,1); identifier = MSI_RecordGetString(row,1);
filename = load_dynamic_stringW(row,2); filename = MSI_RecordGetString(row,2);
dirproperty = load_dynamic_stringW(row,3); dirproperty = MSI_RecordGetString(row,3);
section = load_dynamic_stringW(row,4); section = MSI_RecordGetString(row,4);
key = load_dynamic_stringW(row,5); key = MSI_RecordGetString(row,5);
value = load_dynamic_stringW(row,6); value = MSI_RecordGetString(row,6);
action = MSI_RecordGetInteger(row,7); action = MSI_RecordGetInteger(row,7);
deformat_string(package,section,&deformated_section); deformat_string(package,section,&deformated_section);
@ -6271,13 +6217,7 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
ui_actiondata(package,szWriteIniValues,uirow); ui_actiondata(package,szWriteIniValues,uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
cleanup: cleanup:
HeapFree(GetProcessHeap(),0,identifier);
HeapFree(GetProcessHeap(),0,fullname); HeapFree(GetProcessHeap(),0,fullname);
HeapFree(GetProcessHeap(),0,filename);
HeapFree(GetProcessHeap(),0,key);
HeapFree(GetProcessHeap(),0,value);
HeapFree(GetProcessHeap(),0,section);
HeapFree(GetProcessHeap(),0,dirproperty);
HeapFree(GetProcessHeap(),0,folder); HeapFree(GetProcessHeap(),0,folder);
HeapFree(GetProcessHeap(),0,deformated_key); HeapFree(GetProcessHeap(),0,deformated_key);
HeapFree(GetProcessHeap(),0,deformated_value); HeapFree(GetProcessHeap(),0,deformated_value);
@ -6324,7 +6264,8 @@ static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
while (1) while (1)
{ {
LPWSTR filename; LPCWSTR filename;
LPWSTR FullName;
INT index; INT index;
DWORD len; DWORD len;
@ -6335,35 +6276,33 @@ static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
break; break;
} }
filename = load_dynamic_stringW(row,1); filename = MSI_RecordGetString(row,1);
index = get_loaded_file(package,filename); index = get_loaded_file(package,filename);
if (index < 0) if (index < 0)
{ {
ERR("Unable to find file id %s\n",debugstr_w(filename)); ERR("Unable to find file id %s\n",debugstr_w(filename));
HeapFree(GetProcessHeap(),0,filename);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
continue; continue;
} }
HeapFree(GetProcessHeap(),0,filename);
len = strlenW(ExeStr); len = strlenW(ExeStr);
len += strlenW(package->files[index].TargetPath); len += strlenW(package->files[index].TargetPath);
len +=2; len +=2;
filename = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); FullName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
strcpyW(filename,ExeStr); strcpyW(FullName,ExeStr);
strcatW(filename,package->files[index].TargetPath); strcatW(FullName,package->files[index].TargetPath);
strcatW(filename,close); strcatW(FullName,close);
TRACE("Registering %s\n",debugstr_w(filename)); TRACE("Registering %s\n",debugstr_w(FullName));
brc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL, brc = CreateProcessW(NULL, FullName, NULL, NULL, FALSE, 0, NULL,
c_colon, &si, &info); c_colon, &si, &info);
if (brc) if (brc)
msi_dialog_check_messages(info.hProcess); msi_dialog_check_messages(info.hProcess);
HeapFree(GetProcessHeap(),0,filename); HeapFree(GetProcessHeap(),0,FullName);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
} }
MSI_ViewClose(view); MSI_ViewClose(view);
@ -7345,7 +7284,7 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
while (1) while (1)
{ {
LPWSTR name; LPWSTR name;
LPWSTR file; LPCWSTR file;
UINT index; UINT index;
DWORD size; DWORD size;
@ -7356,12 +7295,11 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
break; break;
} }
file = load_dynamic_stringW(row,1); file = MSI_RecordGetString(row,1);
index = get_loaded_file(package,file); index = get_loaded_file(package,file);
if (index < 0) if (index < 0)
{ {
ERR("Unable to load file\n"); ERR("Unable to load file\n");
HeapFree(GetProcessHeap(),0,file);
continue; continue;
} }
@ -7370,7 +7308,6 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
package->files[index].ComponentIndex, INSTALLSTATE_LOCAL)) package->files[index].ComponentIndex, INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping: Component not scheduled for install\n"); TRACE("Skipping: Component not scheduled for install\n");
HeapFree(GetProcessHeap(),0,file);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
@ -7391,7 +7328,6 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
(LPBYTE)package->files[index].FileName,size); (LPBYTE)package->files[index].FileName,size);
} }
HeapFree(GetProcessHeap(),0,file);
HeapFree(GetProcessHeap(),0,name); HeapFree(GetProcessHeap(),0,name);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
} }
@ -7408,11 +7344,11 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
{ {
MSIPACKAGE *package = (MSIPACKAGE*)param; MSIPACKAGE *package = (MSIPACKAGE*)param;
LPWSTR compgroupid=NULL; LPCWSTR compgroupid=NULL;
LPWSTR feature=NULL; LPCWSTR feature=NULL;
LPWSTR text = NULL; LPCWSTR text = NULL;
LPWSTR qualifier = NULL; LPCWSTR qualifier = NULL;
LPWSTR component = NULL; LPCWSTR component = NULL;
LPWSTR advertise = NULL; LPWSTR advertise = NULL;
LPWSTR output = NULL; LPWSTR output = NULL;
HKEY hkey; HKEY hkey;
@ -7420,7 +7356,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
UINT index; UINT index;
DWORD sz = 0; DWORD sz = 0;
component = load_dynamic_stringW(rec,3); component = MSI_RecordGetString(rec,3);
index = get_loaded_component(package,component); index = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, index, if (!ACTION_VerifyComponentForAction(package, index,
@ -7433,19 +7369,18 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
TRACE("Skipping: Component %s not scheduled for install\n", TRACE("Skipping: Component %s not scheduled for install\n",
debugstr_w(component)); debugstr_w(component));
HeapFree(GetProcessHeap(),0,component);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
compgroupid = load_dynamic_stringW(rec,1); compgroupid = MSI_RecordGetString(rec,1);
rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE); rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
text = load_dynamic_stringW(rec,4); text = MSI_RecordGetString(rec,4);
qualifier = load_dynamic_stringW(rec,2); qualifier = MSI_RecordGetString(rec,2);
feature = load_dynamic_stringW(rec,5); feature = MSI_RecordGetString(rec,5);
advertise = create_component_advertise_string(package, advertise = create_component_advertise_string(package,
&package->components[index], feature); &package->components[index], feature);
@ -7471,11 +7406,6 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
end: end:
RegCloseKey(hkey); RegCloseKey(hkey);
HeapFree(GetProcessHeap(),0,output); HeapFree(GetProcessHeap(),0,output);
HeapFree(GetProcessHeap(),0,compgroupid);
HeapFree(GetProcessHeap(),0,component);
HeapFree(GetProcessHeap(),0,feature);
HeapFree(GetProcessHeap(),0,text);
HeapFree(GetProcessHeap(),0,qualifier);
return rc; return rc;
} }