https://git.reactos.org/?p=reactos.git;a=commitdiff;h=87ce83f46aef1894f8a45d...
commit 87ce83f46aef1894f8a45d83a43e365a7dc2ca39 Author: winesync ros-dev@reactos.org AuthorDate: Sun Mar 13 00:46:25 2022 +0100 Commit: Mark Jansen mark.jansen@reactos.org CommitDate: Sun Mar 20 19:28:14 2022 +0100
[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 --- dll/win32/msi/database.c | 15 +++++---------- dll/win32/msi/suminfo.c | 23 ++++++++++------------- 2 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index 49fa16c5d81..df169128176 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -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; - - sprintf( data, fmt, codepage ); + DWORD sz = 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; diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 6b3a559f60c..d590ad46f68 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -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;