msi: Call ui_actiondata for more actions.

This commit is contained in:
Robert Shearman 2006-01-23 17:29:50 +01:00 committed by Alexandre Julliard
parent c824e8bc5b
commit d2e48e01ac
2 changed files with 94 additions and 25 deletions

View File

@ -3011,6 +3011,7 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
CHAR buffer[1024];
DWORD sz;
UINT rc;
MSIRECORD *uirow;
FileName = MSI_RecordGetString(row,1);
if (!FileName)
@ -3051,6 +3052,12 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
msi_free(FilePath);
CloseHandle(the_file);
uirow = MSI_CreateRecord(1);
MSI_RecordSetStringW(uirow,1,FileName);
ui_actiondata(package,szPublishProduct,uirow);
msiobj_release( &uirow->hdr );
return ERROR_SUCCESS;
}
@ -3297,6 +3304,8 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
STARTUPINFOW si;
PROCESS_INFORMATION info;
BOOL brc;
MSIRECORD *uirow;
LPWSTR uipath, p;
memset(&si,0,sizeof(STARTUPINFOW));
@ -3324,6 +3333,20 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
msi_dialog_check_messages(info.hProcess);
msi_free(FullName);
/* the UI chunk */
uirow = MSI_CreateRecord( 2 );
uipath = strdupW( file->TargetPath );
p = strrchrW(uipath,'\\');
if (p)
p[1]=0;
MSI_RecordSetStringW( uirow, 1, &p[2] );
MSI_RecordSetStringW( uirow, 2, uipath);
ui_actiondata( package, szSelfRegModules, uirow);
msiobj_release( &uirow->hdr );
msi_free( uipath );
/* FIXME: call ui_progress? */
return ERROR_SUCCESS;
}
@ -3371,6 +3394,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
GUID clsid;
INT size;
BOOL absent = FALSE;
MSIRECORD *uirow;
if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_LOCAL ) &&
!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_SOURCE ) &&
@ -3433,6 +3457,13 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
(LPBYTE)data,size);
msi_free(data);
}
/* the UI chunk */
uirow = MSI_CreateRecord( 1 );
MSI_RecordSetStringW( uirow, 1, feature->Feature );
ui_actiondata( package, szPublishFeatures, uirow);
msiobj_release( &uirow->hdr );
/* FIXME: call ui_progress? */
}
end:
@ -3624,6 +3655,8 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
RegCloseKey(hkey);
/* FIXME: call ui_actiondata */
return ERROR_SUCCESS;
}
@ -3792,6 +3825,8 @@ end:
msi_free(productid);
RegCloseKey(hkey);
/* FIXME: call ui_actiondata */
return ERROR_SUCCESS;
}
@ -3958,6 +3993,8 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
'F','o','n','t','s',0};
HKEY hkey1;
HKEY hkey2;
MSIRECORD *uirow;
LPWSTR uipath, p;
filename = MSI_RecordGetString( row, 1 );
file = get_loaded_file( package, filename );
@ -3991,6 +4028,19 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
msi_free(name);
RegCloseKey(hkey1);
RegCloseKey(hkey2);
/* the UI chunk */
uirow = MSI_CreateRecord( 1 );
uipath = strdupW( file->TargetPath );
p = strrchrW(uipath,'\\');
if (p) p++;
else p = uipath;
MSI_RecordSetStringW( uirow, 1, p );
ui_actiondata( package, szRegisterFonts, uirow);
msiobj_release( &uirow->hdr );
msi_free( uipath );
/* FIXME: call ui_progress? */
return ERROR_SUCCESS;
}
@ -4029,6 +4079,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
UINT rc = ERROR_SUCCESS;
MSICOMPONENT *comp;
DWORD sz = 0;
MSIRECORD *uirow;
component = MSI_RecordGetString(rec,3);
comp = get_loaded_component(package,component);
@ -4044,13 +4095,13 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
}
compgroupid = MSI_RecordGetString(rec,1);
qualifier = MSI_RecordGetString(rec,2);
rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
text = MSI_RecordGetString(rec,4);
qualifier = MSI_RecordGetString(rec,2);
feature = MSI_RecordGetString(rec,5);
advertise = create_component_advertise_string(package, comp, feature);
@ -4076,7 +4127,15 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
end:
RegCloseKey(hkey);
msi_free(output);
/* the UI chunk */
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, compgroupid );
MSI_RecordSetStringW( uirow, 2, qualifier);
ui_actiondata( package, szPublishComponents, uirow);
msiobj_release( &uirow->hdr );
/* FIXME: call ui_progress? */
return rc;
}

View File

@ -180,7 +180,7 @@ static long cabinet_seek(INT_PTR hf, long dist, int seektype)
return SetFilePointer(handle, dist, NULL, seektype);
}
static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f )
static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action )
{
MSIRECORD *uirow;
LPWSTR uipath, p;
@ -194,7 +194,7 @@ static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f )
p[1]=0;
MSI_RecordSetStringW( uirow, 9, uipath);
MSI_RecordSetInteger( uirow, 6, f->FileSize );
ui_actiondata( package, szInstallFiles, uirow);
ui_actiondata( package, action, uirow);
msiobj_release( &uirow->hdr );
msi_free( uipath );
ui_progress( package, 2, f->FileSize, 0, 0);
@ -227,7 +227,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
return 0;
}
msi_file_update_ui( data->package, f );
msi_file_update_ui( data->package, f, szInstallFiles );
TRACE("extracting %s\n", debugstr_w(f->TargetPath) );
@ -604,19 +604,14 @@ static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
}
static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
LPWSTR* file_source)
MSIFILE** file)
{
MSIFILE *file;
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
LIST_FOR_EACH_ENTRY( *file, &package->files, MSIFILE, entry )
{
if (lstrcmpW( file_key, file->File )==0)
if (lstrcmpW( file_key, (*file)->File )==0)
{
if (file->state >= msifs_overwrite)
{
*file_source = strdupW( file->TargetPath );
if ((*file)->state >= msifs_overwrite)
return ERROR_SUCCESS;
}
else
return ERROR_FILE_NOT_FOUND;
}
@ -744,13 +739,13 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = (MSIPACKAGE*)param;
WCHAR *file_source = NULL;
WCHAR dest_name[0x100];
LPWSTR dest_path, dest;
LPCWSTR file_key, component;
DWORD sz;
DWORD rc;
MSICOMPONENT *comp;
MSIFILE *file;
component = MSI_RecordGetString(row,2);
comp = get_loaded_component(package,component);
@ -775,17 +770,16 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
return ERROR_FUNCTION_FAILED;
}
rc = get_file_target(package,file_key,&file_source);
rc = get_file_target(package,file_key,&file);
if (rc != ERROR_SUCCESS)
{
ERR("Original file unknown %s\n",debugstr_w(file_key));
msi_free(file_source);
return ERROR_SUCCESS;
}
if (MSI_RecordIsNull(row,4))
strcpyW(dest_name,strrchrW(file_source,'\\')+1);
strcpyW(dest_name,strrchrW(file->TargetPath,'\\')+1);
else
{
sz=0x100;
@ -796,7 +790,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (MSI_RecordIsNull(row,5))
{
LPWSTR p;
dest_path = strdupW(file_source);
dest_path = strdupW(file->TargetPath);
p = strrchrW(dest_path,'\\');
if (p)
*p=0;
@ -813,7 +807,6 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (!dest_path)
{
FIXME("Unable to get destination folder, try AppSearch properties\n");
msi_free(file_source);
return ERROR_SUCCESS;
}
}
@ -821,23 +814,24 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
dest = build_directory_name(2, dest_path, dest_name);
TRACE("Duplicating file %s to %s\n",debugstr_w(file_source),
TRACE("Duplicating file %s to %s\n",debugstr_w(file->TargetPath),
debugstr_w(dest));
if (strcmpW(file_source,dest))
rc = !CopyFileW(file_source,dest,TRUE);
if (strcmpW(file->TargetPath,dest))
rc = !CopyFileW(file->TargetPath,dest,TRUE);
else
rc = ERROR_SUCCESS;
if (rc != ERROR_SUCCESS)
ERR("Failed to copy file %s -> %s, last error %ld\n",
debugstr_w(file_source), debugstr_w(dest_path), GetLastError());
debugstr_w(file->TargetPath), debugstr_w(dest_path), GetLastError());
FIXME("We should track these duplicate files as well\n");
msi_free(dest_path);
msi_free(dest);
msi_free(file_source);
msi_file_update_ui(package, file, szDuplicateFiles);
return ERROR_SUCCESS;
}
@ -866,6 +860,9 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
{
MSIRECORD *uirow;
LPWSTR uipath, p;
if ( !file->Component )
continue;
if ( file->Component->Installed == INSTALLSTATE_LOCAL )
@ -881,6 +878,19 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
if ( !DeleteFileW( file->TargetPath ) )
ERR("failed to delete %s\n", debugstr_w(file->TargetPath) );
file->state = msifs_missing;
/* the UI chunk */
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, file->FileName );
uipath = strdupW( file->TargetPath );
p = strrchrW(uipath,'\\');
if (p)
p[1]=0;
MSI_RecordSetStringW( uirow, 9, uipath);
ui_actiondata( package, szRemoveFiles, uirow);
msiobj_release( &uirow->hdr );
msi_free( uipath );
/* FIXME: call ui_progress here? */
}
return ERROR_SUCCESS;