Commit 131ef637 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Add support for maintaining a list of cabinet streams.

parent 55216463
......@@ -890,3 +890,43 @@ UINT ready_media(MSIPACKAGE *package, UINT Sequence, BOOL IsCompressed, MSIMEDIA
msi_free(cabinet_file);
return ERROR_SUCCESS;
}
UINT msi_add_cabinet_stream( MSIPACKAGE *package, UINT disk_id, IStorage *storage, const WCHAR *name )
{
MSICABINETSTREAM *cab, *item;
TRACE("%p, %u, %p, %s\n", package, disk_id, storage, debugstr_w(name));
LIST_FOR_EACH_ENTRY( item, &package->cabinet_streams, MSICABINETSTREAM, entry )
{
if (item->disk_id == disk_id)
{
TRACE("duplicate disk id %u\n", disk_id);
return ERROR_FUNCTION_FAILED;
}
}
if (!(cab = msi_alloc( sizeof(*cab) ))) return ERROR_OUTOFMEMORY;
if (!(cab->stream = msi_alloc( (strlenW( name ) + 1) * sizeof(WCHAR ) )))
{
msi_free( cab );
return ERROR_OUTOFMEMORY;
}
strcpyW( cab->stream, name );
cab->disk_id = disk_id;
cab->storage = storage;
IStorage_AddRef( storage );
list_add_tail( &package->cabinet_streams, &cab->entry );
return ERROR_SUCCESS;
}
MSICABINETSTREAM *msi_get_cabinet_stream( MSIPACKAGE *package, UINT disk_id )
{
MSICABINETSTREAM *cab;
LIST_FOR_EACH_ENTRY( cab, &package->cabinet_streams, MSICABINETSTREAM, entry )
{
if (cab->disk_id == disk_id) return cab;
}
return NULL;
}
......@@ -157,6 +157,14 @@ typedef struct tagMSIMEDIAINFO
WCHAR sourcedir[MAX_PATH];
} MSIMEDIAINFO;
typedef struct tagMSICABINETSTREAM
{
struct list entry;
UINT disk_id;
IStorage *storage;
WCHAR *stream;
} MSICABINETSTREAM;
typedef struct tagMSIPATCHINFO
{
struct list entry;
......@@ -350,6 +358,7 @@ typedef struct tagMSIPACKAGE
struct list tempfiles;
struct list folders;
struct list binaries;
struct list cabinet_streams;
LPWSTR ActionFormat;
LPWSTR LastAction;
HANDLE log_file;
......@@ -1007,6 +1016,8 @@ extern UINT ready_media(MSIPACKAGE *package, UINT Sequence, BOOL IsCompressed, M
extern UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi);
extern void msi_free_media_info(MSIMEDIAINFO *mi);
extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data);
extern MSICABINETSTREAM *msi_get_cabinet_stream(MSIPACKAGE *, UINT);
extern UINT msi_add_cabinet_stream(MSIPACKAGE *, UINT, IStorage *, const WCHAR *);
/* control event stuff */
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
......
......@@ -300,6 +300,16 @@ static void free_package_structures( MSIPACKAGE *package )
msi_free( binary );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->cabinet_streams )
{
MSICABINETSTREAM *cab = LIST_ENTRY( item, MSICABINETSTREAM, entry );
list_remove( &cab->entry );
IStorage_Release( cab->storage );
msi_free( cab->stream );
msi_free( cab );
}
msi_free( package->BaseURL );
msi_free( package->PackagePath );
msi_free( package->ProductCode );
......@@ -1080,6 +1090,7 @@ static MSIPACKAGE *msi_alloc_package( void )
list_init( &package->sourcelist_media );
list_init( &package->patches );
list_init( &package->binaries );
list_init( &package->cabinet_streams );
}
return package;
......
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