From: William A. Rowe Jr Date: Fri, 2 Jan 2009 23:37:42 +0000 (+0000) Subject: Drop support for Service Description labels from < Win2000 X-Git-Tag: 2.3.1~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2d9f136d1097704abe8e772bd53ff2bf77494d1;p=thirdparty%2Fapache%2Fhttpd.git Drop support for Service Description labels from < Win2000 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@730870 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/service.c b/server/mpm/winnt/service.c index 77c63c35582..02f0963d8ed 100644 --- a/server/mpm/winnt/service.c +++ b/server/mpm/winnt/service.c @@ -295,22 +295,14 @@ static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint) return(rv); } -/* Set the service description regardless of platform. - * We revert to set_service_description, the - explicit - * way so any Apache management program can grab the - * description. This would be bad on Win2000, since - * it doesn't notify the service control manager of - * the name change. +/* Note this works on Win2000 and later due to ChangeServiceConfig2 + * Continue to test it's existence, but at least drop the feature + * of revising service description tags prior to Win2000. */ /* borrowed from mpm_winnt.c */ extern apr_pool_t *pconf; -/* Windows 2000 alone supports ChangeServiceConfig2 in order to - * register our server_version string... so we need some fixups - * to avoid binding to that function if we are on WinNT. - */ static void set_service_description(void) { const char *full_description; @@ -326,10 +318,8 @@ static void set_service_description(void) */ full_description = ap_get_server_description(); - if ((osver.dwPlatformId == VER_PLATFORM_WIN32_NT) - && (osver.dwMajorVersion > 4) - && (ChangeServiceConfig2) - && (schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT))) + if ((ChangeServiceConfig2) && + (schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT))) { SC_HANDLE schService = OpenService(schSCManager, mpm_service_name, SERVICE_CHANGE_CONFIG); @@ -338,35 +328,13 @@ static void set_service_description(void) * object types, some volatile, some not. */ /* ###: utf-ize */ - if (ChangeServiceConfig2(schService, - 1 /* SERVICE_CONFIG_DESCRIPTION */, - (LPVOID) &full_description)) { - full_description = NULL; - } + ChangeServiceConfig2(schService, + 1 /* SERVICE_CONFIG_DESCRIPTION */, + (LPVOID) &full_description)); CloseServiceHandle(schService); } CloseServiceHandle(schSCManager); } - - if (full_description) - { - char szPath[MAX_PATH]; - ap_regkey_t *svckey; - apr_status_t rv; - - /* Find the Service key that Monitor Applications iterate */ - apr_snprintf(szPath, sizeof(szPath), - "SYSTEM\\CurrentControlSet\\Services\\%s", - mpm_service_name); - rv = ap_regkey_open(&svckey, AP_REGKEY_LOCAL_MACHINE, szPath, - APR_READ | APR_WRITE, pconf); - if (rv != APR_SUCCESS) { - return; - } - /* Attempt to set the Description value for our service */ - ap_regkey_value_set(svckey, "Description", full_description, 0, pconf); - ap_regkey_close(svckey); - } } /* handle the SCM's ControlService() callbacks to our service */