Module: wine Branch: master Commit: 8ebbc8c0d2ca2e64e075d48b8d3849d4a876958f URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=8ebbc8c0d2ca2e64e075d48b...
Author: Mike McCormack mike@codeweavers.com Date: Fri Aug 25 17:58:50 2006 +0900
msi: Reimplement msi_dup_property and msi_get_property_int.
---
dlls/msi/helpers.c | 29 ----------------------------- dlls/msi/package.c | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c index 33a7fa2..45d3ebe 100644 --- a/dlls/msi/helpers.c +++ b/dlls/msi/helpers.c @@ -71,35 +71,6 @@ LPWSTR msi_dup_record_field( MSIRECORD * 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; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 13fd6ce..227be6c 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -1001,7 +1001,7 @@ UINT MSI_GetPropertyW( MSIPACKAGE *packa
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 *packa 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 ) {