msi: Update the UI in the DeleteServices action.

This commit is contained in:
Hans Leidekker 2010-03-05 12:24:41 +01:00 committed by Alexandre Julliard
parent a70d86d3c9
commit 3c36d9d1f9
1 changed files with 18 additions and 2 deletions

View File

@ -5383,9 +5383,10 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param )
{ {
MSIPACKAGE *package = param; MSIPACKAGE *package = param;
MSICOMPONENT *comp; MSICOMPONENT *comp;
MSIRECORD *uirow;
LPCWSTR component; LPCWSTR component;
LPWSTR name = NULL; LPWSTR name = NULL, display_name = NULL;
DWORD event; DWORD event, len;
SC_HANDLE scm = NULL, service = NULL; SC_HANDLE scm = NULL, service = NULL;
event = MSI_RecordGetInteger( rec, 3 ); event = MSI_RecordGetInteger( rec, 3 );
@ -5415,6 +5416,14 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param )
goto done; goto done;
} }
len = 0;
if (!GetServiceDisplayNameW( scm, name, NULL, &len ) &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
if ((display_name = msi_alloc( ++len * sizeof(WCHAR ))))
GetServiceDisplayNameW( scm, name, display_name, &len );
}
service = OpenServiceW( scm, name, DELETE ); service = OpenServiceW( scm, name, DELETE );
if (!service) if (!service)
{ {
@ -5426,9 +5435,16 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param )
WARN("Failed to delete service (%s): %u\n", debugstr_w(name), GetLastError()); WARN("Failed to delete service (%s): %u\n", debugstr_w(name), GetLastError());
done: done:
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, display_name );
MSI_RecordSetStringW( uirow, 2, name );
ui_actiondata( package, szDeleteServices, uirow );
msiobj_release( &uirow->hdr );
CloseServiceHandle( service ); CloseServiceHandle( service );
CloseServiceHandle( scm ); CloseServiceHandle( scm );
msi_free( name ); msi_free( name );
msi_free( display_name );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }