Commit 462ec1ba authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Return correct length for the empty string from deformat_string.

parent f6542bbb
...@@ -1023,24 +1023,23 @@ done: ...@@ -1023,24 +1023,23 @@ done:
} }
/* wrapper to resist a need for a full rewrite right now */ /* wrapper to resist a need for a full rewrite right now */
DWORD deformat_string( MSIPACKAGE *package, const WCHAR *ptr, WCHAR **data ) DWORD deformat_string( MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data )
{ {
if (ptr) DWORD len;
{ MSIRECORD *rec;
DWORD len = 0;
MSIRECORD *rec = MSI_CreateRecord( 1 );
MSI_RecordSetStringW( rec, 0, ptr );
MSI_FormatRecordW( package, rec, NULL, &len );
len++; *data = NULL;
*data = msi_alloc( len * sizeof(WCHAR) ); if (!fmt) return 0;
if (len > 1) MSI_FormatRecordW( package, rec, *data, &len ); if (!(rec = MSI_CreateRecord( 1 ))) return 0;
else *data[0] = 0;
MSI_RecordSetStringW( rec, 0, fmt );
MSI_FormatRecordW( package, rec, NULL, &len );
if (!(*data = msi_alloc( ++len * sizeof(WCHAR) )))
{
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
return len; return 0;
} }
*data = NULL; MSI_FormatRecordW( package, rec, *data, &len );
return 0; msiobj_release( &rec->hdr );
return len;
} }
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