Commit 8ebbc8c0 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Reimplement msi_dup_property and msi_get_property_int.

parent a4fb1c94
......@@ -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 )
{
......
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