From 3a7c2d005c244039c5d7e89e7b7e09ecfbea0e03 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 9 Sep 2009 20:11:48 +0200 Subject: [PATCH] msi: Open the database read/write when the update count is greater than zero in MsiGetSummaryInformation. --- dlls/msi/suminfo.c | 4 +++- dlls/msi/tests/install.c | 5 +---- dlls/msi/tests/suminfo.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/dlls/msi/suminfo.c b/dlls/msi/suminfo.c index a02f949cb24..ef16665b781 100644 --- a/dlls/msi/suminfo.c +++ b/dlls/msi/suminfo.c @@ -475,7 +475,9 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, if( szDatabase ) { - ret = MSI_OpenDatabaseW( szDatabase, NULL, &db ); + LPCWSTR persist = uiUpdateCount ? MSIDBOPEN_TRANSACT : MSIDBOPEN_READONLY; + + ret = MSI_OpenDatabaseW( szDatabase, persist, &db ); if( ret != ERROR_SUCCESS ) return ret; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 3a22ca32da4..9d1237ad1fb 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -4491,10 +4491,7 @@ static void set_transform_summary_info(void) ok(r == ERROR_SUCCESS, "Failed to set summary info\n"); r = MsiSummaryInfoPersist(suminfo); - todo_wine - { - ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n"); - } + ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n"); r = MsiCloseHandle(suminfo); ok(r == ERROR_SUCCESS , "Failed to close suminfo\n"); diff --git a/dlls/msi/tests/suminfo.c b/dlls/msi/tests/suminfo.c index 3afd0d50d24..f0e7fddc8d2 100644 --- a/dlls/msi/tests/suminfo.c +++ b/dlls/msi/tests/suminfo.c @@ -239,6 +239,32 @@ static void test_suminfo(void) r = MsiCloseHandle(hdb); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + /* filename, non-zero update count */ + MsiGetSummaryInformation(0, msifile, 1, &hsuminfo); + ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); + + r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike"); + ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty wrong error\n"); + + r = MsiSummaryInfoPersist(hsuminfo); + ok(r == ERROR_SUCCESS, "MsiSummaryInfoPersist failed %u\n", r); + + r = MsiCloseHandle(hsuminfo); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r); + + /* filename, zero update count */ + MsiGetSummaryInformation(0, msifile, 0, &hsuminfo); + ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r); + + r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike"); + todo_wine ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error, %u\n", r); + + r = MsiSummaryInfoPersist(hsuminfo); + ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoPersist wrong error %u\n", r); + + r = MsiCloseHandle(hsuminfo); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + r = DeleteFile(msifile); ok(r, "DeleteFile failed\n"); } @@ -409,6 +435,12 @@ static void test_summary_binary(void) ok(r == ERROR_SUCCESS, "getpropcount failed\n"); todo_wine ok(count == 10, "prop count incorrect\n"); + r = MsiSummaryInfoSetProperty( hsuminfo, PID_TITLE, VT_LPSTR, 0, NULL, "Mike" ); + ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty failed %u\n", r); + + r = MsiSummaryInfoPersist( hsuminfo ); + ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoPersist failed %u\n", r); + MsiCloseHandle( hsuminfo ); MsiCloseHandle( hdb );