Module: wine Branch: master Commit: 929d234072e53755ea54ead840b223dbefd75bcd URL: http://source.winehq.org/git/wine.git/?a=commit;h=929d234072e53755ea54ead840...
Author: Hans Leidekker hans@codeweavers.com Date: Mon Oct 29 12:15:47 2012 +0100
msi: Return length instead of size from deformat_string.
---
dlls/msi/action.c | 4 ++-- dlls/msi/format.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 0017de7..ffcc003 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -2549,7 +2549,7 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type, DWORD if (!strncmpW(value, szMulti, 3)) ptr = value + 3;
- *size = deformat_string(package, ptr,(LPWSTR*)&data); + *size = deformat_string( package, ptr, (LPWSTR *)&data ) * sizeof(WCHAR);
/* add double NULL terminator */ if (*type == REG_MULTI_SZ) @@ -4943,7 +4943,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) { msi_reg_set_val_dword( hkey, szSystemComponent, 1 ); } - size = deformat_string(package, modpath_fmt, &buffer); + size = deformat_string(package, modpath_fmt, &buffer) * sizeof(WCHAR); RegSetValueExW(hkey, szModifyPath, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); RegSetValueExW(hkey, szUninstallString, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); msi_free(buffer); diff --git a/dlls/msi/format.c b/dlls/msi/format.c index 8188f13..08522a0 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -1026,19 +1026,19 @@ DWORD deformat_string( MSIPACKAGE *package, const WCHAR *ptr, WCHAR **data ) { if (ptr) { - DWORD size = 0; + DWORD len = 0; MSIRECORD *rec = MSI_CreateRecord( 1 );
MSI_RecordSetStringW( rec, 0, ptr ); - MSI_FormatRecordW( package, rec, NULL, &size ); + MSI_FormatRecordW( package, rec, NULL, &len );
- size++; - *data = msi_alloc( size * sizeof(WCHAR) ); - if (size > 1) MSI_FormatRecordW( package, rec, *data, &size ); + len++; + *data = msi_alloc( len * sizeof(WCHAR) ); + if (len > 1) MSI_FormatRecordW( package, rec, *data, &len ); else *data[0] = 0;
msiobj_release( &rec->hdr ); - return size * sizeof(WCHAR); + return len; } *data = NULL; return 0;