Commit def5cbfc authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Change how we install files so that we extract files as we need them,

cuts down on extraction time and unused files.
parent 9d589acc
...@@ -2815,6 +2815,7 @@ typedef struct ...@@ -2815,6 +2815,7 @@ typedef struct
{ {
MSIPACKAGE* package; MSIPACKAGE* package;
LPCSTR cab_path; LPCSTR cab_path;
LPCSTR file_name;
} CabData; } CabData;
static void * cabinet_alloc(ULONG cb) static void * cabinet_alloc(ULONG cb)
...@@ -2890,13 +2891,17 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -2890,13 +2891,17 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
{ {
CabData *data = (CabData*) pfdin->pv; CabData *data = (CabData*) pfdin->pv;
ULONG len = strlen(data->cab_path) + strlen(pfdin->psz1); ULONG len = strlen(data->cab_path) + strlen(pfdin->psz1);
char *file = cabinet_alloc((len+1)*sizeof(char)); char *file;
LPWSTR trackname; LPWSTR trackname;
LPWSTR trackpath; LPWSTR trackpath;
LPWSTR tracknametmp; LPWSTR tracknametmp;
static const WCHAR tmpprefix[] = {'C','A','B','T','M','P','_',0}; static const WCHAR tmpprefix[] = {'C','A','B','T','M','P','_',0};
if (data->file_name && strcmp(data->file_name,pfdin->psz1))
return 0;
file = cabinet_alloc((len+1)*sizeof(char));
strcpy(file, data->cab_path); strcpy(file, data->cab_path);
strcat(file, pfdin->psz1); strcat(file, pfdin->psz1);
...@@ -2943,17 +2948,19 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) ...@@ -2943,17 +2948,19 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
* *
* Extract files from a cab file. * Extract files from a cab file.
*/ */
static BOOL extract_cabinet_file(MSIPACKAGE* package, const WCHAR* source, static BOOL extract_a_cabinet_file(MSIPACKAGE* package, const WCHAR* source,
const WCHAR* path) const WCHAR* path, const WCHAR* file)
{ {
HFDI hfdi; HFDI hfdi;
ERF erf; ERF erf;
BOOL ret; BOOL ret;
char *cabinet; char *cabinet;
char *cab_path; char *cab_path;
char *file_name;
CabData data; CabData data;
TRACE("Extracting %s to %s\n",debugstr_w(source), debugstr_w(path)); TRACE("Extracting %s (%s) to %s\n",debugstr_w(source),
debugstr_w(file), debugstr_w(path));
hfdi = FDICreate(cabinet_alloc, hfdi = FDICreate(cabinet_alloc,
cabinet_free, cabinet_free,
...@@ -2984,6 +2991,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, const WCHAR* source, ...@@ -2984,6 +2991,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, const WCHAR* source,
data.package = package; data.package = package;
data.cab_path = cab_path; data.cab_path = cab_path;
file_name = strdupWtoA(file);
data.file_name = file_name;
ret = FDICopy(hfdi, cabinet, "", 0, cabinet_notify, NULL, &data); ret = FDICopy(hfdi, cabinet, "", 0, cabinet_notify, NULL, &data);
...@@ -2994,17 +3003,18 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, const WCHAR* source, ...@@ -2994,17 +3003,18 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, const WCHAR* source,
HeapFree(GetProcessHeap(), 0, cabinet); HeapFree(GetProcessHeap(), 0, cabinet);
HeapFree(GetProcessHeap(), 0, cab_path); HeapFree(GetProcessHeap(), 0, cab_path);
HeapFree(GetProcessHeap(), 0, file_name);
return ret; return ret;
} }
static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence, static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence,
WCHAR* path) WCHAR* path, WCHAR* file)
{ {
UINT rc; UINT rc;
MSIQUERY * view; MSIQUERY * view;
MSIRECORD * row = 0; MSIRECORD * row = 0;
WCHAR source[MAX_PATH]; static WCHAR source[MAX_PATH];
static const WCHAR ExecSeqQuery[] = { static const WCHAR ExecSeqQuery[] = {
's','e','l','e','c','t',' ','*',' ', 's','e','l','e','c','t',' ','*',' ',
'f','r','o','m',' ','M','e','d','i','a',' ', 'f','r','o','m',' ','M','e','d','i','a',' ',
...@@ -3019,6 +3029,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence, ...@@ -3019,6 +3029,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence,
if (sequence <= last_sequence) if (sequence <= last_sequence)
{ {
TRACE("Media already ready (%u, %u)\n",sequence,last_sequence); TRACE("Media already ready (%u, %u)\n",sequence,last_sequence);
extract_a_cabinet_file(package, source,path,file);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -3077,7 +3088,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence, ...@@ -3077,7 +3088,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence,
GetTempPathW(MAX_PATH,path); GetTempPathW(MAX_PATH,path);
} }
} }
rc = !extract_cabinet_file(package, source,path); rc = !extract_a_cabinet_file(package, source,path,file);
} }
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view); MSI_ViewClose(view);
...@@ -3143,7 +3154,8 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -3143,7 +3154,8 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
if ((file->State == 1) || (file->State == 2)) if ((file->State == 1) || (file->State == 2))
{ {
TRACE("Installing %s\n",debugstr_w(file->File)); TRACE("Installing %s\n",debugstr_w(file->File));
rc = ready_media_for_file(package,file->Sequence,path_to_source); rc = ready_media_for_file(package,file->Sequence,path_to_source,
file->File);
/* /*
* WARNING! * WARNING!
* our file table could change here because a new temp file * our file table could change here because a new temp file
......
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