[6/6] msi: Add summary information stream to the streams table.
Hans Leidekker
hans at codeweavers.com
Fri Feb 19 05:27:36 CST 2010
---
dlls/msi/msipriv.h | 1 +
dlls/msi/streams.c | 21 ++++++++++++++++-----
dlls/msi/suminfo.c | 3 ---
dlls/msi/tests/db.c | 42 +++++++++++++++++++++++++++++++++++++++++-
4 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 5ea707f..2278ff7 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -1074,6 +1074,7 @@ static const WCHAR szProductID[] = {'P','r','o','d','u','c','t','I','D',0};
static const WCHAR szPIDTemplate[] = {'P','I','D','T','e','m','p','l','a','t','e',0};
static const WCHAR szPIDKEY[] = {'P','I','D','K','E','Y',0};
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
+static const WCHAR szSumInfo[] = {5 ,'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0};
/* memory allocation macro functions */
static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index 28c3093..8ec2ad9 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -32,6 +32,7 @@
#include "query.h"
#include "wine/debug.h"
+#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msidb);
@@ -486,7 +487,8 @@ static INT add_streams_to_table(MSISTREAMSVIEW *sv)
STATSTG stat;
STREAM *stream = NULL;
HRESULT hr;
- UINT count = 0, size;
+ UINT r, count = 0, size;
+ LPWSTR encname;
hr = IStorage_EnumElements(sv->db->storage, 0, NULL, 0, &stgenum);
if (FAILED(hr))
@@ -525,13 +527,22 @@ static INT add_streams_to_table(MSISTREAMSVIEW *sv)
break;
}
- hr = IStorage_OpenStream(sv->db->storage, stat.pwcsName, 0,
- STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream->stream);
+ if (!strcmpW(stat.pwcsName, szSumInfo))
+ {
+ /* summary information stream is not encoded */
+ r = db_get_raw_stream(sv->db, stat.pwcsName, &stream->stream);
+ }
+ else
+ {
+ encname = encode_streamname(FALSE, stat.pwcsName);
+ r = db_get_raw_stream(sv->db, encname, &stream->stream);
+ msi_free(encname);
+ }
CoTaskMemFree(stat.pwcsName);
- if (FAILED(hr))
+ if (r != ERROR_SUCCESS)
{
- WARN("failed to open stream: %08x\n", hr);
+ WARN("unable to get stream %u\n", r);
count = -1;
break;
}
diff --git a/dlls/msi/suminfo.c b/dlls/msi/suminfo.c
index df35c4d..902a61f 100644
--- a/dlls/msi/suminfo.c
+++ b/dlls/msi/suminfo.c
@@ -86,9 +86,6 @@ static HRESULT (WINAPI *pPropVariantChangeType)
#define SECT_HDR_SIZE (sizeof(PROPERTYSECTIONHEADER))
-static const WCHAR szSumInfo[] = { 5 ,'S','u','m','m','a','r','y',
- 'I','n','f','o','r','m','a','t','i','o','n',0 };
-
static void free_prop( PROPVARIANT *prop )
{
if (prop->vt == VT_LPSTR )
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 17c78dd..8df17e8 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1411,7 +1411,7 @@ static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
static void test_streamtable(void)
{
- MSIHANDLE hdb = 0, rec, view;
+ MSIHANDLE hdb = 0, rec, view, hsi;
char file[MAX_PATH];
char buf[MAX_PATH];
DWORD size;
@@ -1456,6 +1456,46 @@ static void test_streamtable(void)
MsiCloseHandle( rec );
+ r = MsiDatabaseOpenView( hdb,
+ "SELECT * FROM `_Streams` WHERE `Name` = '\5SummaryInformation'", &view );
+ ok( r == ERROR_SUCCESS, "Failed to open database view: %u\n", r );
+
+ r = MsiViewExecute( view, 0 );
+ ok( r == ERROR_SUCCESS, "Failed to execute view: %u\n", r );
+
+ r = MsiViewFetch( view, &rec );
+ ok( r == ERROR_NO_MORE_ITEMS, "Unexpected result: %u\n", r );
+
+ MsiCloseHandle( rec );
+ MsiViewClose( view );
+ MsiCloseHandle( view );
+
+ /* create a summary information stream */
+ r = MsiGetSummaryInformationA( hdb, NULL, 1, &hsi );
+ ok( r == ERROR_SUCCESS, "Failed to get summary information handle: %u\n", r );
+
+ r = MsiSummaryInfoSetPropertyA( hsi, PID_SECURITY, VT_I4, 2, NULL, NULL );
+ ok( r == ERROR_SUCCESS, "Failed to set property: %u\n", r );
+
+ r = MsiSummaryInfoPersist( hsi );
+ ok( r == ERROR_SUCCESS, "Failed to save summary information: %u\n", r );
+
+ MsiCloseHandle( hsi );
+
+ r = MsiDatabaseOpenView( hdb,
+ "SELECT * FROM `_Streams` WHERE `Name` = '\5SummaryInformation'", &view );
+ ok( r == ERROR_SUCCESS, "Failed to open database view: %u\n", r );
+
+ r = MsiViewExecute( view, 0 );
+ ok( r == ERROR_SUCCESS, "Failed to execute view: %u\n", r );
+
+ r = MsiViewFetch( view, &rec );
+ ok( r == ERROR_SUCCESS, "Unexpected result: %u\n", r );
+
+ MsiCloseHandle( rec );
+ MsiViewClose( view );
+ MsiCloseHandle( view );
+
/* insert a file into the _Streams table */
create_file( "test.txt" );
--
1.6.3.3
More information about the wine-patches
mailing list