Hans Leidekker : msi: Decode stream names in load_streams.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Mar 4 09:22:17 CST 2015
Module: wine
Branch: master
Commit: af6281701da714b6333b7a8a9263545adb9f8512
URL: http://source.winehq.org/git/wine.git/?a=commit;h=af6281701da714b6333b7a8a9263545adb9f8512
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Mar 4 14:29:29 2015 +0100
msi: Decode stream names in load_streams.
---
dlls/msi/streams.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index 44a322c..4b151bb 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -425,23 +425,22 @@ static MSISTREAM *find_stream( MSIDATABASE *db, const WCHAR *name )
static UINT append_stream( MSIDATABASE *db, const WCHAR *name, IStream *stream )
{
- WCHAR decoded[MAX_STREAM_NAME_LEN + 1];
UINT i = db->num_streams;
if (!streams_resize_table( db, db->num_streams + 1 ))
return ERROR_OUTOFMEMORY;
- decode_streamname( name, decoded );
- db->streams[i].str_index = msi_add_string( db->strings, decoded, -1, StringNonPersistent );
+ db->streams[i].str_index = msi_add_string( db->strings, name, -1, StringNonPersistent );
db->streams[i].stream = stream;
db->num_streams++;
- TRACE("added %s\n", debugstr_w( decoded ));
+ TRACE("added %s\n", debugstr_w( name ));
return ERROR_SUCCESS;
}
static UINT load_streams( MSIDATABASE *db )
{
+ WCHAR decoded[MAX_STREAM_NAME_LEN + 1];
IEnumSTATSTG *stgenum;
STATSTG stat;
HRESULT hr;
@@ -460,25 +459,29 @@ static UINT load_streams( MSIDATABASE *db )
break;
/* table streams are not in the _Streams table */
- if (stat.type != STGTY_STREAM || *stat.pwcsName == 0x4840 ||
- find_stream( db, stat.pwcsName ))
+ if (stat.type != STGTY_STREAM || *stat.pwcsName == 0x4840)
{
CoTaskMemFree( stat.pwcsName );
continue;
}
- TRACE("found new stream %s\n", debugstr_w( stat.pwcsName ));
+ decode_streamname( stat.pwcsName, decoded );
+ if (find_stream( db, decoded ))
+ {
+ CoTaskMemFree( stat.pwcsName );
+ continue;
+ }
+ TRACE("found new stream %s\n", debugstr_w( decoded ));
hr = open_stream( db, stat.pwcsName, &stream );
+ CoTaskMemFree( stat.pwcsName );
if (FAILED( hr ))
{
ERR("unable to open stream %08x\n", hr);
- CoTaskMemFree( stat.pwcsName );
r = ERROR_FUNCTION_FAILED;
break;
}
- r = append_stream( db, stat.pwcsName, stream );
- CoTaskMemFree( stat.pwcsName );
+ r = append_stream( db, decoded, stream );
if (r != ERROR_SUCCESS)
break;
}
More information about the wine-cvs
mailing list