Commit af628170 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Decode stream names in load_streams.

parent a85d23bf
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment