msi: Add summary information stream to the streams table.

oldstable
Hans Leidekker 2010-02-19 12:27:36 +01:00 committed by Alexandre Julliard
parent ddb2091623
commit 1ff9923148
4 changed files with 58 additions and 9 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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 )

View File

@ -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" );