summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-23 12:44:13 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:30:30 +0100
commit110f65204388339e16f739afc24ddbb2826f0b71 (patch)
tree932d88eacf1f12a6b27497f03601fb07ac6c1547
parent04479e90918ede00e836da76b813f85d19ddcb56 (diff)
downloadmsitools-110f65204388339e16f739afc24ddbb2826f0b71.tar.gz
msitools-110f65204388339e16f739afc24ddbb2826f0b71.tar.xz
msitools-110f65204388339e16f739afc24ddbb2826f0b71.zip
remove string argument from MsiGetSummaryInformation
Propedeutic to making MsiOpenDatabase ASCII-only.
-rw-r--r--include/libmsi.h5
-rw-r--r--libmsi/suminfo.c55
-rw-r--r--tests/testdatabase.c6
-rw-r--r--tests/testsuminfo.c37
-rw-r--r--tests/testsuminfo.ok4
5 files changed, 40 insertions, 67 deletions
diff --git a/include/libmsi.h b/include/libmsi.h
index 18b4c45..8f06853 100644
--- a/include/libmsi.h
+++ b/include/libmsi.h
@@ -200,10 +200,6 @@ unsigned MsiCreateTransformSummaryInfoA(LibmsiObject *, LibmsiObject *, const ch
unsigned MsiCreateTransformSummaryInfoW(LibmsiObject *, LibmsiObject *, const WCHAR *, int, int);
#define MsiCreateTransformSummaryInfo WINELIB_NAME_AW(MsiCreateTransformSummaryInfo)
-unsigned MsiGetSummaryInformationA(LibmsiObject *, const char *, unsigned, LibmsiObject **);
-unsigned MsiGetSummaryInformationW(LibmsiObject *, const WCHAR *, unsigned, LibmsiObject **);
-#define MsiGetSummaryInformation WINELIB_NAME_AW(MsiGetSummaryInformation)
-
unsigned MsiSummaryInfoGetPropertyA(LibmsiObject *,unsigned,unsigned *,int *,uint64_t*,char *,unsigned *);
unsigned MsiSummaryInfoGetPropertyW(LibmsiObject *,unsigned,unsigned *,int *,uint64_t*,WCHAR *,unsigned *);
#define MsiSummaryInfoGetProperty WINELIB_NAME_AW(MsiSummaryInfoGetProperty)
@@ -238,6 +234,7 @@ unsigned MsiDatabaseMergeW(LibmsiObject *, LibmsiObject *, const WCHAR *);
#define MsiDatabaseMerge WINELIB_NAME_AW(MsiDatabaseMerge)
/* Non Unicode */
+unsigned MsiGetSummaryInformation(LibmsiObject *, unsigned, LibmsiObject **);
unsigned MsiDatabaseCommit(LibmsiObject *);
unsigned MsiCloseHandle(LibmsiObject *);
diff --git a/libmsi/suminfo.c b/libmsi/suminfo.c
index 7f378fc..559788c 100644
--- a/libmsi/suminfo.c
+++ b/libmsi/suminfo.c
@@ -432,7 +432,7 @@ static unsigned save_summary_info( const LibmsiSummaryInfo * si, IStream *stm )
return ERROR_SUCCESS;
}
-LibmsiSummaryInfo *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCount )
+LibmsiSummaryInfo *MSI_GetSummaryInformation( IStorage *stg, unsigned uiUpdateCount )
{
IStream *stm = NULL;
LibmsiSummaryInfo *si;
@@ -462,35 +462,23 @@ LibmsiSummaryInfo *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateC
return si;
}
-unsigned MsiGetSummaryInformationW( LibmsiObject *hDatabase,
- const WCHAR *szDatabase, unsigned uiUpdateCount, LibmsiObject **pHandle )
+unsigned MsiGetSummaryInformation( LibmsiObject *hDatabase,
+ unsigned uiUpdateCount, LibmsiObject **pHandle )
{
LibmsiSummaryInfo *si;
LibmsiDatabase *db;
unsigned ret = ERROR_FUNCTION_FAILED;
- TRACE("%d %s %d %p\n", hDatabase, debugstr_w(szDatabase),
- uiUpdateCount, pHandle);
+ TRACE("%d %d %p\n", hDatabase, uiUpdateCount, pHandle);
if( !pHandle )
return ERROR_INVALID_PARAMETER;
- if( szDatabase && szDatabase[0] )
- {
- const WCHAR *persist = uiUpdateCount ? LIBMSI_DB_OPEN_TRANSACT : LIBMSI_DB_OPEN_READONLY;
-
- ret = MSI_OpenDatabaseW( szDatabase, persist, &db );
- if( ret != ERROR_SUCCESS )
- return ret;
- }
- else
- {
- db = msihandle2msiinfo( hDatabase, LIBMSI_OBJECT_TYPE_DATABASE );
- if( !db )
- return ERROR_INVALID_HANDLE;
- }
+ db = msihandle2msiinfo( hDatabase, LIBMSI_OBJECT_TYPE_DATABASE );
+ if( !db )
+ return ERROR_INVALID_HANDLE;
- si = MSI_GetSummaryInformationW( db->storage, uiUpdateCount );
+ si = MSI_GetSummaryInformation( db->storage, uiUpdateCount );
if (si)
{
*pHandle = &si->hdr;
@@ -501,29 +489,6 @@ unsigned MsiGetSummaryInformationW( LibmsiObject *hDatabase,
return ret;
}
-unsigned MsiGetSummaryInformationA(LibmsiObject *hDatabase,
- const char *szDatabase, unsigned uiUpdateCount, LibmsiObject **pHandle)
-{
- WCHAR *szwDatabase = NULL;
- unsigned ret;
-
- TRACE("%d %s %d %p\n", hDatabase, debugstr_a(szDatabase),
- uiUpdateCount, pHandle);
-
- if( szDatabase )
- {
- szwDatabase = strdupAtoW( szDatabase );
- if( !szwDatabase )
- return ERROR_FUNCTION_FAILED;
- }
-
- ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle);
-
- msi_free( szwDatabase );
-
- return ret;
-}
-
unsigned MsiSummaryInfoGetPropertyCount(LibmsiObject *hSummaryInfo, unsigned *pCount)
{
LibmsiSummaryInfo *si;
@@ -640,7 +605,7 @@ WCHAR *msi_get_suminfo_product( IStorage *stg )
LibmsiSummaryInfo *si;
WCHAR *prod;
- si = MSI_GetSummaryInformationW( stg, 0 );
+ si = MSI_GetSummaryInformation( stg, 0 );
if (!si)
{
ERR("no summary information!\n");
@@ -911,7 +876,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records,
unsigned i, j;
LibmsiSummaryInfo *si;
- si = MSI_GetSummaryInformationW( db->storage, num_records * (num_columns / 2) );
+ si = MSI_GetSummaryInformation( db->storage, num_records * (num_columns / 2) );
if (!si)
{
ERR("no summary information!\n");
diff --git a/tests/testdatabase.c b/tests/testdatabase.c
index ccdb6fe..e976f4f 100644
--- a/tests/testdatabase.c
+++ b/tests/testdatabase.c
@@ -1547,7 +1547,7 @@ static void test_streamtable(void)
MsiCloseHandle( view );
/* create a summary information stream */
- r = MsiGetSummaryInformationA( hdb, NULL, 1, &hsi );
+ r = MsiGetSummaryInformation( hdb, 1, &hsi );
ok( r == ERROR_SUCCESS, "Failed to get summary information handle: %u\n", r );
r = MsiSummaryInfoSetPropertyA( hsi, MSI_PID_SECURITY, VT_I4, 2, NULL, NULL );
@@ -2148,7 +2148,7 @@ static void test_suminfo_import(void)
/* ...its data is added to the special summary information stream */
- r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsi);
+ r = MsiGetSummaryInformation(hdb, 0, &hsi);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoGetPropertyCount(hsi, &count);
@@ -2875,7 +2875,7 @@ static unsigned set_summary_info(LibmsiObject *hdb)
LibmsiObject *suminfo;
/* build summary info */
- res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
+ res = MsiGetSummaryInformation(hdb, 7, &suminfo);
ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
diff --git a/tests/testsuminfo.c b/tests/testsuminfo.c
index 8f4a999..2c2ef03 100644
--- a/tests/testsuminfo.c
+++ b/tests/testsuminfo.c
@@ -47,21 +47,16 @@ static void test_suminfo(void)
r = MsiOpenDatabase(msifile, LIBMSI_DB_OPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
- r = MsiGetSummaryInformation(hdb, NULL, 0, NULL);
+ r = MsiGetSummaryInformation(hdb, 0, NULL);
ok(r == ERROR_INVALID_PARAMETER, "MsiGetSummaryInformation wrong error\n");
- r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo);
+ r = MsiGetSummaryInformation(hdb, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r);
r = MsiCloseHandle(hsuminfo);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
- r = MsiGetSummaryInformation(0, "", 0, &hsuminfo);
- todo_wine
- ok(r == ERROR_INSTALL_PACKAGE_INVALID || r == ERROR_INSTALL_PACKAGE_OPEN_FAILED,
- "MsiGetSummaryInformation failed %u\n", r);
-
- r = MsiGetSummaryInformation(hdb, "", 0, &hsuminfo);
+ r = MsiGetSummaryInformation(hdb, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r);
r = MsiSummaryInfoGetPropertyCount(0, NULL);
@@ -121,7 +116,7 @@ static void test_suminfo(void)
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
/* try again with the update count set */
- r = MsiGetSummaryInformation(hdb, NULL, 1, &hsuminfo);
+ r = MsiGetSummaryInformation(hdb, 1, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
r = MsiSummaryInfoSetProperty(hsuminfo, 0, VT_LPSTR, 1, NULL, NULL);
@@ -189,7 +184,7 @@ static void test_suminfo(void)
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
/* try again with a higher update count */
- r = MsiGetSummaryInformation(hdb, NULL, 10, &hsuminfo);
+ r = MsiGetSummaryInformation(hdb, 10, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
r = MsiSummaryInfoSetProperty(hsuminfo, MSI_PID_TITLE, VT_LPSTR, 0, NULL, "JungAh");
@@ -218,8 +213,11 @@ static void test_suminfo(void)
r = MsiCloseHandle(hdb);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
- /* filename, non-zero update count */
- r = MsiGetSummaryInformation(0, msifile, 1, &hsuminfo);
+ /* reread, non-zero update count */
+ r = MsiOpenDatabase(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb);
+ ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
+
+ r = MsiGetSummaryInformation(hdb, 1, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
r = MsiSummaryInfoSetProperty(hsuminfo, MSI_PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike");
@@ -231,8 +229,14 @@ static void test_suminfo(void)
r = MsiCloseHandle(hsuminfo);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
- /* filename, zero update count */
- r = MsiGetSummaryInformation(0, msifile, 0, &hsuminfo);
+ /* now with zero update count */
+ r = MsiCloseHandle(hdb);
+ ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
+
+ r = MsiOpenDatabase(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
+ ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
+
+ r = MsiGetSummaryInformation(hdb, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r);
r = MsiSummaryInfoSetProperty(hsuminfo, MSI_PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike");
@@ -244,6 +248,9 @@ static void test_suminfo(void)
r = MsiCloseHandle(hsuminfo);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
+ r = MsiCloseHandle(hdb);
+ ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
+
r = DeleteFile(msifile);
ok(r, "DeleteFile failed\n");
}
@@ -380,7 +387,7 @@ static void test_summary_binary(void)
r = MsiOpenDatabase(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
- r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo);
+ r = MsiGetSummaryInformation(hdb, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
/*
diff --git a/tests/testsuminfo.ok b/tests/testsuminfo.ok
index bfed273..06ffe4a 100644
--- a/tests/testsuminfo.ok
+++ b/tests/testsuminfo.ok
@@ -63,8 +63,12 @@ ok: r == ERROR_SUCCESS
ok: r == ERROR_SUCCESS
ok: r == ERROR_SUCCESS
ok: r == ERROR_SUCCESS
+ok: r == ERROR_SUCCESS
+ok: r == ERROR_SUCCESS
+ok: r == ERROR_SUCCESS
ok: r == ERROR_FUNCTION_FAILED
ok: r == ERROR_SUCCESS
+ok: r == ERROR_SUCCESS
ok: r
ok: r == S_OK
ok: r == S_OK