Commit ee034ba4 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Added memory allocation inline functions (part 2).

parent 8dc28d53
...@@ -124,14 +124,14 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig, ...@@ -124,14 +124,14 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
{ {
ACTION_VerStrToInteger(minVersion, &sig->MinVersionMS, ACTION_VerStrToInteger(minVersion, &sig->MinVersionMS,
&sig->MinVersionLS); &sig->MinVersionLS);
HeapFree(GetProcessHeap(), 0, minVersion); msi_free( minVersion);
} }
maxVersion = load_dynamic_stringW(row,4); maxVersion = load_dynamic_stringW(row,4);
if (maxVersion) if (maxVersion)
{ {
ACTION_VerStrToInteger(maxVersion, &sig->MaxVersionMS, ACTION_VerStrToInteger(maxVersion, &sig->MaxVersionMS,
&sig->MaxVersionLS); &sig->MaxVersionLS);
HeapFree(GetProcessHeap(), 0, maxVersion); msi_free( maxVersion);
} }
sig->MinSize = MSI_RecordGetInteger(row,5); sig->MinSize = MSI_RecordGetInteger(row,5);
if (sig->MinSize == MSI_NULL_INTEGER) if (sig->MinSize == MSI_NULL_INTEGER)
...@@ -325,7 +325,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound, ...@@ -325,7 +325,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* FIXME: sanity-check sz before allocating (is there an upper-limit /* FIXME: sanity-check sz before allocating (is there an upper-limit
* on the value of a property?) * on the value of a property?)
*/ */
value = HeapAlloc(GetProcessHeap(), 0, sz); value = msi_alloc( sz);
rc = RegQueryValueExW(key, valueName, NULL, &regType, value, &sz); rc = RegQueryValueExW(key, valueName, NULL, &regType, value, &sz);
if (rc) if (rc)
{ {
...@@ -347,14 +347,13 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound, ...@@ -347,14 +347,13 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
if (*(LPWSTR)value == '#') if (*(LPWSTR)value == '#')
{ {
/* escape leading pound with another */ /* escape leading pound with another */
propertyValue = HeapAlloc(GetProcessHeap(), 0, propertyValue = msi_alloc( sz + sizeof(WCHAR));
sz + sizeof(WCHAR));
propertyValue[0] = '#'; propertyValue[0] = '#';
strcpyW(propertyValue + 1, (LPWSTR)value); strcpyW(propertyValue + 1, (LPWSTR)value);
} }
else else
{ {
propertyValue = HeapAlloc(GetProcessHeap(), 0, sz); propertyValue = msi_alloc( sz);
strcpyW(propertyValue, (LPWSTR)value); strcpyW(propertyValue, (LPWSTR)value);
} }
break; break;
...@@ -362,20 +361,17 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound, ...@@ -362,20 +361,17 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign /* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
* char if needed * char if needed
*/ */
propertyValue = HeapAlloc(GetProcessHeap(), 0, propertyValue = msi_alloc( 10 * sizeof(WCHAR));
10 * sizeof(WCHAR));
sprintfW(propertyValue, dwordFmt, *(DWORD *)value); sprintfW(propertyValue, dwordFmt, *(DWORD *)value);
break; break;
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
/* space for extra #% characters in front */ /* space for extra #% characters in front */
propertyValue = HeapAlloc(GetProcessHeap(), 0, propertyValue = msi_alloc( sz + 2 * sizeof(WCHAR));
sz + 2 * sizeof(WCHAR));
sprintfW(propertyValue, expandSzFmt, (LPWSTR)value); sprintfW(propertyValue, expandSzFmt, (LPWSTR)value);
break; break;
case REG_BINARY: case REG_BINARY:
/* 3 == length of "#x<nibble>" */ /* 3 == length of "#x<nibble>" */
propertyValue = HeapAlloc(GetProcessHeap(), 0, propertyValue = msi_alloc( (sz * 3 + 1) * sizeof(WCHAR));
(sz * 3 + 1) * sizeof(WCHAR));
for (i = 0; i < sz; i++) for (i = 0; i < sz; i++)
sprintfW(propertyValue + i * 3, binFmt, value[i]); sprintfW(propertyValue + i * 3, binFmt, value[i]);
break; break;
...@@ -390,12 +386,12 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound, ...@@ -390,12 +386,12 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
*appFound = TRUE; *appFound = TRUE;
end: end:
HeapFree(GetProcessHeap(), 0, propertyValue); msi_free( propertyValue);
HeapFree(GetProcessHeap(), 0, value); msi_free( value);
RegCloseKey(key); RegCloseKey(key);
HeapFree(GetProcessHeap(), 0, keyPath); msi_free( keyPath);
HeapFree(GetProcessHeap(), 0, valueName); msi_free( valueName);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view); MSI_ViewClose(view);
...@@ -449,7 +445,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, BOOL *appFound, ...@@ -449,7 +445,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, BOOL *appFound,
fileName = load_dynamic_stringW(row,2); fileName = load_dynamic_stringW(row,2);
FIXME("AppSearch unimplemented for IniLocator (ini file name %s)\n", FIXME("AppSearch unimplemented for IniLocator (ini file name %s)\n",
debugstr_w(fileName)); debugstr_w(fileName));
HeapFree(GetProcessHeap(), 0, fileName); msi_free( fileName);
end: end:
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
...@@ -549,7 +545,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath, ...@@ -549,7 +545,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
if (size) if (size)
{ {
LPVOID buf = HeapAlloc(GetProcessHeap(), 0, size); LPVOID buf = msi_alloc( size);
if (buf) if (buf)
{ {
...@@ -592,7 +588,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath, ...@@ -592,7 +588,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
else else
*matches = TRUE; *matches = TRUE;
} }
HeapFree(GetProcessHeap(), 0, buf); msi_free( buf);
} }
else else
rc = ERROR_OUTOFMEMORY; rc = ERROR_OUTOFMEMORY;
...@@ -671,8 +667,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound, ...@@ -671,8 +667,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
* here. Add two because we might need to add a backslash if the dir name * here. Add two because we might need to add a backslash if the dir name
* isn't backslash-terminated. * isn't backslash-terminated.
*/ */
buf = HeapAlloc(GetProcessHeap(), 0, buf = msi_alloc( (dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2) * sizeof(WCHAR));
(dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2) * sizeof(WCHAR));
if (buf) if (buf)
{ {
/* a depth of 0 implies we should search dir, so go ahead and search */ /* a depth of 0 implies we should search dir, so go ahead and search */
...@@ -726,7 +721,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound, ...@@ -726,7 +721,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
FindClose(hFind); FindClose(hFind);
} }
} }
HeapFree(GetProcessHeap(), 0, buf); msi_free(buf);
} }
else else
rc = ERROR_OUTOFMEMORY; rc = ERROR_OUTOFMEMORY;
...@@ -965,8 +960,8 @@ UINT ACTION_AppSearch(MSIPACKAGE *package) ...@@ -965,8 +960,8 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
} }
} }
} }
HeapFree(GetProcessHeap(), 0, sig.File); msi_free( sig.File);
HeapFree(GetProcessHeap(), 0, sig.Languages); msi_free( sig.Languages);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
} }
......
...@@ -61,7 +61,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -61,7 +61,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */ /* fill in the data */
appid = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSIAPPID) ); appid = msi_alloc_zero( sizeof(MSIAPPID) );
if (!appid) if (!appid)
return NULL; return NULL;
...@@ -125,7 +125,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -125,7 +125,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */ /* fill in the data */
progid = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSIPROGID) ); progid = msi_alloc_zero( sizeof(MSIPROGID) );
if (!progid) if (!progid)
return NULL; return NULL;
...@@ -155,14 +155,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -155,14 +155,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
build_icon_path(package,FileName,&FilePath); build_icon_path(package,FileName,&FilePath);
progid->IconPath = progid->IconPath = msi_alloc( (strlenW(FilePath)+10)* sizeof(WCHAR) );
HeapAlloc(GetProcessHeap(),0,(strlenW(FilePath)+10)*
sizeof(WCHAR));
sprintfW(progid->IconPath,fmt,FilePath,icon_index); sprintfW(progid->IconPath,fmt,FilePath,icon_index);
HeapFree(GetProcessHeap(),0,FilePath); msi_free(FilePath);
HeapFree(GetProcessHeap(),0,FileName); msi_free(FileName);
} }
else else
{ {
...@@ -231,7 +229,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -231,7 +229,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */ /* fill in the data */
cls = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSICLASS) ); cls = msi_alloc_zero( sizeof(MSICLASS) );
if (!cls) if (!cls)
return NULL; return NULL;
...@@ -264,14 +262,12 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -264,14 +262,12 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
build_icon_path(package,FileName,&FilePath); build_icon_path(package,FileName,&FilePath);
cls->IconPath = cls->IconPath = msi_alloc( (strlenW(FilePath)+5)* sizeof(WCHAR) );
HeapAlloc(GetProcessHeap(),0,(strlenW(FilePath)+5)*
sizeof(WCHAR));
sprintfW(cls->IconPath,fmt,FilePath,icon_index); sprintfW(cls->IconPath,fmt,FilePath,icon_index);
HeapFree(GetProcessHeap(),0,FilePath); msi_free(FilePath);
HeapFree(GetProcessHeap(),0,FileName); msi_free(FileName);
} }
else else
{ {
...@@ -367,7 +363,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -367,7 +363,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */ /* fill in the data */
mt = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSIMIME) ); mt = msi_alloc_zero( sizeof(MSIMIME) );
if (!mt) if (!mt)
return mt; return mt;
...@@ -425,7 +421,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -425,7 +421,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */ /* fill in the data */
ext = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSIEXTENSION) ); ext = msi_alloc_zero( sizeof(MSIEXTENSION) );
if (!ext) if (!ext)
return NULL; return NULL;
...@@ -506,7 +502,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param) ...@@ -506,7 +502,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
/* fill in the data */ /* fill in the data */
verb = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSIVERB) ); verb = msi_alloc_zero( sizeof(MSIVERB) );
if (!verb) if (!verb)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -919,7 +915,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -919,7 +915,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
size += sizeof(WCHAR); size += sizeof(WCHAR);
} }
argument = HeapAlloc(GetProcessHeap(), 0, size + sizeof(WCHAR)); argument = msi_alloc( size + sizeof(WCHAR));
GetShortPathNameW( file->TargetPath, argument, sz ); GetShortPathNameW( file->TargetPath, argument, sz );
if (cls->Argument) if (cls->Argument)
...@@ -939,7 +935,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -939,7 +935,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
size += sizeof(WCHAR); size += sizeof(WCHAR);
} }
argument = HeapAlloc(GetProcessHeap(), 0, size + sizeof(WCHAR)); argument = msi_alloc( size + sizeof(WCHAR));
strcpyW( argument, file->TargetPath ); strcpyW( argument, file->TargetPath );
if (cls->Argument) if (cls->Argument)
...@@ -952,7 +948,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -952,7 +948,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if (argument) if (argument)
{ {
msi_reg_set_val_str( hkey3, NULL, argument ); msi_reg_set_val_str( hkey3, NULL, argument );
HeapFree(GetProcessHeap(),0,argument); msi_free(argument);
} }
RegCloseKey(hkey3); RegCloseKey(hkey3);
...@@ -1022,12 +1018,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -1022,12 +1018,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
ptr2 = strchrW(ptr,';'); ptr2 = strchrW(ptr,';');
if (ptr2) if (ptr2)
*ptr2 = 0; *ptr2 = 0;
keyname = HeapAlloc(GetProcessHeap(),0,(strlenW(szFileType_fmt)+ keyname = msi_alloc( (strlenW(szFileType_fmt) + strlenW(cls->clsid) + 4) * sizeof(WCHAR));
strlenW(cls->clsid) + 4) * sizeof(WCHAR));
sprintfW( keyname, szFileType_fmt, cls->clsid, index ); sprintfW( keyname, szFileType_fmt, cls->clsid, index );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr );
HeapFree(GetProcessHeap(), 0, keyname); msi_free(keyname);
if (ptr2) if (ptr2)
ptr = ptr2+1; ptr = ptr2+1;
...@@ -1188,14 +1183,14 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1188,14 +1183,14 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
size += strlenW(verb->Argument); size += strlenW(verb->Argument);
size += 4; size += 4;
command = HeapAlloc(GetProcessHeap(),0, size * sizeof (WCHAR)); command = msi_alloc(size * sizeof (WCHAR));
if (verb->Argument) if (verb->Argument)
sprintfW(command, fmt, component->FullKeypath, verb->Argument); sprintfW(command, fmt, component->FullKeypath, verb->Argument);
else else
sprintfW(command, fmt2, component->FullKeypath); sprintfW(command, fmt2, component->FullKeypath);
msi_reg_set_val_str( key, NULL, command ); msi_reg_set_val_str( key, NULL, command );
HeapFree(GetProcessHeap(),0,command); msi_free(command);
advertise = create_component_advertise_string(package, component, advertise = create_component_advertise_string(package, component,
extension->Feature->Feature); extension->Feature->Feature);
...@@ -1206,7 +1201,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1206,7 +1201,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
size += strlenW(verb->Argument); size += strlenW(verb->Argument);
size += 4; size += 4;
command = HeapAlloc(GetProcessHeap(),0, size * sizeof (WCHAR)); command = msi_alloc(size * sizeof (WCHAR));
memset(command,0,size*sizeof(WCHAR)); memset(command,0,size*sizeof(WCHAR));
strcpyW(command,advertise); strcpyW(command,advertise);
...@@ -1220,15 +1215,15 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1220,15 +1215,15 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
msi_reg_set_val_multi_str( key, szCommand, command ); msi_reg_set_val_multi_str( key, szCommand, command );
RegCloseKey(key); RegCloseKey(key);
HeapFree(GetProcessHeap(),0,keyname); msi_free(keyname);
HeapFree(GetProcessHeap(),0,advertise); msi_free(advertise);
HeapFree(GetProcessHeap(),0,command); msi_free(command);
if (verb->Command) if (verb->Command)
{ {
keyname = build_directory_name(3, progid, szShell, verb->Verb); keyname = build_directory_name(3, progid, szShell, verb->Verb);
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command );
HeapFree(GetProcessHeap(),0,keyname); msi_free(keyname);
} }
if (verb->Sequence != MSI_NULL_INTEGER) if (verb->Sequence != MSI_NULL_INTEGER)
...@@ -1238,7 +1233,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1238,7 +1233,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
*Sequence = verb->Sequence; *Sequence = verb->Sequence;
keyname = build_directory_name(2, progid, szShell); keyname = build_directory_name(2, progid, szShell);
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb );
HeapFree(GetProcessHeap(),0,keyname); msi_free(keyname);
} }
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -1299,13 +1294,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1299,13 +1294,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
mark_mime_for_install(ext->Mime); mark_mime_for_install(ext->Mime);
extension = HeapAlloc( GetProcessHeap(), 0, extension = msi_alloc( (lstrlenW( ext->Extension ) + 2)*sizeof(WCHAR) );
(lstrlenW( ext->Extension ) + 2)*sizeof(WCHAR) );
extension[0] = '.'; extension[0] = '.';
lstrcpyW(extension+1,ext->Extension); lstrcpyW(extension+1,ext->Extension);
RegCreateKeyW(HKEY_CLASSES_ROOT,extension,&hkey); RegCreateKeyW(HKEY_CLASSES_ROOT,extension,&hkey);
HeapFree( GetProcessHeap(), 0, extension ); msi_free( extension );
if (ext->Mime) if (ext->Mime)
msi_reg_set_val_str( hkey, szContentType, ext->Mime->ContentType ); msi_reg_set_val_str( hkey, szContentType, ext->Mime->ContentType );
...@@ -1327,15 +1321,14 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1327,15 +1321,14 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
msi_reg_set_val_str( hkey, NULL, progid ); msi_reg_set_val_str( hkey, NULL, progid );
newkey = HeapAlloc(GetProcessHeap(),0, newkey = msi_alloc( (strlenW(progid)+strlenW(szSN)+1) * sizeof(WCHAR));
(strlenW(progid)+strlenW(szSN)+1) * sizeof(WCHAR));
strcpyW(newkey,progid); strcpyW(newkey,progid);
strcatW(newkey,szSN); strcatW(newkey,szSN);
RegCreateKeyW(hkey,newkey,&hkey2); RegCreateKeyW(hkey,newkey,&hkey2);
RegCloseKey(hkey2); RegCloseKey(hkey2);
HeapFree(GetProcessHeap(),0,newkey); msi_free(newkey);
/* do all the verbs */ /* do all the verbs */
LIST_FOR_EACH_ENTRY( verb, &ext->verbs, MSIVERB, entry ) LIST_FOR_EACH_ENTRY( verb, &ext->verbs, MSIVERB, entry )
...@@ -1396,18 +1389,16 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) ...@@ -1396,18 +1389,16 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
mime = mt->ContentType; mime = mt->ContentType;
exten = mt->Extension->Extension; exten = mt->Extension->Extension;
extension = HeapAlloc( GetProcessHeap(), 0, extension = msi_alloc( (lstrlenW( exten ) + 2)*sizeof(WCHAR) );
(lstrlenW( exten ) + 2)*sizeof(WCHAR) );
extension[0] = '.'; extension[0] = '.';
lstrcpyW(extension+1,exten); lstrcpyW(extension+1,exten);
key = HeapAlloc(GetProcessHeap(),0,(strlenW(mime)+strlenW(fmt)+1) * key = msi_alloc( (strlenW(mime)+strlenW(fmt)+1) * sizeof(WCHAR) );
sizeof(WCHAR));
sprintfW(key,fmt,mime); sprintfW(key,fmt,mime);
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExten, extension ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExten, extension );
HeapFree(GetProcessHeap(),0,extension); msi_free(extension);
HeapFree(GetProcessHeap(),0,key); msi_free(key);
if (mt->clsid) if (mt->clsid)
FIXME("Handle non null for field 3\n"); FIXME("Handle non null for field 3\n");
......
...@@ -412,7 +412,7 @@ symbol_i: ...@@ -412,7 +412,7 @@ symbol_i:
MSI_GetComponentStateW(cond->package, $2, &install, &action ); MSI_GetComponentStateW(cond->package, $2, &install, &action );
$$ = action; $$ = action;
HeapFree( GetProcessHeap(), 0, $2 ); msi_free( $2 );
} }
| COND_QUESTION identifier | COND_QUESTION identifier
{ {
...@@ -421,7 +421,7 @@ symbol_i: ...@@ -421,7 +421,7 @@ symbol_i:
MSI_GetComponentStateW(cond->package, $2, &install, &action ); MSI_GetComponentStateW(cond->package, $2, &install, &action );
$$ = install; $$ = install;
HeapFree( GetProcessHeap(), 0, $2 ); msi_free( $2 );
} }
| COND_AMPER identifier | COND_AMPER identifier
{ {
...@@ -430,7 +430,7 @@ symbol_i: ...@@ -430,7 +430,7 @@ symbol_i:
MSI_GetFeatureStateW(cond->package, $2, &install, &action ); MSI_GetFeatureStateW(cond->package, $2, &install, &action );
$$ = action; $$ = action;
HeapFree( GetProcessHeap(), 0, $2 ); msi_free( $2 );
} }
| COND_EXCLAM identifier | COND_EXCLAM identifier
{ {
...@@ -439,7 +439,7 @@ symbol_i: ...@@ -439,7 +439,7 @@ symbol_i:
MSI_GetFeatureStateW(cond->package, $2, &install, &action ); MSI_GetFeatureStateW(cond->package, $2, &install, &action );
$$ = install; $$ = install;
HeapFree( GetProcessHeap(), 0, $2 ); msi_free( $2 );
} }
; ;
...@@ -453,30 +453,30 @@ symbol_s: ...@@ -453,30 +453,30 @@ symbol_s:
MSI_GetPropertyW(cond->package, $1, NULL, &sz); MSI_GetPropertyW(cond->package, $1, NULL, &sz);
if (sz == 0) if (sz == 0)
{ {
$$ = HeapAlloc( GetProcessHeap(), 0 ,sizeof(WCHAR)); $$ = msi_alloc( sizeof(WCHAR));
$$[0] = 0; $$[0] = 0;
} }
else else
{ {
sz ++; sz ++;
$$ = HeapAlloc( GetProcessHeap(), 0, sz*sizeof (WCHAR) ); $$ = msi_alloc( sz*sizeof (WCHAR) );
/* Lookup the identifier */ /* Lookup the identifier */
MSI_GetPropertyW(cond->package,$1,$$,&sz); MSI_GetPropertyW(cond->package,$1,$$,&sz);
} }
HeapFree( GetProcessHeap(), 0, $1 ); msi_free( $1 );
} }
| COND_PERCENT identifier | COND_PERCENT identifier
{ {
UINT len = GetEnvironmentVariableW( $2, NULL, 0 ); UINT len = GetEnvironmentVariableW( $2, NULL, 0 );
if( len++ ) if( len++ )
{ {
$$ = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); $$ = msi_alloc( len*sizeof (WCHAR) );
if( $$ ) if( $$ )
GetEnvironmentVariableW( $2, $$, len ); GetEnvironmentVariableW( $2, $$, len );
} }
HeapFree( GetProcessHeap(), 0, $2 ); msi_free( $2 );
} }
; ;
...@@ -496,7 +496,7 @@ integer: ...@@ -496,7 +496,7 @@ integer:
if( !szNum ) if( !szNum )
YYABORT; YYABORT;
$$ = atoiW( szNum ); $$ = atoiW( szNum );
HeapFree( GetProcessHeap(), 0, szNum ); msi_free( szNum );
} }
; ;
...@@ -698,7 +698,7 @@ static LPWSTR COND_GetString( struct cond_str *str ) ...@@ -698,7 +698,7 @@ static LPWSTR COND_GetString( struct cond_str *str )
{ {
LPWSTR ret; LPWSTR ret;
ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1) * sizeof (WCHAR) ); ret = msi_alloc( (str->len+1) * sizeof (WCHAR) );
if( ret ) if( ret )
{ {
memcpy( ret, str->data, str->len * sizeof(WCHAR)); memcpy( ret, str->data, str->len * sizeof(WCHAR));
...@@ -712,7 +712,7 @@ static LPWSTR COND_GetLiteral( struct cond_str *str ) ...@@ -712,7 +712,7 @@ static LPWSTR COND_GetLiteral( struct cond_str *str )
{ {
LPWSTR ret; LPWSTR ret;
ret = HeapAlloc( GetProcessHeap(), 0, (str->len-1) * sizeof (WCHAR) ); ret = msi_alloc( (str->len-1) * sizeof (WCHAR) );
if( ret ) if( ret )
{ {
memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) ); memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );
...@@ -771,13 +771,13 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio ...@@ -771,13 +771,13 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio
if( szCondition ) if( szCondition )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szCondition, -1, NULL, 0 ); UINT len = MultiByteToWideChar( CP_ACP, 0, szCondition, -1, NULL, 0 );
szwCond = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); szwCond = msi_alloc( len * sizeof (WCHAR) );
MultiByteToWideChar( CP_ACP, 0, szCondition, -1, szwCond, len ); MultiByteToWideChar( CP_ACP, 0, szCondition, -1, szwCond, len );
} }
r = MsiEvaluateConditionW( hInstall, szwCond ); r = MsiEvaluateConditionW( hInstall, szwCond );
HeapFree( GetProcessHeap(), 0, szwCond ); msi_free( szwCond );
return r; return r;
} }
...@@ -154,8 +154,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -154,8 +154,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
{ {
FIXME("Rollback only action... rollbacks not supported yet\n"); FIXME("Rollback only action... rollbacks not supported yet\n");
schedule_action(package, ROLLBACK_SCRIPT, action); schedule_action(package, ROLLBACK_SCRIPT, action);
HeapFree(GetProcessHeap(),0,source); msi_free(source);
HeapFree(GetProcessHeap(),0,target); msi_free(target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -172,8 +172,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -172,8 +172,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
schedule_action(package, INSTALL_SCRIPT, action); schedule_action(package, INSTALL_SCRIPT, action);
} }
HeapFree(GetProcessHeap(),0,source); msi_free(source);
HeapFree(GetProcessHeap(),0,target); msi_free(target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -189,7 +189,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -189,7 +189,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
MSI_SetPropertyW(package,szActionData,actiondata); MSI_SetPropertyW(package,szActionData,actiondata);
else else
MSI_SetPropertyW(package,szActionData,szBlank); MSI_SetPropertyW(package,szActionData,szBlank);
HeapFree(GetProcessHeap(),0,actiondata); msi_free(actiondata);
} }
} }
else if (!check_execution_scheduling_options(package,action,type)) else if (!check_execution_scheduling_options(package,action,type))
...@@ -218,12 +218,12 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -218,12 +218,12 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
case 35: /* Directory set with formatted text. */ case 35: /* Directory set with formatted text. */
deformat_string(package,target,&deformated); deformat_string(package,target,&deformated);
MSI_SetTargetPathW(package, source, deformated); MSI_SetTargetPathW(package, source, deformated);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
break; break;
case 51: /* Property set with formatted text. */ case 51: /* Property set with formatted text. */
deformat_string(package,target,&deformated); deformat_string(package,target,&deformated);
rc = MSI_SetPropertyW(package,source,deformated); rc = MSI_SetPropertyW(package,source,deformated);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
break; break;
default: default:
FIXME("UNHANDLED ACTION TYPE %i (%s %s)\n", FIXME("UNHANDLED ACTION TYPE %i (%s %s)\n",
...@@ -231,8 +231,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -231,8 +231,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
debugstr_w(target)); debugstr_w(target));
} }
HeapFree(GetProcessHeap(),0,source); msi_free(source);
HeapFree(GetProcessHeap(),0,target); msi_free(target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return rc; return rc;
} }
...@@ -304,7 +304,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle, ...@@ -304,7 +304,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
{ {
MSIRUNNINGACTION *action; MSIRUNNINGACTION *action;
action = HeapAlloc( GetProcessHeap(), 0, sizeof(MSIRUNNINGACTION) ); action = msi_alloc( sizeof(MSIRUNNINGACTION) );
action->handle = Handle; action->handle = Handle;
action->process = process; action->process = process;
...@@ -443,15 +443,15 @@ static DWORD WINAPI ACTION_CallDllFunction(thread_struct *stuff) ...@@ -443,15 +443,15 @@ static DWORD WINAPI ACTION_CallDllFunction(thread_struct *stuff)
else else
ERR("Cannot load functon\n"); ERR("Cannot load functon\n");
HeapFree(GetProcessHeap(),0,proc); msi_free(proc);
FreeLibrary(hModule); FreeLibrary(hModule);
} }
else else
ERR("Unable to load library\n"); ERR("Unable to load library\n");
msiobj_release( &stuff->package->hdr ); msiobj_release( &stuff->package->hdr );
HeapFree(GetProcessHeap(),0,stuff->source); msi_free(stuff->source);
HeapFree(GetProcessHeap(),0,stuff->target); msi_free(stuff->target);
HeapFree(GetProcessHeap(), 0, stuff); msi_free(stuff);
return rc; return rc;
} }
...@@ -493,7 +493,7 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source, ...@@ -493,7 +493,7 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
strcatW(tmp_file,dot); strcatW(tmp_file,dot);
} }
info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) ); info = msi_alloc( sizeof(*info) );
msiobj_addref( &package->hdr ); msiobj_addref( &package->hdr );
info->package = package; info->package = package;
info->target = strdupW(target); info->target = strdupW(target);
...@@ -536,7 +536,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source, ...@@ -536,7 +536,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
if (deformated) if (deformated)
len += strlenW(deformated); len += strlenW(deformated);
cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); cmd = msi_alloc(sizeof(WCHAR)*len);
strcpyW(cmd,tmp_file); strcpyW(cmd,tmp_file);
if (deformated) if (deformated)
...@@ -544,7 +544,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source, ...@@ -544,7 +544,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd,spc); strcatW(cmd,spc);
strcatW(cmd,deformated); strcatW(cmd,deformated);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
} }
TRACE("executing exe %s \n",debugstr_w(cmd)); TRACE("executing exe %s \n",debugstr_w(cmd));
...@@ -552,7 +552,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source, ...@@ -552,7 +552,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL, rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info); c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd); msi_free(cmd);
if ( !rc ) if ( !rc )
{ {
...@@ -597,7 +597,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source, ...@@ -597,7 +597,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
len += strlenW(deformated); len += strlenW(deformated);
len += 2; len += 2;
cmd = HeapAlloc(GetProcessHeap(),0,len * sizeof(WCHAR)); cmd = msi_alloc(len * sizeof(WCHAR));
lstrcpyW( cmd, file->TargetPath); lstrcpyW( cmd, file->TargetPath);
if (deformated) if (deformated)
...@@ -605,7 +605,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source, ...@@ -605,7 +605,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd, spc); strcatW(cmd, spc);
strcatW(cmd, deformated); strcatW(cmd, deformated);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
} }
TRACE("executing exe %s \n",debugstr_w(cmd)); TRACE("executing exe %s \n",debugstr_w(cmd));
...@@ -613,7 +613,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source, ...@@ -613,7 +613,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL, rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info); c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd); msi_free(cmd);
if ( !rc ) if ( !rc )
{ {
...@@ -652,7 +652,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source, ...@@ -652,7 +652,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
else else
MessageBoxW( NULL, deformated, NULL, MB_OK ); MessageBoxW( NULL, deformated, NULL, MB_OK );
HeapFree( GetProcessHeap(), 0, deformated ); msi_free( deformated );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
...@@ -681,7 +681,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, ...@@ -681,7 +681,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
if (deformated) if (deformated)
len += strlenW(deformated); len += strlenW(deformated);
cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len); cmd = msi_alloc(sizeof(WCHAR)*len);
strcpyW(cmd,prop); strcpyW(cmd,prop);
if (deformated) if (deformated)
...@@ -689,16 +689,16 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, ...@@ -689,16 +689,16 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd,spc); strcatW(cmd,spc);
strcatW(cmd,deformated); strcatW(cmd,deformated);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
} }
HeapFree(GetProcessHeap(),0,prop); msi_free(prop);
TRACE("executing exe %s \n",debugstr_w(cmd)); TRACE("executing exe %s \n",debugstr_w(cmd));
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL, rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info); c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd); msi_free(cmd);
if ( !rc ) if ( !rc )
{ {
...@@ -726,7 +726,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source, ...@@ -726,7 +726,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
SetCurrentDirectoryW(filename); SetCurrentDirectoryW(filename);
HeapFree(GetProcessHeap(),0,filename); msi_free(filename);
deformat_string(package,target,&deformated); deformat_string(package,target,&deformated);
...@@ -737,7 +737,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source, ...@@ -737,7 +737,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL, rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info); c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
if ( !rc ) if ( !rc )
{ {
...@@ -777,7 +777,7 @@ void ACTION_FinishCustomActions(MSIPACKAGE* package) ...@@ -777,7 +777,7 @@ void ACTION_FinishCustomActions(MSIPACKAGE* package)
} }
CloseHandle( action->handle ); CloseHandle( action->handle );
HeapFree( GetProcessHeap(), 0, action->name ); msi_free( action->name );
HeapFree( GetProcessHeap(), 0, action ); msi_free( action );
} }
} }
...@@ -93,7 +93,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) ...@@ -93,7 +93,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
/* UINT len = lstrlenW( szPerist ) + 1; */ /* UINT len = lstrlenW( szPerist ) + 1; */
FIXME("don't support persist files yet\b"); FIXME("don't support persist files yet\b");
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
/* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */ /* szMode = msi_alloc( len * sizeof (DWORD) ); */
} }
else if( szPersist == MSIDBOPEN_READONLY ) else if( szPersist == MSIDBOPEN_READONLY )
{ {
...@@ -220,8 +220,8 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB) ...@@ -220,8 +220,8 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
end: end:
if( HIWORD(szPersist) ) if( HIWORD(szPersist) )
HeapFree( GetProcessHeap(), 0, szwPersist ); msi_free( szwPersist );
HeapFree( GetProcessHeap(), 0, szwDBPath ); msi_free( szwDBPath );
return r; return r;
} }
...@@ -276,8 +276,8 @@ UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle, ...@@ -276,8 +276,8 @@ UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
r = MsiDatabaseImportW( handle, path, file ); r = MsiDatabaseImportW( handle, path, file );
end: end:
HeapFree( GetProcessHeap(), 0, path ); msi_free( path );
HeapFree( GetProcessHeap(), 0, file ); msi_free( file );
return r; return r;
} }
...@@ -344,9 +344,9 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable, ...@@ -344,9 +344,9 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable,
r = MsiDatabaseExportW( handle, table, path, file ); r = MsiDatabaseExportW( handle, table, path, file );
end: end:
HeapFree( GetProcessHeap(), 0, table ); msi_free( table );
HeapFree( GetProcessHeap(), 0, path ); msi_free( path );
HeapFree( GetProcessHeap(), 0, file ); msi_free( file );
return r; return r;
} }
...@@ -72,7 +72,7 @@ static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp ...@@ -72,7 +72,7 @@ static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp
create_full_pathW(install_path); create_full_pathW(install_path);
folder->State = 2; folder->State = 2;
} }
HeapFree(GetProcessHeap(), 0, install_path); msi_free(install_path);
return rc; return rc;
} }
...@@ -115,7 +115,7 @@ static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name, ...@@ -115,7 +115,7 @@ static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name,
CloseHandle(the_file); CloseHandle(the_file);
TRACE("wrote %li bytes to %s\n",write,debugstr_w(source)); TRACE("wrote %li bytes to %s\n",write,debugstr_w(source));
end: end:
HeapFree(GetProcessHeap(),0,data); msi_free(data);
return rc; return rc;
} }
...@@ -129,12 +129,12 @@ typedef struct ...@@ -129,12 +129,12 @@ typedef struct
static void * cabinet_alloc(ULONG cb) static void * cabinet_alloc(ULONG cb)
{ {
return HeapAlloc(GetProcessHeap(), 0, cb); return msi_alloc(cb);
} }
static void cabinet_free(void *pv) static void cabinet_free(void *pv)
{ {
HeapFree(GetProcessHeap(), 0, pv); msi_free(pv);
} }
static INT_PTR cabinet_open(char *pszFile, int oflag, int pmode) static INT_PTR cabinet_open(char *pszFile, int oflag, int pmode)
...@@ -218,14 +218,14 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -218,14 +218,14 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
if (!f) if (!f)
{ {
ERR("Unknown File in Cabinent (%s)\n",debugstr_w(given_file)); ERR("Unknown File in Cabinent (%s)\n",debugstr_w(given_file));
HeapFree(GetProcessHeap(),0,given_file); msi_free(given_file);
return 0; return 0;
} }
if (!((f->State == 1 || f->State == 2))) if (!((f->State == 1 || f->State == 2)))
{ {
TRACE("Skipping extraction of %s\n",debugstr_w(given_file)); TRACE("Skipping extraction of %s\n",debugstr_w(given_file));
HeapFree(GetProcessHeap(),0,given_file); msi_free(given_file);
return 0; return 0;
} }
...@@ -238,7 +238,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -238,7 +238,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
/* track this file so it can be deleted if not installed */ /* track this file so it can be deleted if not installed */
trackpath=strdupAtoW(file); trackpath=strdupAtoW(file);
tracknametmp=strdupAtoW(strrchr(file,'\\')+1); tracknametmp=strdupAtoW(strrchr(file,'\\')+1);
trackname = HeapAlloc(GetProcessHeap(),0,(strlenW(tracknametmp) + trackname = msi_alloc((strlenW(tracknametmp) +
strlenW(tmpprefix)+1) * sizeof(WCHAR)); strlenW(tmpprefix)+1) * sizeof(WCHAR));
strcpyW(trackname,tmpprefix); strcpyW(trackname,tmpprefix);
...@@ -246,9 +246,9 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -246,9 +246,9 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
track_tempfile(data->package, trackname, trackpath); track_tempfile(data->package, trackname, trackpath);
HeapFree(GetProcessHeap(),0,trackpath); msi_free(trackpath);
HeapFree(GetProcessHeap(),0,trackname); msi_free(trackname);
HeapFree(GetProcessHeap(),0,tracknametmp); msi_free(tracknametmp);
/* the UI chunk */ /* the UI chunk */
uirow=MSI_CreateRecord(9); uirow=MSI_CreateRecord(9);
...@@ -259,7 +259,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -259,7 +259,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
MSI_RecordSetInteger( uirow, 6, f->FileSize ); MSI_RecordSetInteger( uirow, 6, f->FileSize );
ui_actiondata(data->package,szInstallFiles,uirow); ui_actiondata(data->package,szInstallFiles,uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
HeapFree(GetProcessHeap(),0,uipath); msi_free(uipath);
ui_progress( data->package, 2, f->FileSize, 0, 0); ui_progress( data->package, 2, f->FileSize, 0, 0);
...@@ -324,7 +324,7 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source, ...@@ -324,7 +324,7 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
if (!(cab_path = strdupWtoA( path ))) if (!(cab_path = strdupWtoA( path )))
{ {
FDIDestroy(hfdi); FDIDestroy(hfdi);
HeapFree(GetProcessHeap(), 0, cabinet); msi_free(cabinet);
return FALSE; return FALSE;
} }
...@@ -338,8 +338,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source, ...@@ -338,8 +338,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
FDIDestroy(hfdi); FDIDestroy(hfdi);
HeapFree(GetProcessHeap(), 0, cabinet); msi_free(cabinet);
HeapFree(GetProcessHeap(), 0, cab_path); msi_free(cab_path);
return ret; return ret;
} }
...@@ -352,7 +352,7 @@ static VOID set_file_source(MSIPACKAGE* package, MSIFILE* file, MSICOMPONENT* ...@@ -352,7 +352,7 @@ static VOID set_file_source(MSIPACKAGE* package, MSIFILE* file, MSICOMPONENT*
LPWSTR p; LPWSTR p;
p = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL); p = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
file->SourcePath = build_directory_name(2, p, file->ShortName); file->SourcePath = build_directory_name(2, p, file->ShortName);
HeapFree(GetProcessHeap(),0,p); msi_free(p);
} }
else else
file->SourcePath = build_directory_name(2, path, file->File); file->SourcePath = build_directory_name(2, path, file->File);
...@@ -419,15 +419,15 @@ static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume, ...@@ -419,15 +419,15 @@ static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume,
prompt = MSI_RecordGetString(row,3); prompt = MSI_RecordGetString(row,3);
msg = generate_error_string(package, 1302, 1, prompt); msg = generate_error_string(package, 1302, 1, prompt);
rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL); rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL);
HeapFree(GetProcessHeap(),0,volume); msi_free(volume);
HeapFree(GetProcessHeap(),0,msg); msi_free(msg);
if (rc == IDOK) if (rc == IDOK)
ok = check_for_sourcefile(path); ok = check_for_sourcefile(path);
else else
return ERROR_INSTALL_USEREXIT; return ERROR_INSTALL_USEREXIT;
} }
HeapFree(GetProcessHeap(),0,last_volume); msi_free(last_volume);
last_volume = strdupW(volume); last_volume = strdupW(volume);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -457,8 +457,8 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file, ...@@ -457,8 +457,8 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
/* cleanup signal */ /* cleanup signal */
if (!package) if (!package)
{ {
HeapFree(GetProcessHeap(),0,last_path); msi_free(last_path);
HeapFree(GetProcessHeap(),0,last_volume); msi_free(last_volume);
last_sequence = 0; last_sequence = 0;
last_path = NULL; last_path = NULL;
last_volume = NULL; last_volume = NULL;
...@@ -488,7 +488,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file, ...@@ -488,7 +488,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
volume = MSI_RecordGetString(row, 5); volume = MSI_RecordGetString(row, 5);
prompt = MSI_RecordGetString(row, 3); prompt = MSI_RecordGetString(row, 3);
HeapFree(GetProcessHeap(),0,last_path); msi_free(last_path);
last_path = NULL; last_path = NULL;
if (file->Attributes & msidbFileAttributesNoncompressed) if (file->Attributes & msidbFileAttributesNoncompressed)
...@@ -540,12 +540,12 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file, ...@@ -540,12 +540,12 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
MSICODE_PRODUCT|MSISOURCETYPE_NETWORK, MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_LASTUSEDSOURCEW, path); INSTALLPROPERTY_LASTUSEDSOURCEW, path);
HeapFree(GetProcessHeap(),0,path); msi_free(path);
} }
else else
{ {
sz = MAX_PATH; sz = MAX_PATH;
last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR)); last_path = msi_alloc(MAX_PATH*sizeof(WCHAR));
if (MSI_GetPropertyW(package, cszSourceDir, source, &sz)) if (MSI_GetPropertyW(package, cszSourceDir, source, &sz))
{ {
ERR("No Source dir defined \n"); ERR("No Source dir defined \n");
...@@ -581,7 +581,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file, ...@@ -581,7 +581,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
else else
{ {
sz = MAX_PATH; sz = MAX_PATH;
last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR)); last_path = msi_alloc(MAX_PATH*sizeof(WCHAR));
MSI_GetPropertyW(package,cszSourceDir,source,&sz); MSI_GetPropertyW(package,cszSourceDir,source,&sz);
strcpyW(last_path,source); strcpyW(last_path,source);
rc = ready_volume(package, last_path, last_volume, row, &type); rc = ready_volume(package, last_path, last_volume, row, &type);
...@@ -699,10 +699,10 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -699,10 +699,10 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
} }
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL); p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
HeapFree(GetProcessHeap(),0,file->TargetPath); msi_free(file->TargetPath);
file->TargetPath = build_directory_name(2, p, file->FileName); file->TargetPath = build_directory_name(2, p, file->FileName);
HeapFree(GetProcessHeap(),0,p); msi_free(p);
} }
} }
...@@ -808,7 +808,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) ...@@ -808,7 +808,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
ERR("Original file unknown %s\n",debugstr_w(file_key)); ERR("Original file unknown %s\n",debugstr_w(file_key));
HeapFree(GetProcessHeap(),0,file_source); msi_free(file_source);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -841,7 +841,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) ...@@ -841,7 +841,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (!dest_path) if (!dest_path)
{ {
FIXME("Unable to get destination folder, try AppSearch properties\n"); FIXME("Unable to get destination folder, try AppSearch properties\n");
HeapFree(GetProcessHeap(),0,file_source); msi_free(file_source);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
} }
...@@ -862,9 +862,9 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) ...@@ -862,9 +862,9 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
FIXME("We should track these duplicate files as well\n"); FIXME("We should track these duplicate files as well\n");
HeapFree(GetProcessHeap(),0,dest_path); msi_free(dest_path);
HeapFree(GetProcessHeap(),0,dest); msi_free(dest);
HeapFree(GetProcessHeap(),0,file_source); msi_free(file_source);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -56,7 +56,7 @@ static LPWSTR build_default_format(MSIRECORD* record) ...@@ -56,7 +56,7 @@ static LPWSTR build_default_format(MSIRECORD* record)
count = MSI_RecordGetFieldCount(record); count = MSI_RecordGetFieldCount(record);
rc = HeapAlloc(GetProcessHeap(),0,(11*count)*sizeof(WCHAR)); rc = msi_alloc((11*count)*sizeof(WCHAR));
rc[0] = 0; rc[0] = 0;
for (i = 1; i <= count; i++) for (i = 1; i <= count; i++)
{ {
...@@ -124,7 +124,7 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz, ...@@ -124,7 +124,7 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz,
{ {
*sz = (size-1) * sizeof (WCHAR); *sz = (size-1) * sizeof (WCHAR);
size ++; size ++;
value = HeapAlloc(GetProcessHeap(),0,size * sizeof(WCHAR)); value = msi_alloc(size * sizeof(WCHAR));
GetShortPathNameW( file->TargetPath, value, size ); GetShortPathNameW( file->TargetPath, value, size );
} }
else else
...@@ -150,7 +150,7 @@ static LPWSTR deformat_environment(MSIPACKAGE* package, LPCWSTR key, ...@@ -150,7 +150,7 @@ static LPWSTR deformat_environment(MSIPACKAGE* package, LPCWSTR key,
if (sz > 0) if (sz > 0)
{ {
sz++; sz++;
value = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR)); value = msi_alloc(sz * sizeof(WCHAR));
GetEnvironmentVariableW(&key[1],value,sz); GetEnvironmentVariableW(&key[1],value,sz);
*chunk = (strlenW(value)) * sizeof(WCHAR); *chunk = (strlenW(value)) * sizeof(WCHAR);
} }
...@@ -168,7 +168,7 @@ static LPWSTR deformat_NULL(DWORD* chunk) ...@@ -168,7 +168,7 @@ static LPWSTR deformat_NULL(DWORD* chunk)
{ {
LPWSTR value; LPWSTR value;
value = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*2); value = msi_alloc(sizeof(WCHAR)*2);
value[0] = 0; value[0] = 0;
*chunk = sizeof(WCHAR); *chunk = sizeof(WCHAR);
return value; return value;
...@@ -178,7 +178,7 @@ static LPWSTR deformat_escape(LPCWSTR key, DWORD* chunk) ...@@ -178,7 +178,7 @@ static LPWSTR deformat_escape(LPCWSTR key, DWORD* chunk)
{ {
LPWSTR value; LPWSTR value;
value = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*2); value = msi_alloc(sizeof(WCHAR)*2);
value[0] = key[0]; value[0] = key[0];
*chunk = sizeof(WCHAR); *chunk = sizeof(WCHAR);
...@@ -260,7 +260,7 @@ static BOOL find_next_group(LPCWSTR source, DWORD len_remaining, ...@@ -260,7 +260,7 @@ static BOOL find_next_group(LPCWSTR source, DWORD len_remaining,
*mark2 = &(*mark)[i]; *mark2 = &(*mark)[i];
i = *mark2 - *mark; i = *mark2 - *mark;
*group = HeapAlloc(GetProcessHeap(),0,i*sizeof(WCHAR)); *group = msi_alloc(i*sizeof(WCHAR));
i -= 1; i -= 1;
memcpy(*group,&(*mark)[1],i*sizeof(WCHAR)); memcpy(*group,&(*mark)[1],i*sizeof(WCHAR));
...@@ -306,7 +306,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining, ...@@ -306,7 +306,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
*mark2 = &(*mark)[i-1]; *mark2 = &(*mark)[i-1];
i = *mark2 - *mark; i = *mark2 - *mark;
*key = HeapAlloc(GetProcessHeap(),0,i*sizeof(WCHAR)); *key = msi_alloc(i*sizeof(WCHAR));
/* do not have the [] in the key */ /* do not have the [] in the key */
i -= 1; i -= 1;
memcpy(*key,&(*mark)[1],i*sizeof(WCHAR)); memcpy(*key,&(*mark)[1],i*sizeof(WCHAR));
...@@ -319,7 +319,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining, ...@@ -319,7 +319,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len, static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
MSIRECORD* record, DWORD* size) MSIRECORD* record, DWORD* size)
{ {
LPWSTR value; LPWSTR value = NULL;
LPCWSTR mark, mark2; LPCWSTR mark, mark2;
LPWSTR key; LPWSTR key;
BOOL nested; BOOL nested;
...@@ -337,14 +337,14 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len, ...@@ -337,14 +337,14 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
if (!find_next_outermost_key(group, len, &key, &mark, &mark2, &nested)) if (!find_next_outermost_key(group, len, &key, &mark, &mark2, &nested))
{ {
*size = (len+2)*sizeof(WCHAR); *size = (len+2)*sizeof(WCHAR);
value = HeapAlloc(GetProcessHeap(),0,*size); value = msi_alloc(*size);
sprintfW(value,fmt,group); sprintfW(value,fmt,group);
/* do not return size of the null at the end */ /* do not return size of the null at the end */
*size = (len+1)*sizeof(WCHAR); *size = (len+1)*sizeof(WCHAR);
return value; return value;
} }
HeapFree(GetProcessHeap(),0,key); msi_free(key);
failcount = 0; failcount = 0;
sz = deformat_string_internal(package, group, &value, strlenW(group), sz = deformat_string_internal(package, group, &value, strlenW(group),
record, &failcount); record, &failcount);
...@@ -357,11 +357,11 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len, ...@@ -357,11 +357,11 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
{ {
LPWSTR v2; LPWSTR v2;
v2 = HeapAlloc(GetProcessHeap(),0,(sz+2)*sizeof(WCHAR)); v2 = msi_alloc((sz+2)*sizeof(WCHAR));
v2[0] = '{'; v2[0] = '{';
memcpy(&v2[1],value,sz*sizeof(WCHAR)); memcpy(&v2[1],value,sz*sizeof(WCHAR));
v2[sz+1]='}'; v2[sz+1]='}';
HeapFree(GetProcessHeap(),0,value); msi_free(value);
*size = (sz+2)*sizeof(WCHAR); *size = (sz+2)*sizeof(WCHAR);
return v2; return v2;
...@@ -407,7 +407,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -407,7 +407,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
(scanW(ptr,'{',len) && !scanW(ptr,'}',len))) (scanW(ptr,'{',len) && !scanW(ptr,'}',len)))
{ {
/* not formatted */ /* not formatted */
*data = HeapAlloc(GetProcessHeap(),0,(len*sizeof(WCHAR))); *data = msi_alloc((len*sizeof(WCHAR)));
memcpy(*data,ptr,len*sizeof(WCHAR)); memcpy(*data,ptr,len*sizeof(WCHAR));
TRACE("Returning %s\n",debugstr_wn(*data,len)); TRACE("Returning %s\n",debugstr_wn(*data,len));
return len; return len;
...@@ -437,9 +437,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -437,9 +437,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
chunk = (len - (progress - ptr)) * sizeof(WCHAR); chunk = (len - (progress - ptr)) * sizeof(WCHAR);
TRACE("after chunk is %li + %li\n",size,chunk); TRACE("after chunk is %li + %li\n",size,chunk);
if (size) if (size)
nd2 = HeapReAlloc(GetProcessHeap(),0,newdata,(size+chunk)); nd2 = msi_realloc(newdata,(size+chunk));
else else
nd2 = HeapAlloc(GetProcessHeap(),0,chunk); nd2 = msi_alloc(chunk);
newdata = nd2; newdata = nd2;
memcpy(&newdata[size],progress,chunk); memcpy(&newdata[size],progress,chunk);
...@@ -455,9 +455,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -455,9 +455,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE("%i (%i) characters before marker\n",cnt,(mark-progress)); TRACE("%i (%i) characters before marker\n",cnt,(mark-progress));
size += cnt * sizeof(WCHAR); size += cnt * sizeof(WCHAR);
if (!old_size) if (!old_size)
tgt = HeapAlloc(GetProcessHeap(),0,size); tgt = msi_alloc(size);
else else
tgt = HeapReAlloc(GetProcessHeap(),0,newdata,size); tgt = msi_realloc(newdata,size);
newdata = tgt; newdata = tgt;
memcpy(&newdata[old_size],progress,(cnt * sizeof(WCHAR))); memcpy(&newdata[old_size],progress,(cnt * sizeof(WCHAR)));
} }
...@@ -470,7 +470,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -470,7 +470,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
deformat_string_internal(package, key, &value, strlenW(key)+1, deformat_string_internal(package, key, &value, strlenW(key)+1,
record, failcount); record, failcount);
HeapFree(GetProcessHeap(),0,key); msi_free(key);
key = value; key = value;
} }
...@@ -494,7 +494,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -494,7 +494,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
{ {
DWORD keylen = strlenW(key); DWORD keylen = strlenW(key);
chunk = (keylen + 2)*sizeof(WCHAR); chunk = (keylen + 2)*sizeof(WCHAR);
value = HeapAlloc(GetProcessHeap(),0,chunk); value = msi_alloc(chunk);
value[0] = '['; value[0] = '[';
memcpy(&value[1],key,keylen*sizeof(WCHAR)); memcpy(&value[1],key,keylen*sizeof(WCHAR));
value[1+keylen] = ']'; value[1+keylen] = ']';
...@@ -532,7 +532,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -532,7 +532,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
else else
{ {
static const WCHAR fmt[] = {'[','%','s',']',0}; static const WCHAR fmt[] = {'[','%','s',']',0};
value = HeapAlloc(GetProcessHeap(),0,10); value = msi_alloc(10);
sprintfW(value,fmt,key); sprintfW(value,fmt,key);
chunk = strlenW(value)*sizeof(WCHAR); chunk = strlenW(value)*sizeof(WCHAR);
} }
...@@ -542,7 +542,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -542,7 +542,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
} }
} }
HeapFree(GetProcessHeap(),0,key); msi_free(key);
if (value!=NULL) if (value!=NULL)
{ {
...@@ -550,13 +550,13 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, ...@@ -550,13 +550,13 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE("value %s, chunk %li size %li\n",debugstr_w((LPWSTR)value), TRACE("value %s, chunk %li size %li\n",debugstr_w((LPWSTR)value),
chunk, size); chunk, size);
if (size) if (size)
nd2= HeapReAlloc(GetProcessHeap(),0,newdata,(size + chunk)); nd2= msi_realloc(newdata,(size + chunk));
else else
nd2= HeapAlloc(GetProcessHeap(),0,chunk); nd2= msi_alloc(chunk);
newdata = nd2; newdata = nd2;
memcpy(&newdata[size],value,chunk); memcpy(&newdata[size],value,chunk);
size+=chunk; size+=chunk;
HeapFree(GetProcessHeap(),0,value); msi_free(value);
} }
else if (failcount && *failcount >=0 ) else if (failcount && *failcount >=0 )
(*failcount)++; (*failcount)++;
...@@ -614,8 +614,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer, ...@@ -614,8 +614,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
*size = len; *size = len;
HeapFree(GetProcessHeap(),0,rec); msi_free(rec);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
return rc; return rc;
} }
...@@ -658,8 +658,8 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer, ...@@ -658,8 +658,8 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
*size = lenA; *size = lenA;
HeapFree(GetProcessHeap(),0,rec); msi_free(rec);
HeapFree(GetProcessHeap(),0,deformated); msi_free(deformated);
return rc; return rc;
} }
......
...@@ -50,7 +50,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction ) ...@@ -50,7 +50,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
ret = MsiDoActionW( hInstall, szwAction ); ret = MsiDoActionW( hInstall, szwAction );
HeapFree( GetProcessHeap(), 0, szwAction ); msi_free( szwAction );
return ret; return ret;
} }
...@@ -148,7 +148,7 @@ UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, ...@@ -148,7 +148,7 @@ UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
return ERROR_DIRECTORY; return ERROR_DIRECTORY;
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf ); r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
HeapFree( GetProcessHeap(), 0, path ); msi_free( path );
return r; return r;
} }
...@@ -173,7 +173,7 @@ UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder, ...@@ -173,7 +173,7 @@ UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf ); r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf );
HeapFree( GetProcessHeap(), 0, szwFolder ); msi_free( szwFolder );
return r; return r;
} }
...@@ -227,7 +227,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, ...@@ -227,7 +227,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
return ERROR_DIRECTORY; return ERROR_DIRECTORY;
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf ); r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
HeapFree( GetProcessHeap(), 0, path ); msi_free( path );
return r; return r;
} }
...@@ -248,7 +248,7 @@ UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder, ...@@ -248,7 +248,7 @@ UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
folder = strdupAtoW( szFolder ); folder = strdupAtoW( szFolder );
r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf ); r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf );
HeapFree( GetProcessHeap(), 0, folder ); msi_free( folder );
return r; return r;
} }
...@@ -291,14 +291,14 @@ UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, ...@@ -291,14 +291,14 @@ UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder,
szwFolderPath = strdupAtoW(szFolderPath); szwFolderPath = strdupAtoW(szFolderPath);
if (!szwFolderPath) if (!szwFolderPath)
{ {
HeapFree(GetProcessHeap(),0,szwFolder); msi_free(szwFolder);
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
rc = MsiSetTargetPathW(hInstall, szwFolder, szwFolderPath); rc = MsiSetTargetPathW(hInstall, szwFolder, szwFolderPath);
HeapFree(GetProcessHeap(),0,szwFolder); msi_free(szwFolder);
HeapFree(GetProcessHeap(),0,szwFolderPath); msi_free(szwFolderPath);
return rc; return rc;
} }
...@@ -343,7 +343,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder, ...@@ -343,7 +343,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
RemoveDirectoryW(szFolderPath); RemoveDirectoryW(szFolderPath);
} }
HeapFree(GetProcessHeap(),0,folder->Property); msi_free(folder->Property);
folder->Property = build_directory_name(2, szFolderPath, NULL); folder->Property = build_directory_name(2, szFolderPath, NULL);
if (lstrcmpiW(path, folder->Property) == 0) if (lstrcmpiW(path, folder->Property) == 0)
...@@ -352,10 +352,10 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder, ...@@ -352,10 +352,10 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
* Resolved Target has not really changed, so just * Resolved Target has not really changed, so just
* set this folder and do not recalculate everything. * set this folder and do not recalculate everything.
*/ */
HeapFree(GetProcessHeap(),0,folder->ResolvedTarget); msi_free(folder->ResolvedTarget);
folder->ResolvedTarget = NULL; folder->ResolvedTarget = NULL;
path2 = resolve_folder(package,szFolder,FALSE,TRUE,NULL); path2 = resolve_folder(package,szFolder,FALSE,TRUE,NULL);
HeapFree(GetProcessHeap(),0,path2); msi_free(path2);
} }
else else
{ {
...@@ -363,17 +363,17 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder, ...@@ -363,17 +363,17 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry ) LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
{ {
HeapFree( GetProcessHeap(),0,f->ResolvedTarget); msi_free(f->ResolvedTarget);
f->ResolvedTarget=NULL; f->ResolvedTarget=NULL;
} }
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry ) LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
{ {
path2 = resolve_folder(package, f->Directory, FALSE, TRUE, NULL); path2 = resolve_folder(package, f->Directory, FALSE, TRUE, NULL);
HeapFree(GetProcessHeap(),0,path2); msi_free(path2);
} }
} }
HeapFree(GetProcessHeap(),0,path); msi_free(path);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -454,7 +454,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, ...@@ -454,7 +454,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
rc = MsiSetFeatureStateW(hInstall,szwFeature, iState); rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
HeapFree(GetProcessHeap(),0,szwFeature); msi_free(szwFeature);
return rc; return rc;
} }
...@@ -526,7 +526,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPSTR szFeature, ...@@ -526,7 +526,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPSTR szFeature,
rc = MsiGetFeatureStateW(hInstall,szwFeature,piInstalled, piAction); rc = MsiGetFeatureStateW(hInstall,szwFeature,piInstalled, piAction);
HeapFree( GetProcessHeap(), 0 , szwFeature); msi_free( szwFeature);
return rc; return rc;
} }
...@@ -582,7 +582,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, ...@@ -582,7 +582,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
rc = MsiSetComponentStateW(hInstall, szwComponent, iState); rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
HeapFree(GetProcessHeap(), 0, szwComponent); msi_free(szwComponent);
return rc; return rc;
} }
...@@ -600,7 +600,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent, ...@@ -600,7 +600,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction); rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction);
HeapFree( GetProcessHeap(), 0 , szwComponent); msi_free( szwComponent);
return rc; return rc;
} }
...@@ -699,7 +699,7 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) ...@@ -699,7 +699,7 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
buffer = msi_dup_property( package, szProductLanguage ); buffer = msi_dup_property( package, szProductLanguage );
langid = atoiW(buffer); langid = atoiW(buffer);
HeapFree(GetProcessHeap(),0,buffer); msi_free(buffer);
msiobj_release (&package->hdr); msiobj_release (&package->hdr);
return langid; return langid;
} }
...@@ -49,7 +49,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg ) ...@@ -49,7 +49,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg )
LIST_FOR_EACH_SAFE( ptr, t, &query->mem ) LIST_FOR_EACH_SAFE( ptr, t, &query->mem )
{ {
HeapFree( GetProcessHeap(), 0, ptr ); msi_free( ptr );
} }
} }
...@@ -71,7 +71,7 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n ) ...@@ -71,7 +71,7 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n )
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
return r; return r;
x = lstrcmpW( name, col_name ); x = lstrcmpW( name, col_name );
HeapFree( GetProcessHeap(), 0, col_name ); msi_free( col_name );
if( !x ) if( !x )
{ {
*n = i; *n = i;
...@@ -101,7 +101,7 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb, ...@@ -101,7 +101,7 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb,
r = MsiDatabaseOpenViewW( hdb, szwQuery, phView); r = MsiDatabaseOpenViewW( hdb, szwQuery, phView);
HeapFree( GetProcessHeap(), 0, szwQuery ); msi_free( szwQuery );
return r; return r;
} }
...@@ -149,18 +149,18 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) ...@@ -149,18 +149,18 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
for (;;) for (;;)
{ {
va_list va; va_list va;
query = HeapAlloc( GetProcessHeap(), 0, size*sizeof(WCHAR) ); query = msi_alloc( size*sizeof(WCHAR) );
va_start(va, fmt); va_start(va, fmt);
res = vsnprintfW(query, size, fmt, va); res = vsnprintfW(query, size, fmt, va);
va_end(va); va_end(va);
if (res == -1) size *= 2; if (res == -1) size *= 2;
else if (res >= size) size = res + 1; else if (res >= size) size = res + 1;
else break; else break;
HeapFree( GetProcessHeap(), 0, query ); msi_free( query );
} }
/* perform the query */ /* perform the query */
r = MSI_DatabaseOpenViewW(db, query, view); r = MSI_DatabaseOpenViewW(db, query, view);
HeapFree(GetProcessHeap(), 0, query); msi_free(query);
return r; return r;
} }
...@@ -213,18 +213,18 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) ...@@ -213,18 +213,18 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... )
for (;;) for (;;)
{ {
va_list va; va_list va;
query = HeapAlloc( GetProcessHeap(), 0, size*sizeof(WCHAR) ); query = msi_alloc( size*sizeof(WCHAR) );
va_start(va, fmt); va_start(va, fmt);
res = vsnprintfW(query, size, fmt, va); res = vsnprintfW(query, size, fmt, va);
va_end(va); va_end(va);
if (res == -1) size *= 2; if (res == -1) size *= 2;
else if (res >= size) size = res + 1; else if (res >= size) size = res + 1;
else break; else break;
HeapFree( GetProcessHeap(), 0, query ); msi_free( query );
} }
/* perform the query */ /* perform the query */
r = MSI_DatabaseOpenViewW(db, query, &view); r = MSI_DatabaseOpenViewW(db, query, &view);
HeapFree(GetProcessHeap(), 0, query); msi_free(query);
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
{ {
...@@ -315,7 +315,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) ...@@ -315,7 +315,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
sval = MSI_makestring( query->db, ival ); sval = MSI_makestring( query->db, ival );
MSI_RecordSetStringW( rec, i, sval ); MSI_RecordSetStringW( rec, i, sval );
HeapFree( GetProcessHeap(), 0, sval ); msi_free( sval );
} }
else else
{ {
...@@ -492,7 +492,7 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR ...@@ -492,7 +492,7 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
continue; continue;
MSI_RecordSetStringW( rec, i+1, name ); MSI_RecordSetStringW( rec, i+1, name );
HeapFree( GetProcessHeap(), 0, name ); msi_free( name );
} }
*hRec = alloc_msihandle( &rec->hdr ); *hRec = alloc_msihandle( &rec->hdr );
...@@ -765,7 +765,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb, ...@@ -765,7 +765,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb,
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec ); r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec );
HeapFree( GetProcessHeap(), 0, szwTable ); msi_free( szwTable );
return r; return r;
} }
......
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