msi: Reimplement msi_dup_property and msi_get_property_int.
This commit is contained in:
parent
a4fb1c94ac
commit
8ebbc8c0d2
|
@ -71,35 +71,6 @@ LPWSTR msi_dup_record_field( MSIRECORD *row, INT index )
|
|||
return strdupW( MSI_RecordGetString(row,index) );
|
||||
}
|
||||
|
||||
LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop)
|
||||
{
|
||||
DWORD sz = 0;
|
||||
LPWSTR str;
|
||||
UINT r;
|
||||
|
||||
r = MSI_GetPropertyW(package, prop, NULL, &sz);
|
||||
if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
|
||||
return NULL;
|
||||
|
||||
sz++;
|
||||
str = msi_alloc(sz*sizeof(WCHAR));
|
||||
r = MSI_GetPropertyW(package, prop, str, &sz);
|
||||
if (r != ERROR_SUCCESS)
|
||||
{
|
||||
msi_free(str);
|
||||
str = NULL;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def )
|
||||
{
|
||||
LPWSTR str = msi_dup_property( package, prop );
|
||||
int val = str ? atoiW( str ) : def;
|
||||
msi_free( str );
|
||||
return val;
|
||||
}
|
||||
|
||||
MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
|
||||
{
|
||||
MSICOMPONENT *comp;
|
||||
|
|
|
@ -1001,7 +1001,7 @@ UINT MSI_GetPropertyW( MSIPACKAGE *package, LPCWSTR szName,
|
|||
|
||||
if ( *pchValueBuf <= len )
|
||||
{
|
||||
TRACE("have %lu, need %lu -> ERROR_MORE_DATA\n", *pchValueBuf, len);
|
||||
TRACE("have %lu, need %u -> ERROR_MORE_DATA\n", *pchValueBuf, len);
|
||||
r = ERROR_MORE_DATA;
|
||||
}
|
||||
else
|
||||
|
@ -1012,6 +1012,28 @@ UINT MSI_GetPropertyW( MSIPACKAGE *package, LPCWSTR szName,
|
|||
return r;
|
||||
}
|
||||
|
||||
LPWSTR msi_dup_property( MSIPACKAGE *package, LPCWSTR szName )
|
||||
{
|
||||
msi_property *prop;
|
||||
LPWSTR value = NULL;
|
||||
|
||||
prop = msi_prop_find( package, szName );
|
||||
if (prop)
|
||||
value = strdupW( prop->value );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int msi_get_property_int( MSIPACKAGE *package, LPCWSTR name, int value )
|
||||
{
|
||||
msi_property *prop;
|
||||
|
||||
prop = msi_prop_find( package, name );
|
||||
if (prop)
|
||||
value = atoiW( prop->value );
|
||||
return value;
|
||||
}
|
||||
|
||||
static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
|
||||
awstring *szValueBuf, DWORD* pchValueBuf )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue