Mikołaj Zalewski mikolaj@zalewski.pl writes:
diff --git a/programs/services/services.c b/programs/services/services.c index 36ed117..b166d51 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -344,7 +344,7 @@ struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase
LIST_FOR_EACH_ENTRY(service, &db->services, struct service_entry, entry) {
if (strcmpiW(name, service->config.lpDisplayName) == 0)
}if (strcmpiW(name, get_display_name(service)) == 0) return service;
You should not change scmdatabase_find_service_by_displayname, it does what its name implies. You should fix the callers where necessary.
You should not change scmdatabase_find_service_by_displayname, it does what its name implies. You should fix the callers where necessary.
The scmdatabase_find_service_by_displayname is currently wrong. It dereferences a NULL pointer if the registry database contains a service without a display name. The callers can't do anything about that. Both callers expects that if the display name is not explicitly set, the key name should be used as the display name - it looks like a general rule (I've just found that QueryServiceConfig also needs such a feature). Alternatively, code could be added to load_service_config and CreateService to set lpDisplayName to service->name if the display name is not present in the registery. However, this would create a side-effect not present on Windows - this display name would be written to the registery after e.g. a ChangeServiceConfig.
Mikolaj Zalewski