From 3886fdf009874a472fa31c15c918c4a25d708e63 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 12 Mar 2012 12:14:04 +0100 Subject: [PATCH] LP952607: Do not show MySQL services preinstalled by Dell in the upgrade wizard --- sql/winservice.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/sql/winservice.c b/sql/winservice.c index 3ec91c26835..f70f8018509 100644 --- a/sql/winservice.c +++ b/sql/winservice.c @@ -58,6 +58,41 @@ void normalize_path(char *path, size_t size) strcpy_s(path, size, buf); } +/* + Exclusion rules. + + Some hardware manufacturers deliver systems with own preinstalled MySQL copy + and services. We do not want to mess up with these installations. We will + just ignore such services, pretending it is not MySQL. + + ´@return + TRUE, if this service should be excluded from UI lists etc (OEM install) + FALSE otherwise. +*/ +BOOL exclude_service(mysqld_service_properties *props) +{ + static const char* exclude_patterns[] = + { + "common files\\dell\\mysql\\bin\\", /* Dell's private installation */ + NULL + }; + int i; + char buf[MAX_PATH]; + + /* Convert mysqld path to lower case, rules for paths are case-insensitive. */ + memcpy(buf, props->mysqld_exe, sizeof(props->mysqld_exe)); + _strlwr(buf); + + for(i= 0; exclude_patterns[i]; i++) + { + if (strstr(buf, exclude_patterns[i])) + return TRUE; + } + + return FALSE; +} + + /* Retrieve some properties from windows mysqld service binary path. We're interested in ini file location and datadir, and also in version of @@ -240,7 +275,9 @@ int get_mysql_service_properties(const wchar_t *bin_path, } } } - retval = 0; + + if (!exclude_service(props)) + retval = 0; end: LocalFree((HLOCAL)args); return retval;