mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
Rename load_dynamic_stringW to msi_dup_record_field to better describe
what it does, and replace a few instances with MSI_RecordGetString to avoid allocating memory.
This commit is contained in:
parent
1e16caf55d
commit
51c6618d8d
@ -1086,15 +1086,15 @@ static MSICOMPONENT* load_component( MSIRECORD * row )
|
||||
return comp;
|
||||
|
||||
/* fill in the data */
|
||||
comp->Component = load_dynamic_stringW( row, 1 );
|
||||
comp->Component = msi_dup_record_field( row, 1 );
|
||||
|
||||
TRACE("Loading Component %s\n", debugstr_w(comp->Component));
|
||||
|
||||
comp->ComponentId = load_dynamic_stringW( row, 2 );
|
||||
comp->Directory = load_dynamic_stringW( row, 3 );
|
||||
comp->ComponentId = msi_dup_record_field( row, 2 );
|
||||
comp->Directory = msi_dup_record_field( row, 3 );
|
||||
comp->Attributes = MSI_RecordGetInteger(row,4);
|
||||
comp->Condition = load_dynamic_stringW( row, 5 );
|
||||
comp->KeyPath = load_dynamic_stringW( row, 6 );
|
||||
comp->Condition = msi_dup_record_field( row, 5 );
|
||||
comp->KeyPath = msi_dup_record_field( row, 6 );
|
||||
|
||||
comp->Installed = INSTALLSTATE_ABSENT;
|
||||
comp->Action = INSTALLSTATE_UNKNOWN;
|
||||
@ -1200,19 +1200,19 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
|
||||
|
||||
list_init( &feature->Components );
|
||||
|
||||
feature->Feature = load_dynamic_stringW( row, 1 );
|
||||
feature->Feature = msi_dup_record_field( row, 1 );
|
||||
|
||||
TRACE("Loading feature %s\n",debugstr_w(feature->Feature));
|
||||
|
||||
feature->Feature_Parent = load_dynamic_stringW( row, 2 );
|
||||
feature->Title = load_dynamic_stringW( row, 3 );
|
||||
feature->Description = load_dynamic_stringW( row, 4 );
|
||||
feature->Feature_Parent = msi_dup_record_field( row, 2 );
|
||||
feature->Title = msi_dup_record_field( row, 3 );
|
||||
feature->Description = msi_dup_record_field( row, 4 );
|
||||
|
||||
if (!MSI_RecordIsNull(row,5))
|
||||
feature->Display = MSI_RecordGetInteger(row,5);
|
||||
|
||||
feature->Level= MSI_RecordGetInteger(row,6);
|
||||
feature->Directory = load_dynamic_stringW( row, 7 );
|
||||
feature->Directory = msi_dup_record_field( row, 7 );
|
||||
feature->Attributes = MSI_RecordGetInteger(row,8);
|
||||
|
||||
feature->Installed = INSTALLSTATE_ABSENT;
|
||||
@ -1248,7 +1248,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
|
||||
if (!file)
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
file->File = load_dynamic_stringW( row, 1 );
|
||||
file->File = msi_dup_record_field( row, 1 );
|
||||
|
||||
component = MSI_RecordGetString( row, 2 );
|
||||
file->Component = get_loaded_component( package, component );
|
||||
@ -1256,15 +1256,15 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
|
||||
if (!file->Component)
|
||||
ERR("Unfound Component %s\n",debugstr_w(component));
|
||||
|
||||
file->FileName = load_dynamic_stringW( row, 3 );
|
||||
file->FileName = msi_dup_record_field( row, 3 );
|
||||
reduce_to_longfilename( file->FileName );
|
||||
|
||||
file->ShortName = load_dynamic_stringW( row, 3 );
|
||||
file->ShortName = msi_dup_record_field( row, 3 );
|
||||
reduce_to_shortfilename( file->ShortName );
|
||||
|
||||
file->FileSize = MSI_RecordGetInteger( row, 4 );
|
||||
file->Version = load_dynamic_stringW( row, 5 );
|
||||
file->Language = load_dynamic_stringW( row, 6 );
|
||||
file->Version = msi_dup_record_field( row, 5 );
|
||||
file->Language = msi_dup_record_field( row, 6 );
|
||||
file->Attributes = MSI_RecordGetInteger( row, 7 );
|
||||
file->Sequence = MSI_RecordGetInteger( row, 8 );
|
||||
|
||||
@ -1408,7 +1408,7 @@ static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir )
|
||||
if (!row)
|
||||
return NULL;
|
||||
|
||||
ptargetdir = targetdir = load_dynamic_stringW(row,3);
|
||||
ptargetdir = targetdir = msi_dup_record_field(row,3);
|
||||
|
||||
/* split src and target dir */
|
||||
if (strchrW(targetdir,':'))
|
||||
@ -2708,19 +2708,18 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE );
|
||||
if (module != NULL)
|
||||
if (module)
|
||||
{
|
||||
LPWSTR guid;
|
||||
guid = load_dynamic_stringW(row,1);
|
||||
CLSIDFromString(guid, &tl_struct.clsid);
|
||||
msi_free(guid);
|
||||
LPCWSTR guid;
|
||||
guid = MSI_RecordGetString(row,1);
|
||||
CLSIDFromString((LPWSTR)guid, &tl_struct.clsid);
|
||||
tl_struct.source = strdupW( file->TargetPath );
|
||||
tl_struct.path = NULL;
|
||||
|
||||
EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc,
|
||||
(LONG_PTR)&tl_struct);
|
||||
|
||||
if (tl_struct.path != NULL)
|
||||
if (tl_struct.path)
|
||||
{
|
||||
LPWSTR help = NULL;
|
||||
LPCWSTR helpid;
|
||||
@ -3956,7 +3955,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
||||
if (MSI_RecordIsNull(row,2))
|
||||
name = load_ttfname_from( file->TargetPath );
|
||||
else
|
||||
name = load_dynamic_stringW(row,2);
|
||||
name = msi_dup_record_field(row,2);
|
||||
|
||||
if (name)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
|
||||
|
||||
/* Helpers */
|
||||
extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
|
||||
extern WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
|
||||
extern LPWSTR msi_dup_record_field(MSIRECORD *row, INT index);
|
||||
extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
|
||||
extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
|
||||
BOOL set_prop, MSIFOLDER **folder);
|
||||
|
@ -118,15 +118,15 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
|
||||
}
|
||||
|
||||
/* get properties */
|
||||
sig->File = load_dynamic_stringW(row,2);
|
||||
minVersion = load_dynamic_stringW(row,3);
|
||||
sig->File = msi_dup_record_field(row,2);
|
||||
minVersion = msi_dup_record_field(row,3);
|
||||
if (minVersion)
|
||||
{
|
||||
ACTION_VerStrToInteger(minVersion, &sig->MinVersionMS,
|
||||
&sig->MinVersionLS);
|
||||
msi_free( minVersion);
|
||||
}
|
||||
maxVersion = load_dynamic_stringW(row,4);
|
||||
maxVersion = msi_dup_record_field(row,4);
|
||||
if (maxVersion)
|
||||
{
|
||||
ACTION_VerStrToInteger(maxVersion, &sig->MaxVersionMS,
|
||||
@ -139,7 +139,7 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
|
||||
sig->MaxSize = MSI_RecordGetInteger(row,6);
|
||||
if (sig->MaxSize == MSI_NULL_INTEGER)
|
||||
sig->MaxSize = 0;
|
||||
sig->Languages = load_dynamic_stringW(row,9);
|
||||
sig->Languages = msi_dup_record_field(row,9);
|
||||
time = MSI_RecordGetInteger(row,7);
|
||||
if (time != MSI_NULL_INTEGER)
|
||||
DosDateTimeToFileTime(HIWORD(time), LOWORD(time), &sig->MinTime);
|
||||
@ -276,9 +276,9 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
|
||||
}
|
||||
|
||||
root = MSI_RecordGetInteger(row,2);
|
||||
keyPath = load_dynamic_stringW(row,3);
|
||||
keyPath = msi_dup_record_field(row,3);
|
||||
/* FIXME: keyPath needs to be expanded for properties */
|
||||
valueName = load_dynamic_stringW(row,4);
|
||||
valueName = msi_dup_record_field(row,4);
|
||||
/* FIXME: valueName probably does too */
|
||||
type = MSI_RecordGetInteger(row,5);
|
||||
|
||||
@ -442,7 +442,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, BOOL *appFound,
|
||||
}
|
||||
|
||||
/* get file name */
|
||||
fileName = load_dynamic_stringW(row,2);
|
||||
fileName = msi_dup_record_field(row,2);
|
||||
FIXME("AppSearch unimplemented for IniLocator (ini file name %s)\n",
|
||||
debugstr_w(fileName));
|
||||
msi_free( fileName);
|
||||
|
@ -65,15 +65,15 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
|
||||
if (!appid)
|
||||
return NULL;
|
||||
|
||||
appid->AppID = load_dynamic_stringW( row, 1 );
|
||||
appid->AppID = msi_dup_record_field( row, 1 );
|
||||
TRACE("loading appid %s\n", debugstr_w( appid->AppID ));
|
||||
|
||||
buffer = MSI_RecordGetString(row,2);
|
||||
deformat_string( package, buffer, &appid->RemoteServerName );
|
||||
|
||||
appid->LocalServer = load_dynamic_stringW(row,3);
|
||||
appid->ServiceParameters = load_dynamic_stringW(row,4);
|
||||
appid->DllSurrogate = load_dynamic_stringW(row,5);
|
||||
appid->LocalServer = msi_dup_record_field(row,3);
|
||||
appid->ServiceParameters = msi_dup_record_field(row,4);
|
||||
appid->DllSurrogate = msi_dup_record_field(row,5);
|
||||
|
||||
appid->ActivateAtStorage = !MSI_RecordIsNull(row,6);
|
||||
appid->RunAsInteractiveUser = !MSI_RecordIsNull(row,7);
|
||||
@ -131,7 +131,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
|
||||
|
||||
list_add_tail( &package->progids, &progid->entry );
|
||||
|
||||
progid->ProgID = load_dynamic_stringW(row,1);
|
||||
progid->ProgID = msi_dup_record_field(row,1);
|
||||
TRACE("loading progid %s\n",debugstr_w(progid->ProgID));
|
||||
|
||||
buffer = MSI_RecordGetString(row,2);
|
||||
@ -144,12 +144,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
|
||||
if (progid->Class == NULL && buffer)
|
||||
FIXME("Unknown class %s\n",debugstr_w(buffer));
|
||||
|
||||
progid->Description = load_dynamic_stringW(row,4);
|
||||
progid->Description = msi_dup_record_field(row,4);
|
||||
|
||||
if (!MSI_RecordIsNull(row,6))
|
||||
{
|
||||
INT icon_index = MSI_RecordGetInteger(row,6);
|
||||
LPWSTR FileName = load_dynamic_stringW(row,5);
|
||||
LPCWSTR FileName = MSI_RecordGetString(row,5);
|
||||
LPWSTR FilePath;
|
||||
static const WCHAR fmt[] = {'%','s',',','%','i',0};
|
||||
|
||||
@ -160,7 +160,6 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
|
||||
sprintfW(progid->IconPath,fmt,FilePath,icon_index);
|
||||
|
||||
msi_free(FilePath);
|
||||
msi_free(FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -235,28 +234,28 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
|
||||
|
||||
list_add_tail( &package->classes, &cls->entry );
|
||||
|
||||
cls->clsid = load_dynamic_stringW( row, 1 );
|
||||
cls->clsid = msi_dup_record_field( row, 1 );
|
||||
TRACE("loading class %s\n",debugstr_w(cls->clsid));
|
||||
cls->Context = load_dynamic_stringW( row, 2 );
|
||||
cls->Context = msi_dup_record_field( row, 2 );
|
||||
buffer = MSI_RecordGetString(row,3);
|
||||
cls->Component = get_loaded_component(package, buffer);
|
||||
|
||||
cls->ProgIDText = load_dynamic_stringW(row,4);
|
||||
cls->ProgIDText = msi_dup_record_field(row,4);
|
||||
cls->ProgID = load_given_progid(package, cls->ProgIDText);
|
||||
|
||||
cls->Description = load_dynamic_stringW(row,5);
|
||||
cls->Description = msi_dup_record_field(row,5);
|
||||
|
||||
buffer = MSI_RecordGetString(row,6);
|
||||
if (buffer)
|
||||
cls->AppID = load_given_appid(package, buffer);
|
||||
|
||||
cls->FileTypeMask = load_dynamic_stringW(row,7);
|
||||
cls->FileTypeMask = msi_dup_record_field(row,7);
|
||||
|
||||
if (!MSI_RecordIsNull(row,9))
|
||||
{
|
||||
|
||||
INT icon_index = MSI_RecordGetInteger(row,9);
|
||||
LPWSTR FileName = load_dynamic_stringW(row,8);
|
||||
LPCWSTR FileName = MSI_RecordGetString(row,8);
|
||||
LPWSTR FilePath;
|
||||
static const WCHAR fmt[] = {'%','s',',','%','i',0};
|
||||
|
||||
@ -267,7 +266,6 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
|
||||
sprintfW(cls->IconPath,fmt,FilePath,icon_index);
|
||||
|
||||
msi_free(FilePath);
|
||||
msi_free(FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -300,7 +298,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
|
||||
}
|
||||
else
|
||||
{
|
||||
cls->DefInprocHandler32 = load_dynamic_stringW( row, 10);
|
||||
cls->DefInprocHandler32 = msi_dup_record_field( row, 10);
|
||||
reduce_to_longfilename(cls->DefInprocHandler32);
|
||||
}
|
||||
}
|
||||
@ -366,13 +364,13 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
|
||||
if (!mt)
|
||||
return mt;
|
||||
|
||||
mt->ContentType = load_dynamic_stringW( row, 1 );
|
||||
mt->ContentType = msi_dup_record_field( row, 1 );
|
||||
TRACE("loading mime %s\n", debugstr_w(mt->ContentType));
|
||||
|
||||
buffer = MSI_RecordGetString( row, 2 );
|
||||
mt->Extension = load_given_extension( package, buffer );
|
||||
|
||||
mt->clsid = load_dynamic_stringW( row, 3 );
|
||||
mt->clsid = msi_dup_record_field( row, 3 );
|
||||
mt->Class = load_given_class( package, mt->clsid );
|
||||
|
||||
list_add_tail( &package->mimes, &mt->entry );
|
||||
@ -428,13 +426,13 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
|
||||
|
||||
list_add_tail( &package->extensions, &ext->entry );
|
||||
|
||||
ext->Extension = load_dynamic_stringW( row, 1 );
|
||||
ext->Extension = msi_dup_record_field( row, 1 );
|
||||
TRACE("loading extension %s\n", debugstr_w(ext->Extension));
|
||||
|
||||
buffer = MSI_RecordGetString( row, 2 );
|
||||
ext->Component = get_loaded_component( package,buffer );
|
||||
|
||||
ext->ProgIDText = load_dynamic_stringW( row, 3 );
|
||||
ext->ProgIDText = msi_dup_record_field( row, 3 );
|
||||
ext->ProgID = load_given_progid( package, ext->ProgIDText );
|
||||
|
||||
buffer = MSI_RecordGetString( row, 4 );
|
||||
@ -505,7 +503,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
|
||||
if (!verb)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
verb->Verb = load_dynamic_stringW(row,2);
|
||||
verb->Verb = msi_dup_record_field(row,2);
|
||||
TRACE("loading verb %s\n",debugstr_w(verb->Verb));
|
||||
verb->Sequence = MSI_RecordGetInteger(row,3);
|
||||
|
||||
|
@ -125,8 +125,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
|
||||
' ','W','H','E','R','E',' ','`','A','c','t','i' ,'o','n','`',' ',
|
||||
'=',' ','\'','%','s','\'',0};
|
||||
UINT type;
|
||||
LPWSTR source;
|
||||
LPWSTR target;
|
||||
LPCWSTR source, target;
|
||||
WCHAR *deformated=NULL;
|
||||
|
||||
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, action );
|
||||
@ -135,8 +134,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
|
||||
|
||||
type = MSI_RecordGetInteger(row,2);
|
||||
|
||||
source = load_dynamic_stringW(row,3);
|
||||
target = load_dynamic_stringW(row,4);
|
||||
source = MSI_RecordGetString(row,3);
|
||||
target = MSI_RecordGetString(row,4);
|
||||
|
||||
TRACE("Handling custom action %s (%x %s %s)\n",debugstr_w(action),type,
|
||||
debugstr_w(source), debugstr_w(target));
|
||||
@ -231,8 +230,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
|
||||
}
|
||||
|
||||
end:
|
||||
msi_free(source);
|
||||
msi_free(target);
|
||||
msiobj_release(&row->hdr);
|
||||
return rc;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ static LPWSTR deformat_index(MSIRECORD* record, LPCWSTR key, DWORD* chunk )
|
||||
|
||||
index = atoiW(key);
|
||||
TRACE("record index %i\n",index);
|
||||
value = load_dynamic_stringW(record,index);
|
||||
value = msi_dup_record_field(record,index);
|
||||
if (value)
|
||||
*chunk = strlenW(value) * sizeof(WCHAR);
|
||||
else
|
||||
@ -584,7 +584,7 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
|
||||
|
||||
TRACE("%p %p %p %li\n",package, record ,buffer, *size);
|
||||
|
||||
rec = load_dynamic_stringW(record,0);
|
||||
rec = msi_dup_record_field(record,0);
|
||||
if (!rec)
|
||||
rec = build_default_format(record);
|
||||
|
||||
@ -631,7 +631,7 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
|
||||
|
||||
TRACE("%p %p %p %li\n",package, record ,buffer, *size);
|
||||
|
||||
rec = load_dynamic_stringW(record,0);
|
||||
rec = msi_dup_record_field(record,0);
|
||||
if (!rec)
|
||||
rec = build_default_format(record);
|
||||
|
||||
|
@ -107,36 +107,9 @@ LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
|
||||
return FilePath;
|
||||
}
|
||||
|
||||
WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
|
||||
LPWSTR msi_dup_record_field( MSIRECORD *row, INT index )
|
||||
{
|
||||
UINT rc;
|
||||
DWORD sz;
|
||||
LPWSTR ret;
|
||||
|
||||
sz = 0;
|
||||
if (MSI_RecordIsNull(row,index))
|
||||
return NULL;
|
||||
|
||||
rc = MSI_RecordGetStringW(row,index,NULL,&sz);
|
||||
|
||||
/* having an empty string is different than NULL */
|
||||
if (sz == 0)
|
||||
{
|
||||
ret = msi_alloc(sizeof(WCHAR));
|
||||
ret[0] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
sz ++;
|
||||
ret = msi_alloc(sz * sizeof (WCHAR));
|
||||
rc = MSI_RecordGetStringW(row,index,ret,&sz);
|
||||
if (rc!=ERROR_SUCCESS)
|
||||
{
|
||||
ERR("Unable to load dynamic string\n");
|
||||
msi_free(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
return ret;
|
||||
return strdupW( MSI_RecordGetString(row,index) );
|
||||
}
|
||||
|
||||
LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop)
|
||||
@ -751,7 +724,7 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
|
||||
|
||||
/* update the cached actionformat */
|
||||
msi_free(package->ActionFormat);
|
||||
package->ActionFormat = load_dynamic_stringW(row,3);
|
||||
package->ActionFormat = msi_dup_record_field(row,3);
|
||||
|
||||
msi_free(package->LastAction);
|
||||
package->LastAction = strdupW(action);
|
||||
|
Loading…
Reference in New Issue
Block a user