msi: Skip disabled components in the InstallService action.

This commit is contained in:
Hans Leidekker 2011-05-02 16:03:14 +02:00 committed by Alexandre Julliard
parent c96cd6efc8
commit 0d0074d56b

View File

@ -5945,23 +5945,33 @@ static UINT ACTION_UnpublishComponents( MSIPACKAGE *package )
static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
{ {
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','o','m','p','o','n','e','n','t','`',' ','W','H','E','R','E',' ',
'`','C','o','m','p','o','n','e','n','t','`',' ','=','\'','%','s','\'',0};
MSIPACKAGE *package = param; MSIPACKAGE *package = param;
MSICOMPONENT *component;
MSIRECORD *row; MSIRECORD *row;
MSIFILE *file; MSIFILE *file;
SC_HANDLE hscm, service = NULL; SC_HANDLE hscm = NULL, service = NULL;
LPCWSTR comp, key; LPCWSTR comp, key;
LPWSTR name = NULL, disp = NULL, load_order = NULL, serv_name = NULL; LPWSTR name = NULL, disp = NULL, load_order = NULL, serv_name = NULL;
LPWSTR depends = NULL, pass = NULL, args = NULL, image_path = NULL; LPWSTR depends = NULL, pass = NULL, args = NULL, image_path = NULL;
DWORD serv_type, start_type, err_control; DWORD serv_type, start_type, err_control;
SERVICE_DESCRIPTIONW sd = {NULL}; SERVICE_DESCRIPTIONW sd = {NULL};
static const WCHAR query[] = comp = MSI_RecordGetString( rec, 12 );
{'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ', component = get_loaded_component( package, comp );
'`','C','o','m','p','o','n','e','n','t','`',' ', if (!component)
'W','H','E','R','E',' ', {
'`','C','o','m','p','o','n','e','n','t','`',' ', WARN("service component not found\n");
'=','\'','%','s','\'',0}; goto done;
}
if (!component->Enabled)
{
TRACE("service component disabled\n");
goto done;
}
hscm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, GENERIC_WRITE); hscm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, GENERIC_WRITE);
if (!hscm) if (!hscm)
{ {
@ -5969,10 +5979,6 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
goto done; goto done;
} }
comp = MSI_RecordGetString( rec, 12 );
if (!get_loaded_component( package, comp ))
goto done;
start_type = MSI_RecordGetInteger(rec, 5); start_type = MSI_RecordGetInteger(rec, 5);
if (start_type == SERVICE_BOOT_START || start_type == SERVICE_SYSTEM_START) if (start_type == SERVICE_BOOT_START || start_type == SERVICE_SYSTEM_START)
goto done; goto done;
@ -5992,11 +5998,10 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
row = MSI_QueryGetRecord(package->db, query, comp); row = MSI_QueryGetRecord(package->db, query, comp);
if (!row) if (!row)
{ {
ERR("Control query failed!\n"); ERR("Query failed\n");
goto done; goto done;
} }
key = MSI_RecordGetString(row, 6); key = MSI_RecordGetString(row, 6);
file = get_loaded_file(package, key); file = get_loaded_file(package, key);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
if (!file) if (!file)