httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-1.3/src/os/win32 service.c
Date Thu, 15 Jun 2000 19:41:25 GMT
wrowe       00/06/15 12:41:23

  Modified:    src      CHANGES
               src/os/win32 service.c
  Log:
    A newer hack to determine if we're running as a service without waiting
    for the SCM to fail; Testing both for isWindowsNT and the obscure but
    consistent flag STARTF_FORCEOFFFEEDBACK.
  
    William Rowe with great hints from Kevin Kiley <TOKILEY@aol.com>
  
  PR:		5657
  Submitted by:	Jim Patterson <jim-patterson@ncf.ca>,
  
  Revision  Changes    Path
  1.1559    +6 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1558
  retrieving revision 1.1559
  diff -u -r1.1558 -r1.1559
  --- CHANGES	2000/06/15 19:18:19	1.1558
  +++ CHANGES	2000/06/15 19:41:17	1.1559
  @@ -1,5 +1,11 @@
   Changes with Apache 1.3.13
   
  +  *) Change Win32 the isProcessService() routine to compensate for other
  +     helper apps that invoke Apache.exe without a console.  Recognize that
  +     we are running NT, and use the STARTF_FORCEOFFFEEDBACK flag to be
  +     sure that the SCM has invoked the process. [William Rowe,
  +       Jim Patterson <jim-patterson@ncf.ca>, Kevin Kiley, TOKILEY@aol.com]
  +
     *) Export from Win32 the ap_start_shutdown and ap_start_restart symbols 
        for modules and executables dynamically linked to the core.
        [William Rowe; Jim Patterson <jim-patterson@ncf.ca>]
  
  
  
  1.22      +17 -3     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- service.c	2000/06/12 21:49:57	1.21
  +++ service.c	2000/06/15 19:41:22	1.22
  @@ -554,13 +554,27 @@
   }
   
   /* A hack to determine if we're running as a service without waiting for
  - * the SCM to fail; if AllocConsole succeeds, we're a service.
  + * the SCM to fail; note that you CANNOT start Apache under NT with the
  + * STARTF_FORCEOFFFEEDBACK argument, since this _will_ cause Apache to
  + * believe it was started by the win32 Service Control Manager.
  + *
  + * This is tested under NT 4.0 both with, and without the "Allow Service
  + * to Interact With Desktop" option selected, from the Service Control
  + * applet, the NET START and apache -k start command, and appears very
  + * consistent.  It's no worse than the earlier hack, which is faulty when
  + * created without a console by a user process :)  It is certainly far 
  + * faster and less resource intensive than the Alloc/Destroy console test.
  + * Testing for the si.lpDesktop is far less effective, since Apache is 
  + * passed a desktop name with the "Allow Service to Interact With Desktop" 
  + * option toggled to true.
    */
   
   BOOL isProcessService() {
  -    if( !AllocConsole() ) 
  +    STARTUPINFO si;
  +    si.cb = sizeof(si);
  +    GetStartupInfo(&si);
  +    if (!isWindowsNT() || !(si.dwFlags & STARTF_FORCEOFFFEEDBACK)) 
           return FALSE;
  -    FreeConsole();
       return TRUE;
   }
   
  
  
  

Mime
View raw message