httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: apache-1.3/src/os/win32 monitoring-services.txt service.c
Date Fri, 28 Jul 2000 18:30:13 GMT
wrowe       00/07/28 11:30:12

  Modified:    .        STATUS
               src/os/win32 service.c
  Added:       src/os/win32 monitoring-services.txt
    Some straightforward keys for Win9x (the NT path is not affected)...
    added ImagePath and DisplayName to the Win9x service key for monitor
    authors to iterate the registry and provide 'work-alike' capabilities.
    Also, the console patch committed was to hold the console open on error.
    This is the converse from closing apache and the console when Close is
    selected from the window menu, or the window close button is clicked.
    That problem remains :(
  Revision  Changes    Path
  1.835     +13 -2     apache-1.3/STATUS
  Index: STATUS
  RCS file: /home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.834
  retrieving revision 1.835
  diff -u -r1.834 -r1.835
  --- STATUS	2000/07/28 08:58:43	1.834
  +++ STATUS	2000/07/28 18:30:09	1.835
  @@ -1,5 +1,5 @@
     1.3 STATUS:
  -  Last modified at [$Date: 2000/07/28 08:58:43 $]
  +  Last modified at [$Date: 2000/07/28 18:30:09 $]
  @@ -385,8 +385,18 @@
       * fix O(n^2) attack in mod_isapi.c ... i.e. recopy the code from
  -      scan_script_headers_err_core.
  +      scan_script_headers_err_core.  Concept patch available for review
  +      from OtherBill <002001bff8b6$cb53b420$>
  +    * Apache console on Windows 95 (98?) won't close, close button/menu 
  +      option can't (?) be intercepted, any workarounds out there?
  +      There is also an unverified report that Apache in a Win98 (95?) 
  +      console window is ignoring shutdown/logoff, but this is not a
  +      confirmed report, and Apache as a hidden service does not share
  +      this reported problem.  Perhaps this is a child process issue,
  +      or just a simple matter of timing, since a hidden window exists
  +      to intercept these conditions.
    In progress:
       * Windows install script review/revision?
  @@ -402,6 +412,7 @@
           C language WinAPI (no MFC) multiple-services aware taskbar app for 
           both WinNT and Win95.  Open to anyone proposing something complete.
           If it comes between releases, add it to contrib right away!
  +        See src/os/win32/monitoring-services.txt for details.
   	Status: Ken +1, Sameer +1, Martin +1, Ben +1 (as long as
   		we get a single executable)
   	Paul: No like Win95 specific stuff
  1.25      +43 -1     apache-1.3/src/os/win32/service.c
  Index: service.c
  RCS file: /home/cvs/apache-1.3/src/os/win32/service.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- service.c	2000/07/03 14:50:52	1.24
  +++ service.c	2000/07/28 18:30:12	1.25
  @@ -620,7 +620,7 @@
  -        /* Attempt to add a key for our service */
  +        /* Attempt to add the value for our service */
           rv = RegSetValueEx(hkey, service_name, 0, REG_SZ, 
                              (unsigned char *)szQuotedPath, 
                              strlen(szQuotedPath) + 1);
  @@ -632,6 +632,48 @@
  +        RegCloseKey(hkey);
  +        /* Create/Find the Service key for Monitor Applications to iterate */
  +        ap_snprintf(szPath, sizeof(szPath), 
  +                    "SYSTEM\\CurrentControlSet\\Services\\%s", service_name);
  +        rv = RegCreateKey(HKEY_LOCAL_MACHINE, szPath, &hkey);
  +        if (rv != ERROR_SUCCESS) {
  +            SetLastError(rv);
  +            ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL,
  +                         "Could not create/open the %s registry key", szPath);
  +            return;
  +        }
  +        /* Attempt to add the ImagePath value to identify it as Apache */
  +        rv = RegSetValueEx(hkey, "ImagePath", 0, REG_SZ, 
  +                           (unsigned char *)szQuotedPath, 
  +                           strlen(szQuotedPath) + 1);
  +        if (rv != ERROR_SUCCESS) {
  +            SetLastError(rv);
  +            ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL,
  +                         "Unable to install service: "
  +                         "Could not add ImagePath to %s Registry Key", 
  +                         service_name);
  +            RegCloseKey(hkey);
  +            return;
  +        }
  +        /* Attempt to add the DisplayName value for our service */
  +        rv = RegSetValueEx(hkey, "DisplayName", 0, REG_SZ, 
  +                           (unsigned char *)display_name, 
  +                           strlen(display_name) + 1);
  +        if (rv != ERROR_SUCCESS) {
  +            SetLastError(rv);
  +            ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL,
  +                         "Unable to install service: "
  +                         "Could not add DisplayName to %s Registry Key", 
  +                         service_name);
  +            RegCloseKey(hkey);
  +            return;
  +        }
  1.1                  apache-1.3/src/os/win32/monitoring-services.txt
  Index: monitoring-services.txt
  From:    William A. Rowe, Jr. 
  Date:    June 7th '00
  Subject: service monitoring in Apache 1.3.13
  The concept for a taskbar monitor has been thrown around
  for a very long while.  1.3.13 introduced Win9x services,
  and that added fuel to the mix.  Here are some sideband
  observations I've made for other developers...
  About Apache as a console, don't start Apache hidden without
  any command line arguments if you want to launch it yourself
  in a hidden window (it will do the classic test for 
  AllocConsole/FreeConsole)... drop in some arguments such as
  the -f or -r option and it will fly without thinking it is a 
  service under 9x and NT.
  Rule two, don't use --ntservice as an argument, ever.  Only
  the Windows NT Service Control Manager is allowed to pass that
  flag, and only that flag, when it runs Apache.exe.  Do use 
  --ntservice as the sole argument to the executable name if 
  you are installing an Apache NT service yourself.
  Rule three, use -k start and -n name when maintaining the
  list, since there is no other way for Apache to know what 
  the service is named :)  And look at any 9x installed service's 
  RunServices entry in the registry for the start service semantic.
  Rule four, use the WinNT Service Control Manager exclusively
  for starting, stopping and restarting Apache as an NT service.
  The restart signal is the value 128, as documented in service.h 
  and service.c - this will continue to work in Apache 2.0.  If
  it fails, you are handling an older version (pre 1.3.13) of
  Apache, and need to stop and then start the service instead.
  Rule five, use the legacy pid-named events to signal Win9x 
  service Apache to restart and stop the service.  But don't
  bother looking for files... you can get the pid
  right from the hidden service control window.  Apache 1.3.13
  and 2.x create a hidden window named for the name of the 
  service (without the spaces), with a window class of
  "ApacheWin95ServiceMonitor", so can use FindWindow to track 
  down running Win9x services.  See the service.c code for how 
  I accomplished this pretty simply in the -k stop/-k restart
  Taskbar Monitor App
  Basic requirements: a C code application using strictly the
  Win32 API, and not MFC or other Win32 frameworks.  Could use
  the service.c module to share some basic functions.  That
  module could be extended in Apache 2.0 to make this all easier.
  I think we are looking for an external app that simply acts 
  as a monitor or allows a stopped service to be started.  If 
  the user logs off, we loose the monitor app, but installed as 
  a shortcut in the Start group or in the registry key
  we will be just fine.  I'd like to see the monitor run only
  one instance to monitor all running services, for memory
  and resource conservation.
  I was thinking that the hover/iconbar title would tell them 
  "Test service is running", or "Test service is stopped".
  If they left click, they could stop or restart, or simply
  start if it is stopped.  There could be a preference that
  each service doesn't get it's own individual task icon unless 
  it is running, if it is a manual start service (or missing 
  from the RunServices list, which is the equivilant under 9x).
  If a specific service is set to Auto start or is in the 
  RunServices Win9x registry key, we must show them the stopped 
  icon, of course.  We might also keep the icon for any running
  service that stops abruptly.  But there could be a 'single 
  icon' option for the taskbar icon monitor that says show only
  a single status icon, for simplicity if the administrator runs
  many Apache services.
  But I was hoping that any right click would provide a menu
  of all Apache services with their status.  e.g.
    Test service is stopped
    Apache_2 service is running
    MyWeb service is running
  and each would do the logical submenu, same as if that
  specific taskbar icon were left clicked, offering to start or
  offering to stop or restart the server, as appropriate.
  Finally, to identify all installed Apache services, just query 
  the registry key HKLM\SYSTEM\CurrentControlSet\Services for any 
  key that has the ImagePath value of "...\Apache.exe"... (quotes
  are significant here, if the leading quote is ommitted the 
  entire string ends with the text \Apache.exe - based on Apache's 
  own service installer in every released version.)

View raw message