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 ) ...@@ -425,23 +425,22 @@ static MSISTREAM *find_stream( MSIDATABASE *db, const WCHAR *name )
static UINT append_stream( MSIDATABASE *db, const WCHAR *name, IStream *stream ) static UINT append_stream( MSIDATABASE *db, const WCHAR *name, IStream *stream )
{ {
WCHAR decoded[MAX_STREAM_NAME_LEN + 1];
UINT i = db->num_streams; UINT i = db->num_streams;
if (!streams_resize_table( db, db->num_streams + 1 )) if (!streams_resize_table( db, db->num_streams + 1 ))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
decode_streamname( name, decoded ); db->streams[i].str_index = msi_add_string( db->strings, name, -1, StringNonPersistent );
db->streams[i].str_index = msi_add_string( db->strings, decoded, -1, StringNonPersistent );
db->streams[i].stream = stream; db->streams[i].stream = stream;
db->num_streams++; db->num_streams++;
TRACE("added %s\n", debugstr_w( decoded )); TRACE("added %s\n", debugstr_w( name ));
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT load_streams( MSIDATABASE *db ) static UINT load_streams( MSIDATABASE *db )
{ {
WCHAR decoded[MAX_STREAM_NAME_LEN + 1];
IEnumSTATSTG *stgenum; IEnumSTATSTG *stgenum;
STATSTG stat; STATSTG stat;
HRESULT hr; HRESULT hr;
...@@ -460,25 +459,29 @@ static UINT load_streams( MSIDATABASE *db ) ...@@ -460,25 +459,29 @@ static UINT load_streams( MSIDATABASE *db )
break; break;
/* table streams are not in the _Streams table */ /* table streams are not in the _Streams table */
if (stat.type != STGTY_STREAM || *stat.pwcsName == 0x4840 || if (stat.type != STGTY_STREAM || *stat.pwcsName == 0x4840)
find_stream( db, stat.pwcsName ))
{ {
CoTaskMemFree( stat.pwcsName ); CoTaskMemFree( stat.pwcsName );
continue; 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 ); hr = open_stream( db, stat.pwcsName, &stream );
CoTaskMemFree( stat.pwcsName );
if (FAILED( hr )) if (FAILED( hr ))
{ {
ERR("unable to open stream %08x\n", hr); ERR("unable to open stream %08x\n", hr);
CoTaskMemFree( stat.pwcsName );
r = ERROR_FUNCTION_FAILED; r = ERROR_FUNCTION_FAILED;
break; break;
} }
r = append_stream( db, stat.pwcsName, stream ); r = append_stream( db, decoded, stream );
CoTaskMemFree( stat.pwcsName );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
break; 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