msi: Search the last used source if the cabinet to extract cannot be found.

This commit is contained in:
James Hawkins 2008-05-21 18:39:45 -05:00 committed by Alexandre Julliard
parent c1940e397e
commit 77d259f46c
3 changed files with 13 additions and 1 deletions

View File

@ -577,7 +577,7 @@ UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO *mi)
} }
/* FIXME: search NETWORK and URL sources as well */ /* FIXME: search NETWORK and URL sources as well */
static UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi) UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi)
{ {
WCHAR source[MAX_PATH]; WCHAR source[MAX_PATH];
WCHAR volume[MAX_PATH]; WCHAR volume[MAX_PATH];
@ -586,6 +586,7 @@ static UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi)
DWORD index, size, id; DWORD index, size, id;
UINT r; UINT r;
size = MAX_PATH;
r = MsiSourceListGetInfoW(package->ProductCode, NULL, r = MsiSourceListGetInfoW(package->ProductCode, NULL,
package->Context, MSICODE_PRODUCT, package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_LASTUSEDSOURCEW, source, &size); INSTALLPROPERTY_LASTUSEDSOURCEW, source, &size);

View File

@ -1163,6 +1163,16 @@ UINT msi_extract_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR destdir)
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
if (GetFileAttributesW(mi->source) == INVALID_FILE_ATTRIBUTES)
{
r = find_published_source(package, mi);
if (r != ERROR_SUCCESS)
{
ERR("Cabinet not found: %s\n", debugstr_w(mi->source));
return ERROR_INSTALL_FAILURE;
}
}
data.package = package; data.package = package;
data.mi = mi; data.mi = mi;
data.file = file; data.file = file;

View File

@ -908,6 +908,7 @@ extern UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO
extern void msi_free_media_info(MSIMEDIAINFO *mi); extern void msi_free_media_info(MSIMEDIAINFO *mi);
extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, PFNFDINOTIFY notify, LPVOID data); extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, PFNFDINOTIFY notify, LPVOID data);
extern UINT msi_extract_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR destdir); extern UINT msi_extract_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR destdir);
extern UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi);
/* control event stuff */ /* control event stuff */
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event, extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,