[WINESYNC] msi: Add support for exporting the _SummaryInformation table.

The _SummaryInformation table stores a lot of important information
about an MSI database.  This patch adds the ability to export that
table since, like _ForceCodepage, it is stored in a different format
than the other tables.

Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 79fd42fc1ae0747f509fce05cedf9e56c9f928bc by Erich E. Hoover <erich.e.hoover@gmail.com>
This commit is contained in:
winesync 2022-03-13 00:46:25 +01:00 committed by Mark Jansen
parent 3ad01e9aad
commit 87ce83f46a
No known key found for this signature in database
GPG Key ID: B39240EE84BEAE8B
2 changed files with 15 additions and 23 deletions

View File

@ -1062,11 +1062,8 @@ static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage )
{
static const char fmt[] = "\r\n\r\n%u\t_ForceCodepage\r\n";
char data[sizeof(fmt) + 10];
DWORD sz;
DWORD sz = sprintf( data, fmt, codepage );
sprintf( data, fmt, codepage );
sz = lstrlenA(data) + 1;
if (!WriteFile(handle, data, sz, &sz, NULL))
return ERROR_FUNCTION_FAILED;
@ -1078,24 +1075,22 @@ static UINT msi_export_summaryinformation( MSIDATABASE *db, HANDLE handle )
static const char header[] = "PropertyId\tValue\r\n"
"i2\tl255\r\n"
"_SummaryInformation\tPropertyId\r\n";
DWORD sz;
DWORD sz = ARRAY_SIZE(header) - 1;
sz = lstrlenA(header);
if (!WriteFile(handle, header, sz, &sz, NULL))
return ERROR_WRITE_FAULT;
return msi_export_suminfo( db, handle );
}
static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
LPCWSTR folder, LPCWSTR file )
static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, LPCWSTR file )
{
static const WCHAR summaryinformation[] = {
'_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0 };
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 };
static const WCHAR forcecodepage[] = {
'_','F','o','r','c','e','C','o','d','e','p','a','g','e',0 };
static const WCHAR summaryinformation[] = {
'_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0 };
MSIRECORD *rec = NULL;
MSIQUERY *view = NULL;
LPWSTR filename;

View File

@ -1121,8 +1121,8 @@ end:
static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
{
static const char fmt_systemtime[] = "%d/%02d/%02d %02d:%02d:%02d";
char data[20]; /* largest string: YYYY/MM/DD hh:mm:ss */
static const char fmt_systemtime[] = "%04u/%02u/%02u %02u:%02u:%02u";
char data[36]; /* largest string: YYYY/MM/DD hh:mm:ss */
static const char fmt_begin[] = "%u\t";
static const char data_end[] = "\r\n";
static const char fmt_int[] = "%u";
@ -1141,17 +1141,15 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
return r;
if (data_type == VT_EMPTY)
return ERROR_SUCCESS; /* property not set */
snprintf( data, sizeof(data), fmt_begin, row );
sz = lstrlenA( data );
sz = sprintf( data, fmt_begin, row );
if (!WriteFile( handle, data, sz, &sz, NULL ))
return ERROR_WRITE_FAULT;
switch (data_type)
switch( data_type )
{
case VT_I2:
case VT_I4:
snprintf( data, sizeof(data), fmt_int, int_value );
sz = lstrlenA( data );
sz = sprintf( data, fmt_int, int_value );
if (!WriteFile( handle, data, sz, &sz, NULL ))
return ERROR_WRITE_FAULT;
break;
@ -1165,7 +1163,7 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
msi_free( str.str.a );
return r;
}
sz = lstrlenA( str.str.a );
sz = len;
if (!WriteFile( handle, str.str.a, sz, &sz, NULL ))
{
msi_free( str.str.a );
@ -1176,10 +1174,9 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
case VT_FILETIME:
if (!FileTimeToSystemTime( &file_time, &system_time ))
return ERROR_FUNCTION_FAILED;
snprintf( data, sizeof(data), fmt_systemtime, system_time.wYear, system_time.wMonth,
system_time.wDay, system_time.wHour, system_time.wMinute,
system_time.wSecond );
sz = lstrlenA( data );
sz = sprintf( data, fmt_systemtime, system_time.wYear, system_time.wMonth,
system_time.wDay, system_time.wHour, system_time.wMinute,
system_time.wSecond );
if (!WriteFile( handle, data, sz, &sz, NULL ))
return ERROR_WRITE_FAULT;
break;
@ -1191,7 +1188,7 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row )
return ERROR_FUNCTION_FAILED;
}
sz = lstrlenA( data_end );
sz = ARRAY_SIZE(data_end) - 1;
if (!WriteFile( handle, data_end, sz, &sz, NULL ))
return ERROR_WRITE_FAULT;