ApacheMonitor.c revision d536c9e8fcd05da26d98559de9c99d9415df3467
cac0964f155bdb6daba7ecf5628ed2fec3763275orlikowski/* ====================================================================
7238b345c345cb79d81cf01fedc311bff001444ctrawick * The Apache Software License, Version 1.1
d8ed1028025480c672d9dc7266b54ac853bbb999trawick * Copyright (c) 2000 The Apache Software Foundation. All rights
d8ed1028025480c672d9dc7266b54ac853bbb999trawick * reserved.
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * Redistribution and use in source and binary forms, with or without
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * modification, are permitted provided that the following conditions
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * are met:
87a87c1e1afc7eb004bc10594a9de98411866a20jerenkrantz * 1. Redistributions of source code must retain the above copyright
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * notice, this list of conditions and the following disclaimer.
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * 2. Redistributions in binary form must reproduce the above copyright
7aae0c3ef8e7f18f57e2712815c7b48358e5ff68rbb * notice, this list of conditions and the following disclaimer in
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * the documentation and/or other materials provided with the
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * distribution.
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * 3. The end-user documentation included with the redistribution,
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * if any, must include the following acknowledgment:
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * "This product includes software developed by the
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * Apache Software Foundation (http://www.apache.org/)."
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * Alternately, this acknowledgment may appear in the software itself,
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * if and wherever such third-party acknowledgments normally appear.
1b92a71f5cbda8da4aa13af1034aab30b85bcd99minfrin * 4. The names "Apache" and "Apache Software Foundation" must
d66260b801a953237f71d6a4b26d8fd9ea419e3brbb * not be used to endorse or promote products derived from this
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * software without prior written permission. For written
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * permission, please contact apache@apache.org.
d66260b801a953237f71d6a4b26d8fd9ea419e3brbb * 5. Products derived from this software may not be called "Apache",
d472f67198d6b15dd1270136f180cca9c9263243trawick * nor may "Apache" appear in their name, without prior written
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * permission of the Apache Software Foundation.
4b34d6a5b70303010612df6c87da3ee91ae86078rbb * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
d472f67198d6b15dd1270136f180cca9c9263243trawick * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
d472f67198d6b15dd1270136f180cca9c9263243trawick * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7aae0c3ef8e7f18f57e2712815c7b48358e5ff68rbb * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37be7bf671bdb30d0689796a1a15cc47666e5b78sf * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
8a3a703eae0e35f674b189181609545c6fc77a09rbb * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * SUCH DAMAGE.
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * ====================================================================
8a3a703eae0e35f674b189181609545c6fc77a09rbb * This software consists of voluntary contributions made by many
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * individuals on behalf of the Apache Software Foundation. For more
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * information on the Apache Software Foundation, please see
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb * Portions of this software are based upon public domain software
7e27b1d417fa94db6e8c798a36c68de3a22f3937ianh * originally written at the National Center for Supercomputing Applications,
7e27b1d417fa94db6e8c798a36c68de3a22f3937ianh * University of Illinois, Urbana-Champaign.
05b7ad99e5d197b06c761fef0e06a44e353cbc54rbb/* ====================================================================
cd04c96e193a6bd4624d92382fd83bda52c8b170rjung * ApacheMonitor.c Simple program to manage and monitor Apache services.
164141857c02667118df04b14fe536d1756f0ef4jorton * Contributed by Mladen Turk <mturk@mappingsoft.com>
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar * 05 Aug 2001
cee52fb06eb61191ce5d495abda58a75a9bb1c4fcoar * ====================================================================
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin/* Should be enough */
typedef struct _st_APACHE_SERVICE
void ap_ClearServicesSt()
for (i = 0; i < MAX_APACHE_SERVICES; i++)
NULL,
buffer[0] = 0;
return buffer;
return FALSE;
case VER_PLATFORM_WIN32_NT:
#ifdef VER_VORKSTATION_NT
if (bOsVersionInfoEx)
#ifdef VER_SUITE_PERSONAL
#ifdef VER_VORKSTATION_NT
return FALSE;
case VER_PLATFORM_WIN32s:
return FALSE;
return TRUE;
if (fDefault)
if (hMenu)
sizeof(RECT),
if (!bResult) {
int nItem;
if (dwReaded > 0)
NULL,
NULL,
TRUE,
NULL,
NULL ,
&stInfo,
if (!bResult)
if (nRetValue)
return FALSE;
return TRUE;
if (bRedirectConsole)
NULL,
NULL,
TRUE,
NULL,
NULL ,
&stInfo,
&prInfo);
if (!bResult)
if (nRetValue)
return FALSE;
return TRUE;
int ticks;
if (sPos)
switch (dwCommand)
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_CONTINUE:
case SERVICE_APACHE_RESTART:
return FALSE;
return FALSE;
return FALSE;
else if (!serviceFlag)
return TRUE;
if (!sPos)
if (sPos)
return FALSE;
NULL,
NULL,
if (!schSCManager)
return FALSE;
switch (dwCommand)
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_CONTINUE:
if (serviceFlag)
case SERVICE_APACHE_RESTART:
return FALSE;
if (!--ticks)
if (!retValue)
return retValue;
return FALSE;
return FALSE;
return TRUE;
return FALSE;
dwPid = 0;
NULL,
NULL,
if (!schSCManager)
return FALSE;
if (lpdwPid)
return FALSE;
return FALSE;
dwPid = 0;
return rv;
int i, stPos = 0;
return FALSE;
++stPos;
return TRUE;
switch (message) {
case WM_INITDIALOG:
if (dwVerInfoSize) {
uVersionLen = 0;
TRUE);
return (TRUE);
case WM_COMMAND:
return (TRUE);
return FALSE;
switch (message)
case WM_INITDIALOG:
if (GetApacheServicesStatus())
return TRUE;
case WM_UPDATEMESSAGE:
return TRUE;
case WM_MEASUREITEM:
return TRUE;
case WM_SETCURSOR:
if (ap_consoleRun)
return TRUE;
case WM_DRAWITEM:
case ODA_SELECT:
case ODA_DRAWENTIRE:
case ODA_FOCUS:
return TRUE;
case WM_COMMAND:
case IDL_SERVICES:
case LBN_DBLCLK:
return TRUE;
case IDOK:
return TRUE;
case IDC_SSTART:
return TRUE;
case IDC_SSTOP:
return TRUE;
case IDC_SRESTART:
return TRUE;
case IDC_SABOUT:
if (!dlgAboutOn)
else if (ap_hwndAboutDlg)
return TRUE;
case WM_SIZE:
case SIZE_MINIMIZED:
return TRUE;
case WM_CLOSE:
return TRUE;
case WM_DESTROY:
return TRUE;
return FALSE;
return FALSE;
if (ap_hServiceDlg)
++nPrev;
++nNew;
if (ap_hServiceDlg)
if (ap_rescanServices)
if (ap_hServiceDlg)
else if (FindRunningServices())
if (ap_hServiceDlg)
switch (message)
case WM_CREATE:
case WM_QUIT:
case WM_TRAYMESSAGE:
switch(lParam)
case WM_LBUTTONDBLCLK:
if (!dlgServiceOn)
else if (ap_hServiceDlg)
case WM_RBUTTONUP:
case WM_COMMAND:
case IDM_RESTORE:
if (!dlgServiceOn)
else if (ap_hServiceDlg)
case IDM_ABOUT:
if (!dlgAboutOn)
else if (ap_hwndAboutDlg)
case IDM_EXIT:
PostQuitMessage(0);
return TRUE;
return FALSE;
return hWnd;
int nCmdShow)
if (hMutex)