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