This patch fixes AM where it throws an error window when trying to control
the service for lack of query status access.  

I don't want Mladen to feel like I'm stepping on his toes, but I really 
don't like
using the generic access unless there's a good reason to.  So I changed 
all the
service calls to use only the access rights that are needed.  Which IMO 
is the
more logical approach, but I might be wrong.

Shane


Index: ApacheMonitor.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/support/win32/ApacheMonitor.c,v
retrieving revision 1.21
diff -u -3 -r1.21 ApacheMonitor.c
--- ApacheMonitor.c     9 Jul 2002 17:13:48 -0000       1.21
+++ ApacheMonitor.c     12 Jul 2002 17:32:26 -0000
@@ -780,13 +780,14 @@
     else
     {
         schSCManager = OpenSCManager(szComputerName, NULL,
-                                     GENERIC_EXECUTE);
+                                     SC_MANAGER_CONNECT);
         if (!schSCManager) {
             return FALSE;
         }
 
         schService = OpenService(schSCManager, szServiceName, 
-                                 GENERIC_EXECUTE);
+                                 SERVICE_QUERY_STATUS | SERVICE_START | 
+                                 SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL);
         if (schService != NULL)
         {
             retValue = FALSE;
@@ -937,7 +938,7 @@
     {
         dwPid = 0;
         schSCManager = OpenSCManager(szComputerName, NULL,
-                                     GENERIC_READ);
+                                     SC_MANAGER_CONNECT);
         if (!schSCManager) {
             return FALSE;
         }

Reply via email to