You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/08/14 21:30:21 UTC

cvs commit: httpd-2.0/support/win32 ApacheMonitor.c ApacheMonitor.h ApacheMonitor.rc apsmall.ico apsrvmon.ico

wrowe       01/08/14 12:30:21

  Modified:    support/win32 ApacheMonitor.c ApacheMonitor.h
                        ApacheMonitor.rc
  Removed:     support/win32 apsmall.ico apsrvmon.ico
  Log:
  > 1. Cleaned the ApacheMonitor code a little bit.
  > 2. Removed two icons apmall.ico and apsrvmon.ico
  > 3. Added option to recognize the Apache*.exe (e.g. Apache-1.3.20.exe)
  > 4. Removed AboutBox
  > 5. Changed refresh time to 2/20 sec.
  
  Submitted by:	Mladen Turk <ml...@mail.inet.hr>
  
  Revision  Changes    Path
  1.4       +398 -538  httpd-2.0/support/win32/ApacheMonitor.c
  
  Index: ApacheMonitor.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/win32/ApacheMonitor.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApacheMonitor.c	2001/08/08 02:26:05	1.3
  +++ ApacheMonitor.c	2001/08/14 19:30:21	1.4
  @@ -69,6 +69,9 @@
   #ifndef STRICT
   #define STRICT
   #endif
  +#ifndef OEMRESOURCE
  +#define OEMRESOURCE
  +#endif
   
   #include <windows.h>
   #include <windowsx.h>
  @@ -92,8 +95,8 @@
   #define XBITMAP                16
   #define YBITMAP                16 
   #define MAX_LOADSTRING         100
  -#define REFRESH_TIME           1000           /* service refresh time (ms) */
  -#define RESCAN_TIME            10000          /* registry rescan time (ms) */
  +#define REFRESH_TIME           2000           /* service refresh time (ms) */
  +#define RESCAN_TIME            20000          /* registry rescan time (ms) */
   
   typedef struct _st_APACHE_SERVICE
   {
  @@ -105,70 +108,131 @@
   } ST_APACHE_SERVICE;
   
   /* Global variables */
  -HINSTANCE         ap_hInstance = NULL;
  -HWND              ap_hwndAboutDlg = NULL;
  -TCHAR             szTitle[MAX_LOADSTRING];          /* The title bar text */
  -TCHAR             szWindowClass[MAX_LOADSTRING];    /* Window Class Name  */
  -HICON             ap_icoStop;
  -HICON             ap_icoRun;
  -UINT              ap_uiTaskbarCreated;
  -DWORD             ap_OSVersion;
  -BOOL              dlgAboutOn = FALSE;
  -BOOL              dlgServiceOn = FALSE;
  -BOOL              ap_consoleRun = FALSE;
  -ST_APACHE_SERVICE ap_stServices[MAX_APACHE_SERVICES];
  -
  -HBITMAP           hbmpStart, hbmpStop; 
  -HBITMAP           hbmpPicture, hbmpOld; 
  -BOOL              ap_rescanServices;
  -HWND              ap_hServiceDlg;
  -HWND              ap_hMainWnd;
  -HWND              ap_hStdoutWnd;
  -HCURSOR           ap_cHourglass;
  -HCURSOR           ap_cArrow;
  -
  -HANDLE            h_stdOutR;
  -HANDLE            h_stdOutW;
  -HANDLE            h_stdInR;
  -HANDLE            h_stdInW;
  -HANDLE            h_stdErr;
  -PROCESS_INFORMATION ap_redirectedPI;
  +HINSTANCE         g_hInstance = NULL;
  +TCHAR             g_szTitle[MAX_LOADSTRING];          /* The title bar text */
  +TCHAR             g_szWindowClass[MAX_LOADSTRING];    /* Window Class Name  */
  +HICON             g_icoStop;
  +HICON             g_icoRun;
  +UINT              g_bUiTaskbarCreated;
  +DWORD             g_dwOSVersion;
  +BOOL              g_bDlgServiceOn = FALSE;
  +BOOL              g_bConsoleRun = FALSE;
  +ST_APACHE_SERVICE g_stServices[MAX_APACHE_SERVICES];
  +
  +HBITMAP           g_hBmpStart, g_hBmpStop; 
  +HBITMAP           g_hBmpPicture, g_hBmpOld; 
  +BOOL              g_bRescanServices;
  +HWND              g_hwndServiceDlg;
  +HWND              g_hwndMain;
  +HWND              g_hwndStdoutList;
  +HCURSOR           g_hCursorHourglass;
  +HCURSOR           g_hCursorArrow;
  +
  +HANDLE            g_hpipeOutRead;
  +HANDLE            g_hpipeOutWrite;
  +HANDLE            g_hpipeInRead;
  +HANDLE            g_hpipeInWrite;
  +HANDLE            g_hpipeStdError;
  +LANGID            g_LangID;
  +PROCESS_INFORMATION g_lpRedirectProc;
  +CRITICAL_SECTION    g_stcSection;
  +
  +static enum g_idMessages {
  +        AM_MSG_APPRUNNING,
  +        AM_LBL_SERVICE,
  +        AM_BTN_OK,
  +        AM_BTN_START,
  +        AM_BTN_STOP,
  +        AM_BTN_RESTART,
  +        AM_BTN_EXIT,
  +        AM_MSG_ERROR,
  +        AM_MSG_RUNNINGALL,
  +        AM_MSG_RUNNING,
  +        AM_MSG_RUNNINGNONE,
  +        AM_MSG_NOSERVICES,
  +        AM_MSG_MNUSHOW,
  +        AM_MSG_MNUEXIT,
  +        AM_MSG_SRVSTART,
  +        AM_MSG_SRVSTARTED,
  +        AM_MSG_SRVSTOP,
  +        AM_MSG_SRVSTOPPED,
  +        AM_MSG_SRVRESTART,
  +        AM_MSG_SRVRESTARTED,
  +        AM_MSG_SRVFAILED
  +    };
  +
  +/* locale language support */
  +static CHAR      
  +    *g_lpEnMessages[] = {
  +        "Apache monitor is allready started",
  +        "Service status:",
  +        "&OK",
  +        "&Start",
  +        "S&top",
  +        "&Restart",
  +        "E&xit",
  +        "Error",
  +        "Running all Apache services",
  +        "Running %d from %d Apache services",
  +        "Running none from %d Apache services",
  +        "No services installed",
  +        "&Show Services...",
  +        "&Exit...",
  +        "The %s is starting.",
  +        "The %s has started.",
  +        "The %s is stopping.",
  +        "The %s has stopped.",
  +        "The %s is restarting.",
  +        "The %s has restarted."
  +        "The requested operation has failed!"
  +    };
  +
   
  -void ap_ClearServicesSt()
  +static CHAR **g_lpMsg;
  +
  +void am_ClearServicesSt()
   {
       int i;
       for (i = 0; i < MAX_APACHE_SERVICES; i++)
       {
  -        if (ap_stServices[i].szServiceName)
  -            free(ap_stServices[i].szServiceName);
  -        if (ap_stServices[i].szDisplayName)
  -            free(ap_stServices[i].szDisplayName);
  -        if (ap_stServices[i].szDescription)
  -            free(ap_stServices[i].szDescription);
  -        if (ap_stServices[i].szImagePath)
  -            free(ap_stServices[i].szImagePath);
  +        if (g_stServices[i].szServiceName)
  +            free(g_stServices[i].szServiceName);
  +        if (g_stServices[i].szDisplayName)
  +            free(g_stServices[i].szDisplayName);
  +        if (g_stServices[i].szDescription)
  +            free(g_stServices[i].szDescription);
  +        if (g_stServices[i].szImagePath)
  +            free(g_stServices[i].szImagePath);
   
       }
  -    ZeroMemory(ap_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
  +    ZeroMemory(g_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
   
   }
   
  -void ErrorMessage(DWORD dwError)
  +void ErrorMessage(LPCSTR szError, BOOL bFatal)
   {
  -    LPVOID lpMsgBuf;
  -    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
  -                  FORMAT_MESSAGE_FROM_SYSTEM |
  -                  FORMAT_MESSAGE_IGNORE_INSERTS,
  -                  NULL,
  -                  dwError == ERROR_SUCCESS ? GetLastError() : dwError,
  -                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  -                  (LPTSTR) &lpMsgBuf, 0, NULL);
  -    MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONERROR);
  -    LocalFree(lpMsgBuf);
  -
  +    LPVOID lpMsgBuf  = NULL;
  +    if (szError)
  +        MessageBox(NULL, szError, g_lpMsg[AM_MSG_ERROR],
  +                    MB_OK | (bFatal ? MB_ICONERROR : MB_ICONEXCLAMATION));
  +    else
  +    {
  +        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
  +            FORMAT_MESSAGE_FROM_SYSTEM |
  +            FORMAT_MESSAGE_IGNORE_INSERTS,
  +            NULL,
  +            GetLastError(),
  +            g_LangID,
  +            (LPSTR) &lpMsgBuf, 0, NULL);
  +        MessageBox(NULL, (LPCSTR)lpMsgBuf, g_lpMsg[AM_MSG_ERROR],
  +                    MB_OK | (bFatal ? MB_ICONERROR : MB_ICONEXCLAMATION));
  +        LocalFree(lpMsgBuf);
  +    }
  +    if( bFatal)
  +        PostQuitMessage(0);
   }
   
  -LPTSTR GetStringRes(int id)
  +LPSTR GetStringRes(int id)
   {
     static TCHAR buffer[MAX_PATH];
   
  @@ -177,143 +241,37 @@
     return buffer;
   }
   
  -BOOL GetSystemOSVersion(LPSTR szVersion, LPDWORD dwVersion)
  +BOOL GetSystemOSVersion(LPDWORD dwVersion)
   {
  -    OSVERSIONINFOEX osvi;
  -    BOOL    bOsVersionInfoEx;
  -    char    szBuff[256];
  -    HKEY    hKey;
  -    char    szProductType[80];
  -    DWORD   dwBufLen;
  -    
  +    OSVERSIONINFO osvi;
       /* 
       Try calling GetVersionEx using the OSVERSIONINFOEX structure.
       If that fails, try using the OSVERSIONINFO structure.
       */
  -    ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
  -    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  +    ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
  +    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
       
  -    if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi)))
  -    {
  -        /* If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. */        
  -        osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  -        if (!GetVersionEx((OSVERSIONINFO *) &osvi)) 
  -            return FALSE;
  -    }
  +    if (!GetVersionEx(&osvi))
  +        return FALSE;
       
       switch (osvi.dwPlatformId)
       {
       case VER_PLATFORM_WIN32_NT:        
  -        /* Test for the product. */        
  -        if (szVersion!= NULL)
  -        {
  -            if (osvi.dwMajorVersion <= 4)
  -                strcpy(szVersion, "MS Windows NT ");
  -            else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
  -                strcpy(szVersion, "MS Windows 2000 ");
  -            else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
  -                strcpy(szVersion, "MS Windows XP ");
  -            /* Test for product type.*/            
  -#ifdef VER_VORKSTATION_NT
  -            if (bOsVersionInfoEx)
  -            {
  -                if (osvi.wProductType == VER_NT_WORKSTATION)
  -                {
  -#ifdef VER_SUITE_PERSONAL
  -                    if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
  -                        strcat(szVersion, "Personal ");
  -                    else
  -#endif
  -                    strcat(szVersion, "Professional ");
  -                }                
  -                else if (osvi.wProductType == VER_NT_SERVER)
  -                {
  -                    if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
  -                        strcat(szVersion, "DataCenter Server ");
  -                    else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
  -                        strcat(szVersion, "Advanced Server ");
  -                    else
  -                        strcat(szVersion, "Server ");
  -                }
  -            }
  -            else
  -            {
  -#endif                
  -                RegOpenKeyEx(HKEY_LOCAL_MACHINE,
  -                    "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
  -                    0, KEY_QUERY_VALUE, &hKey);
  -                RegQueryValueEx(hKey, "ProductType", NULL, NULL,
  -                    (LPBYTE) szProductType, &dwBufLen);
  -                RegCloseKey(hKey);
  -                if (lstrcmpi("WINNT", szProductType) == 0)
  -                    strcat(szVersion, "Workstation ");
  -                if (lstrcmpi("SERVERNT", szProductType) == 0)
  -                    strcat(szVersion, "Server ");
  -#ifdef VER_VORKSTATION_NT
  -            }            
  -#endif
  -            /* Get version, service pack (if any), and build number. */
  -            if (osvi.dwMajorVersion <= 4)
  -            {
  -                sprintf(szBuff, "version %d.%d %s (Build-%d)\n",
  -                        osvi.dwMajorVersion,
  -                        osvi.dwMinorVersion,
  -                        osvi.szCSDVersion,
  -                        osvi.dwBuildNumber & 0xFFFF);
  -            }
  -            else
  -            { 
  -                sprintf(szBuff, "%s (Build-%d)\n",
  -                    osvi.szCSDVersion,
  -                    osvi.dwBuildNumber & 0xFFFF);
  -            }
  -            strcat(szVersion, szBuff);
  -        }
  -        else if (dwVersion != NULL)
  -        {
  -            if (osvi.dwMajorVersion <= 4)
  -                *dwVersion = OS_VERSION_WINNT;
  -            else if (osvi.dwMajorVersion == 5)
  -                *dwVersion = OS_VERSION_WIN2K;
  -            else
  -                return FALSE;
  -            
  -        }
  -        break;
  +        if (osvi.dwMajorVersion <= 4)
  +            *dwVersion = OS_VERSION_WINNT;
  +        else if (osvi.dwMajorVersion == 5)
  +            *dwVersion = OS_VERSION_WIN2K;
  +        else
  +            return FALSE;
           
  +        break;        
       case VER_PLATFORM_WIN32_WINDOWS:
  -        if (szVersion != NULL)
  -        {
  -            if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
  -            {
  -                strcpy(szVersion, "MS Windows 95 ");
  -                if (osvi.szCSDVersion[1] == 'C')
  -                    strcat(szVersion, "OSR2 ");
  -            } 
  -            
  -            if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
  -            {
  -                strcpy(szVersion, "MS Windows 98 ");
  -                if (osvi.szCSDVersion[1] == 'A')
  -                    strcat(szVersion, "SE ");
  -            } 
  -            
  -            if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
  -            {
  -                strcpy(szVersion, "MS Windows Me ");
  -            }
  -        }
  -        if (dwVersion != NULL)
  -            *dwVersion = OS_VERSION_WIN9X;
  -        
  +            *dwVersion = OS_VERSION_WIN9X;        
           break;
           
       case VER_PLATFORM_WIN32s:
  -        if (szVersion != NULL)
  -            strcpy(szVersion, "Microsoft Win32s ");
  -        if (dwVersion != NULL)
  -            *dwVersion = OS_VERSION_WIN9X;
  -        break;
  +            *dwVersion = 0;
  +        return FALSE;
       default:
           return FALSE;
           break;
  @@ -334,30 +292,30 @@
       nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
       nid.uCallbackMessage = WM_TRAYMESSAGE;
       
  -    while (ap_stServices[i].szServiceName != NULL)
  +    while (g_stServices[i].szServiceName != NULL)
       {    
  -        if (ap_stServices[i].dwPid != 0)
  +        if (g_stServices[i].dwPid != 0)
               ++n;
           ++i;
       }
       if (dwMessage != NIM_DELETE)
       {
           if (n)
  -            nid.hIcon = ap_icoRun;
  +            nid.hIcon = g_icoRun;
           else
  -            nid.hIcon = ap_icoStop;
  +            nid.hIcon = g_icoStop;
       }
       else
           nid.hIcon = NULL;
  -    if (n == i)
  -        lstrcpy(nid.szTip, "Running all Apache services");
  +    if (n == i && n > 0)
  +        lstrcpy(nid.szTip, g_lpMsg[AM_MSG_RUNNINGALL]);
       else if (n)
  -        sprintf(nid.szTip, "Running %d from %d Apache services", n, i);
  +        sprintf(nid.szTip, g_lpMsg[AM_MSG_RUNNING], n, i);
  +    else if (i)
  +        sprintf(nid.szTip, g_lpMsg[AM_MSG_RUNNINGNONE], i);
       else
  -        sprintf(nid.szTip, "Running none from %d Apache services", n, i);
  -
  +        lstrcpy(nid.szTip, g_lpMsg[AM_MSG_NOSERVICES]);
       Shell_NotifyIcon(dwMessage, &nid);
  -    
   }
   
   void appendMenuItem(HMENU hMenu, UINT uMenuId, LPSTR szName, BOOL fDefault)
  @@ -388,10 +346,9 @@
   
       if (hMenu)
       {
  -        appendMenuItem(hMenu,  IDM_ABOUT, "&About...", FALSE);
  -        appendMenuItem(hMenu,  IDM_RESTORE, "&Show Services...", TRUE);
  +        appendMenuItem(hMenu,  IDM_RESTORE, g_lpMsg[AM_MSG_MNUSHOW], TRUE);
           appendMenuItem(hMenu,  0, "", FALSE);
  -        appendMenuItem(hMenu,  IDM_EXIT,  "&Exit...", FALSE);
  +        appendMenuItem(hMenu,  IDM_EXIT,  g_lpMsg[AM_MSG_MNUEXIT], FALSE);
   
           GetCursorPos(&pt);
           SetForegroundWindow(NULL);
  @@ -429,7 +386,7 @@
      return SetWindowPos (hwndChild, HWND_TOP, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
   }
   
  -static void addItem(HWND hDlg, LPSTR lpStr, HBITMAP hBmp) 
  +static void addListBoxItem(HWND hDlg, LPSTR lpStr, HBITMAP hBmp) 
   { 
       int nItem; 
    
  @@ -437,54 +394,65 @@
       SendMessage(hDlg, LB_SETITEMDATA, nItem, (LPARAM)hBmp); 
   } 
   
  +static void addListBoxString(HWND hListBox, LPSTR lpStr)
  +{
  +    static int nItems = 0;
  +    ++nItems;
  +    if ( nItems > MAX_LOADSTRING)
  +    {
  +        SendMessage(hListBox, LB_RESETCONTENT, 0, 0); 
  +        nItems = 1;
  +    }
  +    ListBox_SetCurSel(hListBox,
  +                      ListBox_AddString(hListBox, lpStr));
  +
  +}
   static DWORD WINAPI ConsoleOutputThread(LPVOID lpThreadParameter)
   {
  -    static BYTE lpBuffer[513];
  -    LPSTR lpBuf = lpBuffer;
  +    static BYTE lpBuffer[MAX_PATH+1];
  +    int nPtr = 0;
       BYTE  ch;
       DWORD dwReaded;
   
  -    while (ReadFile(h_stdOutR, &ch, 1, &dwReaded, NULL) == TRUE) 
  +    while (ReadFile(g_hpipeOutRead, &ch, 1, &dwReaded, NULL) == TRUE) 
       {
           if (dwReaded > 0) 
           {
  -            if (ch == '\n') 
  +            if (ch == '\n' || nPtr >= MAX_PATH) 
               {
  -                *lpBuf = '\0';
  -                ListBox_SetCurSel(ap_hStdoutWnd,
  -                                  ListBox_AddString(ap_hStdoutWnd, lpBuffer));
  -                lpBuf = lpBuffer;
  +                lpBuffer[nPtr] = '\0';
  +                addListBoxString(g_hwndStdoutList, lpBuffer);
  +                nPtr  = 0;
               } 
  -            else if (ch == '\t') 
  +            else if (ch == '\t' && nPtr < (MAX_PATH - 4)) 
               {
  -                int i, t;
  -                t = ((int)lpBuf - (int)lpBuffer) % 8;
  -                for (i = 0; i < 8 - t; ++i)
  -                    *lpBuf++ = ' ';
  +                int i;
  +                for (i = 0; i < 4; ++i)
  +                    lpBuffer[nPtr++] = ' ';
               }
               else if (ch != '\r')
  -                *lpBuf++ = ch;
  +                lpBuffer[nPtr++] = ch;
           }
       }
  -    CloseHandle(h_stdInW);
  -    CloseHandle(h_stdOutR);
  -    CloseHandle(h_stdErr);
  +    CloseHandle(g_hpipeInWrite);
  +    CloseHandle(g_hpipeOutRead);
  +    CloseHandle(g_hpipeStdError);
       return 0;
   }
   
   
   DWORD WINAPI ConsoleWaitingThread(LPVOID lpThreadParameter)
   {
  -    WaitForSingleObject(ap_redirectedPI.hThread, INFINITE);
  -    CloseHandle(ap_redirectedPI.hThread);
  +    WaitForSingleObject(g_lpRedirectProc.hThread, INFINITE);
  +    CloseHandle(g_lpRedirectProc.hThread);
       MessageBeep(100);
  -    ap_consoleRun = FALSE;
  -    SetCursor(ap_cArrow);
  +    g_bConsoleRun = FALSE;
  +    SetCursor(g_hCursorArrow);
       return 0;
   }
   
   
  -BOOL RunRedirectedConsole(LPTSTR szCmdLine, LPDWORD nRetValue)
  +BOOL RunRedirectedConsole(LPSTR szCmdLine)
   {
       
       DWORD  dwThreadId;
  @@ -498,21 +466,23 @@
       
       hProc = GetCurrentProcess();
   
  -    if (!CreatePipe(&h_stdInR, &h_stdInW, NULL, MAX_PATH))
  -        ErrorMessage(ERROR_SUCCESS);
  -    if (!CreatePipe(&h_stdOutR, &h_stdOutW, NULL, MAX_PATH*8))
  -        ErrorMessage(ERROR_SUCCESS);
  +    if (!CreatePipe(&g_hpipeInRead, &g_hpipeInWrite, NULL, MAX_PATH))
  +        ErrorMessage(NULL, TRUE);
  +    if (!CreatePipe(&g_hpipeOutRead, &g_hpipeOutWrite, NULL, MAX_PATH*8))
  +        ErrorMessage(NULL, TRUE);
           
  -    DuplicateHandle(hProc, h_stdInR, hProc, &h_stdInR, 0, TRUE, 
  +    DuplicateHandle(hProc, g_hpipeInRead, hProc, &g_hpipeInRead, 0, TRUE, 
                       DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS);
  -    DuplicateHandle(hProc, h_stdOutW, hProc, &h_stdOutW, 0, TRUE, 
  +    DuplicateHandle(hProc, g_hpipeOutWrite, hProc, &g_hpipeOutWrite, 0, TRUE, 
                       DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS);
  -    DuplicateHandle(hProc, h_stdOutW, hProc, &h_stdErr, 0, TRUE, 
  +    DuplicateHandle(hProc, g_hpipeOutWrite, hProc, &g_hpipeStdError, 0, TRUE, 
                       DUPLICATE_SAME_ACCESS);
  -    
  -    stInfo.hStdInput  = h_stdInR;
  -    stInfo.hStdOutput = h_stdOutW;
  -    stInfo.hStdError  = h_stdErr;
  +    if (!g_hpipeInRead && !g_hpipeOutWrite && !g_hpipeStdError)
  +        ErrorMessage(NULL, TRUE);
  +
  +    stInfo.hStdInput  = g_hpipeInRead;
  +    stInfo.hStdOutput = g_hpipeOutWrite;
  +    stInfo.hStdError  = g_hpipeStdError;
   
       bResult = CreateProcess(NULL,
           szCmdLine,
  @@ -523,32 +493,29 @@
           NULL,
           NULL ,
           &stInfo,
  -        &ap_redirectedPI);
  +        &g_lpRedirectProc);
   
   
  -    CloseHandle(h_stdInR);
  -    CloseHandle(h_stdOutW);
  -    CloseHandle(h_stdErr);
  +    CloseHandle(g_hpipeInRead);
  +    CloseHandle(g_hpipeOutWrite);
  +    CloseHandle(g_hpipeStdError);
   
       if (!bResult)
       {     
  -        if (nRetValue)
  -            *nRetValue = GetLastError();
  -        CloseHandle(h_stdInW);
  -        CloseHandle(h_stdOutR);
  -        CloseHandle(h_stdErr);
  +        CloseHandle(g_hpipeInWrite);
  +        CloseHandle(g_hpipeOutRead);
  +        CloseHandle(g_hpipeStdError);
           return FALSE;
       }
   
       CloseHandle(CreateThread(NULL, 0, ConsoleOutputThread, 0, 0, &dwThreadId));
  -    ResumeThread(ap_redirectedPI.hThread);
  +    ResumeThread(g_lpRedirectProc.hThread);
       CloseHandle(CreateThread(NULL, 0, ConsoleWaitingThread, 0, 0, &dwThreadId));
   
       return TRUE;
   }
   
  -BOOL RunAndForgetConsole(LPTSTR szCmdLine,
  -                         LPDWORD nRetValue,
  +BOOL RunAndForgetConsole(LPSTR szCmdLine,
                            BOOL  bRedirectConsole)
   {
           
  @@ -557,7 +524,7 @@
       BOOL bResult;
       
       if (bRedirectConsole)
  -        return RunRedirectedConsole(szCmdLine, nRetValue);
  +        return RunRedirectedConsole(szCmdLine);
   
       
       ZeroMemory(&stInfo, sizeof(stInfo));
  @@ -578,11 +545,9 @@
   
       if (!bResult)
       {     
  -        if (nRetValue)
  -            *nRetValue = GetLastError();
           return FALSE;
       }
  -    if (ap_OSVersion == OS_VERSION_WIN9X) /* give some time to rescan the status */
  +    if (g_dwOSVersion == OS_VERSION_WIN9X) /* give some time to rescan the status */
           Sleep(2000);
       CloseHandle(prInfo.hThread);
       CloseHandle(prInfo.hProcess);
  @@ -595,7 +560,6 @@
       CHAR      szBuf[MAX_PATH];
       CHAR      szMsg[MAX_PATH];
       LPSTR     sPos;
  -    DWORD     retCode;
       BOOL      retValue;
       BOOL      serviceFlag = TRUE;
       SC_HANDLE schService;
  @@ -604,7 +568,7 @@
       LPSTR     *args;
       int       ticks;
   
  -    if (ap_OSVersion == OS_VERSION_WIN9X)
  +    if (g_dwOSVersion == OS_VERSION_WIN9X)
       {
           sPos = strstr(szImagePath, "-k start");
           if (sPos)
  @@ -616,9 +580,8 @@
                   lstrcat(szBuf, " -k stop -n ");
                   break;
               case SERVICE_CONTROL_CONTINUE:
  -                sprintf(szMsg, "The %s is starting.", szServiceName);
  -                ListBox_SetCurSel(ap_hStdoutWnd,
  -                                   ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTART], szServiceName);
  +                addListBoxString(g_hwndStdoutList, szMsg);
                   lstrcat(szBuf, " -k start -n ");
                   serviceFlag = FALSE;
                   break;
  @@ -632,23 +595,21 @@
           }
           else
               return FALSE;
  -        ap_consoleRun = TRUE;
  -        SetCursor(ap_cHourglass);
  -        if (!RunAndForgetConsole(szBuf, &retCode, serviceFlag))
  +        g_bConsoleRun = TRUE;
  +        SetCursor(g_hCursorHourglass);
  +        if (!RunAndForgetConsole(szBuf, serviceFlag))
           {
  -            ErrorMessage(retCode);
  -            ap_consoleRun = FALSE;
  -            SetCursor(ap_cArrow);
  +            ErrorMessage(NULL, FALSE);
  +            g_bConsoleRun = FALSE;
  +            SetCursor(g_hCursorArrow);
               return FALSE;
           }
           else if (!serviceFlag)
           {
  -            sprintf(szMsg, "The %s has started.", szServiceName);
  -            ListBox_SetCurSel(ap_hStdoutWnd,
  -                              ListBox_AddString(ap_hStdoutWnd, szMsg));
  -
  -            ap_consoleRun = FALSE;
  -            SetCursor(ap_cArrow);
  +            sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTARTED], szServiceName);
  +            addListBoxString(g_hwndStdoutList, szMsg);
  +            g_bConsoleRun = FALSE;
  +            SetCursor(g_hCursorArrow);
               return TRUE;
           }
       }
  @@ -677,14 +638,13 @@
           if (schService != NULL)
           {
               retValue = FALSE;
  -            ap_consoleRun = TRUE;
  -            SetCursor(ap_cHourglass);
  +            g_bConsoleRun = TRUE;
  +            SetCursor(g_hCursorHourglass);
               switch (dwCommand)
               {
                   case SERVICE_CONTROL_STOP:
  -                    sprintf(szMsg, "The %s is stopping.", szServiceName);
  -                    ListBox_SetCurSel(ap_hStdoutWnd,
  -                                      ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                    sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTOP], szServiceName);
  +                    addListBoxString(g_hwndStdoutList, szMsg);
                       if(ControlService(schService, SERVICE_CONTROL_STOP, &schSStatus)) 
                       {
                           Sleep(1000);
  @@ -701,16 +661,14 @@
                           if(schSStatus.dwCurrentState == SERVICE_STOPPED)
                           {
                               retValue = TRUE;
  -                            sprintf(szMsg, "The %s has stopped.", szServiceName);
  -                            ListBox_SetCurSel(ap_hStdoutWnd,
  -                                              ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                            sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTOPPED], szServiceName);
  +                            addListBoxString(g_hwndStdoutList, szMsg);
                           }
                       }
                   break;                
                   case SERVICE_CONTROL_CONTINUE:
  -                    sprintf(szMsg, "The %s is starting.", szServiceName);
  -                    ListBox_SetCurSel(ap_hStdoutWnd,
  -                                      ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                    sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTART], szServiceName);
  +                    addListBoxString(g_hwndStdoutList, szMsg);
                       args = (char **)malloc(3 * sizeof(char*));
                       args[0] = szBuf;
                       if (serviceFlag)
  @@ -736,18 +694,16 @@
                           if(schSStatus.dwCurrentState == SERVICE_RUNNING)
                           {
                               retValue = TRUE;
  -                            sprintf(szMsg, "The %s has started.", szServiceName);
  -                            ListBox_SetCurSel(ap_hStdoutWnd,
  -                                              ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                            sprintf(szMsg, g_lpMsg[AM_MSG_SRVSTARTED], szServiceName);
  +                            addListBoxString(g_hwndStdoutList, szMsg);
                           }
                       }
                       /* is this OK to do? */
                       free(args);
                   break;                
                   case SERVICE_APACHE_RESTART:
  -                    sprintf(szMsg, "The %s is restarting.", szServiceName);
  -                    ListBox_SetCurSel(ap_hStdoutWnd,
  -                                      ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                    sprintf(szMsg, g_lpMsg[AM_MSG_SRVRESTART], szServiceName);
  +                    addListBoxString(g_hwndStdoutList, szMsg);
                       if(ControlService(schService, SERVICE_APACHE_RESTART, &schSStatus)) 
                       {
                           ticks = 60;
  @@ -758,8 +714,8 @@
                               {
                                   CloseServiceHandle(schService);
                                   CloseServiceHandle(schSCManager);
  -                                ap_consoleRun = FALSE;
  -                                SetCursor(ap_cArrow);
  +                                g_bConsoleRun = FALSE;
  +                                SetCursor(g_hCursorArrow);
                                   return FALSE;
                               }
                               if (!--ticks)
  @@ -769,23 +725,22 @@
                       if(schSStatus.dwCurrentState == SERVICE_RUNNING)
                       {
                           retValue = TRUE;
  -                        sprintf(szMsg, "The %s has restarted.", szServiceName);
  -                        ListBox_SetCurSel(ap_hStdoutWnd,
  -                                          ListBox_AddString(ap_hStdoutWnd, szMsg));
  +                        sprintf(szMsg, g_lpMsg[AM_MSG_SRVRESTARTED], szServiceName);
  +                        addListBoxString(g_hwndStdoutList, szMsg);
                       }
                   break;                
               }
               CloseServiceHandle(schService);
               CloseServiceHandle(schSCManager);
               if (!retValue)
  -                ErrorMessage(ERROR_SUCCESS);
  -            ap_consoleRun = FALSE;
  -            SetCursor(ap_cArrow);
  +                ErrorMessage(g_lpMsg[AM_MSG_SRVFAILED], FALSE);
  +            g_bConsoleRun = FALSE;
  +            SetCursor(g_hCursorArrow);
               return retValue;
               
           }
           else
  -            ap_rescanServices = TRUE;
  +            g_bRescanServices = TRUE;
           
           CloseServiceHandle(schSCManager);
           return FALSE;
  @@ -803,7 +758,7 @@
       SC_HANDLE               schSCManager;    
       SERVICE_STATUS          schSStatus;
   
  -    if (ap_OSVersion == OS_VERSION_WIN9X)
  +    if (g_dwOSVersion == OS_VERSION_WIN9X)
       {
           hWnd = FindWindow("ApacheWin95ServiceMonitor", szServiceName);
           if (hWnd && GetWindowThreadProcessId(hWnd, &dwPid))
  @@ -841,7 +796,7 @@
               return dwPid == SERVICE_RUNNING ? TRUE : FALSE;
           }
           else
  -            ap_rescanServices = TRUE;
  +            g_bRescanServices = TRUE;
   
           CloseServiceHandle(schSCManager);
           return FALSE;
  @@ -856,13 +811,13 @@
       int i = 0;
       DWORD dwPid;
       BOOL rv = FALSE;
  -    while (ap_stServices[i].szServiceName != NULL)
  +    while (g_stServices[i].szServiceName != NULL)
       {    
  -        if (!IsServiceRunning(ap_stServices[i].szServiceName, &dwPid))
  +        if (!IsServiceRunning(g_stServices[i].szServiceName, &dwPid))
               dwPid = 0;
  -        if (ap_stServices[i].dwPid != dwPid)
  +        if (g_stServices[i].dwPid != dwPid)
               rv = TRUE;
  -        ap_stServices[i].dwPid = dwPid;
  +        g_stServices[i].dwPid = dwPid;
           ++i;
       }                        
       return rv;
  @@ -881,17 +836,17 @@
       DWORD   dwBufLen = MAX_PATH;
       int     i, stPos = 0;
   
  -    ap_rescanServices = FALSE;
  +    g_bRescanServices = FALSE;
   
       retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                               "System\\CurrentControlSet\\Services\\",
                               0, KEY_READ, &hKey);
       if (retCode != ERROR_SUCCESS)
       {
  -        ErrorMessage(retCode);
  +        ErrorMessage(NULL, FALSE);
           return FALSE;
       }
  -    ap_ClearServicesSt();
  +    am_ClearServicesSt();
       for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++)
       {
   
  @@ -912,19 +867,21 @@
                   {
                       lstrcpy(szBuf, szImagePath);
                       CharLower(szBuf);
  -                    if (strstr(szBuf, "\\apache.exe") != NULL)
  +                    /* the service name could be Apache*.exe */
  +                    if (strstr(szBuf, "\\apache") != NULL && strstr(szBuf, ".exe") &&
  +                       (strstr(szBuf, "--ntservice") != NULL || strstr(szBuf, "-k ") !=NULL))
                       {
  -                        ap_stServices[stPos].szServiceName = strdup(achKey);
  -                        ap_stServices[stPos].szImagePath = strdup(szImagePath);
  +                        g_stServices[stPos].szServiceName = strdup(achKey);
  +                        g_stServices[stPos].szImagePath = strdup(szImagePath);
                           dwBufLen = MAX_PATH;
                           if (RegQueryValueEx(hSubKey, "Description", NULL,
                                         &dwKeyType, szBuf, &dwBufLen) == ERROR_SUCCESS)
  -                            ap_stServices[stPos].szDescription = strdup(szBuf);
  +                            g_stServices[stPos].szDescription = strdup(szBuf);
   
                           dwBufLen = MAX_PATH;
                           if (RegQueryValueEx(hSubKey, "DisplayName", NULL,
                                         &dwKeyType, szBuf, &dwBufLen) == ERROR_SUCCESS)
  -                            ap_stServices[stPos].szDisplayName= strdup(szBuf);
  +                            g_stServices[stPos].szDisplayName= strdup(szBuf);
                           ++stPos;
                           if (stPos >= MAX_APACHE_SERVICES)
                               retCode = !ERROR_SUCCESS;
  @@ -939,124 +896,13 @@
       return TRUE;
   }
   
  -LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  -{
  -    static  HFONT hfontDlg;    /* Font for dialog text */
  -    static  HFONT hFinePrint;  /* Font for 'fine print' in dialog */
  -    DWORD   dwVerInfoSize;     /* Size of version information block */
  -    LPSTR   lpVersion;         /* String pointer to 'version' text */
  -    DWORD   dwVerHnd=0;        /* An 'ignored' parameter, always '0' */
  -    UINT    uVersionLen;
  -    WORD    wRootLen;
  -    BOOL    bRetCode;
  -    int     i;
  -    char    szFullPath[256];
  -    char    szResult[256];
  -    char    szGetName[256];
  -    char    szVersion[256];
  -    DWORD   dwResult;
  -    
  -    switch (message) {
  -    case WM_INITDIALOG:
  -        ShowWindow(hDlg, SW_HIDE);
  -        ap_hwndAboutDlg = hDlg;
  -        
  -        hfontDlg = CreateFont(13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  -            VARIABLE_PITCH | FF_SWISS, "");
  -        hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  -            VARIABLE_PITCH | FF_SWISS, "");
  -
  -        CenterWindow(hDlg);
  -        GetModuleFileName(ap_hInstance, szFullPath, sizeof(szFullPath));
  -        
  -        /* Now lets dive in and pull out the version information: */
  -        dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
  -        if (dwVerInfoSize) {
  -            LPSTR   lpstrVffInfo;
  -            HANDLE  hMem;
  -            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
  -            lpstrVffInfo  = GlobalLock(hMem);
  -            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
  -            lstrcpy(szGetName, GetStringRes(IDS_VER_INFO_LANG));
  -            
  -            wRootLen = lstrlen(szGetName); /* Save this position */
  -            
  -            /* Set the title of the dialog: */
  -            lstrcat(szGetName, "ProductName");
  -            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
  -                (LPSTR)szGetName,
  -                (LPVOID)&lpVersion,
  -                (UINT *)&uVersionLen);
  -            
  -            /* Notice order of version and string... */
  -            lstrcpy(szResult, "About ");
  -            lstrcat(szResult, lpVersion);
  -            
  -            SetWindowText(hDlg, szResult);
  -            
  -            /* Walk through the dialog items that we want to replace: */
  -            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
  -                GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
  -                szGetName[wRootLen] = (char)0;
  -                lstrcat(szGetName, szResult);
  -                uVersionLen   = 0;
  -                lpVersion     = NULL;
  -                bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
  -                    (LPSTR)szGetName,
  -                    (LPVOID)&lpVersion,
  -                    (UINT *)&uVersionLen);
  -                
  -                if (bRetCode && uVersionLen && lpVersion) {
  -                    /* Replace dialog item text with version info */
  -                    lstrcpy(szResult, lpVersion);
  -                    SetDlgItemText(hDlg, i, szResult);
  -                }
  -                else
  -                {
  -                    dwResult = GetLastError();
  -                    
  -                    wsprintf(szResult, GetStringRes(IDS_VERSION_ERROR), dwResult);
  -                    SetDlgItemText(hDlg, i, szResult);
  -                }
  -                SendMessage(GetDlgItem(hDlg, i), WM_SETFONT,
  -                    (UINT)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
  -                    TRUE);
  -            }
  -            
  -            
  -            GlobalUnlock(hMem);
  -            GlobalFree(hMem);
  -            
  -        } 
  -        
  -        SendMessage(GetDlgItem(hDlg, IDC_LABEL), WM_SETFONT,
  -            (WPARAM)hfontDlg,(LPARAM)TRUE);
  -        if (!GetSystemOSVersion(szVersion, NULL))
  -            strcpy(szVersion, "Unknown Version");
  -        SetWindowText(GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
  -        ShowWindow(hDlg, SW_SHOW);
  -        return (TRUE);
  -        
  -      case WM_COMMAND:
  -          if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
  -              EndDialog(hDlg, TRUE);
  -              DeleteObject(hfontDlg);
  -              DeleteObject(hFinePrint);
  -              return (TRUE);
  -          }
  -          break;
  -   }
  -   
  -   return FALSE;
  -}
   
   LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   {
   
  -    CHAR        tchBuffer[MAX_PATH]; 
  -    CHAR        tsbBuffer[MAX_PATH];
  +    CHAR        szBuf[MAX_PATH]; 
       HWND        hListBox;
  -    static HWND hStatusBar; 
  +    static      HWND  hStatusBar; 
       TEXTMETRIC  tm; 
       int         i, y; 
       HDC         hdcMem; 
  @@ -1065,31 +911,37 @@
       LPMEASUREITEMSTRUCT lpmis; 
       LPDRAWITEMSTRUCT    lpdis; 
   
  -    ZeroMemory(tchBuffer, MAX_PATH);
  -    ZeroMemory(tsbBuffer, MAX_PATH);
  +    ZeroMemory(szBuf, MAX_PATH);
       switch (message) 
       { 
    
           case WM_INITDIALOG: 
               ShowWindow(hDlg, SW_HIDE);
  -            ap_hServiceDlg = hDlg;
  -            hbmpStart = LoadBitmap(ap_hInstance, MAKEINTRESOURCE(IDB_BMPRUN)); 
  -            hbmpStop  = LoadBitmap(ap_hInstance, MAKEINTRESOURCE(IDB_BMPSTOP)); 
  +            g_hwndServiceDlg = hDlg;
  +            g_hBmpStart = LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BMPRUN),
  +                                    IMAGE_BITMAP, XBITMAP, YBITMAP, LR_DEFAULTCOLOR); 
  +            g_hBmpStop  = LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BMPSTOP), 
  +                                    IMAGE_BITMAP, XBITMAP, YBITMAP, LR_DEFAULTCOLOR); 
   
               Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
               Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
               Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
  +            SetWindowText(GetDlgItem(hDlg, IDC_SSTART), g_lpMsg[AM_BTN_START]); 
  +            SetWindowText(GetDlgItem(hDlg, IDC_SSTOP), g_lpMsg[AM_BTN_STOP]); 
  +            SetWindowText(GetDlgItem(hDlg, IDC_SRESTART), g_lpMsg[AM_BTN_RESTART]); 
  +            SetWindowText(GetDlgItem(hDlg, IDC_SEXIT), g_lpMsg[AM_BTN_EXIT]); 
  +            SetWindowText(GetDlgItem(hDlg, IDC_SSTATUS), g_lpMsg[AM_LBL_SERVICE]); 
               hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
  -            ap_hStdoutWnd = GetDlgItem(hDlg, IDL_STDOUT);
  +            g_hwndStdoutList = GetDlgItem(hDlg, IDL_STDOUT);
               hStatusBar = CreateStatusWindow(SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE,
                                               "", hDlg, IDC_STATBAR);            
               if (GetApacheServicesStatus())
               {
                   i = 0;
  -                while (ap_stServices[i].szServiceName != NULL)
  +                while (g_stServices[i].szServiceName != NULL)
                   {    
  -                    addItem(hListBox, ap_stServices[i].szDisplayName, 
  -                        ap_stServices[i].dwPid == 0 ? hbmpStop : hbmpStart);
  +                    addListBoxItem(hListBox, g_stServices[i].szDisplayName, 
  +                        g_stServices[i].dwPid == 0 ? g_hBmpStop : g_hBmpStart);
                       ++i;
                   }
               }
  @@ -1102,14 +954,15 @@
           case WM_UPDATEMESSAGE:
               hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
               SendMessage(hListBox, LB_RESETCONTENT, 0, 0); 
  +            SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)"");
               Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
               Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
               Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
               i = 0;
  -            while (ap_stServices[i].szServiceName != NULL)
  +            while (g_stServices[i].szServiceName != NULL)
               {    
  -                addItem(hListBox, ap_stServices[i].szDisplayName, 
  -                    ap_stServices[i].dwPid == 0 ? hbmpStop : hbmpStart);
  +                addListBoxItem(hListBox, g_stServices[i].szDisplayName, 
  +                    g_stServices[i].dwPid == 0 ? g_hBmpStop : g_hBmpStart);
                   ++i;
               }
               SendMessage(hListBox, LB_SETCURSEL, 0, 0); 
  @@ -1124,16 +977,15 @@
           case WM_MEASUREITEM: 
    
               lpmis = (LPMEASUREITEMSTRUCT) lParam; 
  -            lpmis->itemHeight = 16; 
  +            lpmis->itemHeight = YBITMAP; 
               return TRUE; 
           case WM_SETCURSOR:
  -            if (ap_consoleRun)
  -                SetCursor(ap_cHourglass);
  +            if (g_bConsoleRun)
  +                SetCursor(g_hCursorHourglass);
               else
  -                SetCursor(ap_cArrow);
  +                SetCursor(g_hCursorArrow);
               return TRUE;
           case WM_DRAWITEM: 
  - 
               lpdis = (LPDRAWITEMSTRUCT) lParam; 
               if (lpdis->itemID == -1) 
               { 
  @@ -1143,11 +995,11 @@
               { 
                   case ODA_SELECT: 
                   case ODA_DRAWENTIRE: 
  -                    hbmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem, 
  +                    g_hBmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem, 
                           LB_GETITEMDATA, lpdis->itemID, (LPARAM) 0); 
    
                       hdcMem = CreateCompatibleDC(lpdis->hDC); 
  -                    hbmpOld = SelectObject(hdcMem, hbmpPicture); 
  +                    g_hBmpOld = SelectObject(hdcMem, g_hBmpPicture); 
    
                       BitBlt(lpdis->hDC, 
                           lpdis->rcItem.left, lpdis->rcItem.top, 
  @@ -1155,13 +1007,13 @@
                           lpdis->rcItem.bottom - lpdis->rcItem.top, 
                           hdcMem, 0, 0, SRCCOPY); 
                       SendMessage(lpdis->hwndItem, LB_GETTEXT, 
  -                        lpdis->itemID, (LPARAM) tchBuffer); 
  +                        lpdis->itemID, (LPARAM) szBuf); 
    
                       GetTextMetrics(lpdis->hDC, &tm);  
                       y = (lpdis->rcItem.bottom + lpdis->rcItem.top - 
                           tm.tmHeight) / 2; 
     
  -                    SelectObject(hdcMem, hbmpOld); 
  +                    SelectObject(hdcMem, g_hBmpOld); 
                       DeleteDC(hdcMem); 
    
                       rcBitmap.left = lpdis->rcItem.left + XBITMAP + 2; 
  @@ -1171,21 +1023,23 @@
   
                       if (lpdis->itemState & ODS_SELECTED) 
                       { 
  -                        if (hbmpPicture == hbmpStop)
  +                        if (g_hBmpPicture == g_hBmpStop)
                           {
                               Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE);
                               Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
                               Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
                           }
  -                        else if (hbmpPicture == hbmpStart) 
  +                        else if (g_hBmpPicture == g_hBmpStart) 
                           {
                               Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
                               Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE);
                               Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE);
                           }
  -                        if (ap_stServices[lpdis->itemID].szDescription)
  -                            lstrcpy(tsbBuffer, ap_stServices[lpdis->itemID].szDescription); 
  -                        SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)tsbBuffer);
  +                        if (g_stServices[lpdis->itemID].szDescription)
  +                            SendMessage(hStatusBar, SB_SETTEXT, 0, 
  +                                        (LPARAM)g_stServices[lpdis->itemID].szDescription);
  +                        else
  +                            SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)"");
                           
                           SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); 
                           SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); 
  @@ -1200,8 +1054,8 @@
                       TextOut(lpdis->hDC, 
                           XBITMAP + 6, 
                           y, 
  -                        tchBuffer, 
  -                        strlen(tchBuffer)); 
  +                        szBuf, 
  +                        strlen(szBuf)); 
                       break; 
    
                   case ODA_FOCUS: 
  @@ -1215,22 +1069,22 @@
                       switch (HIWORD(wParam))
                       {
                           case LBN_DBLCLK:
  -                            /* if started then stop, if stopped the start the service */
  +                            /* if started then stop, if stopped then start the service */
                               hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
                               nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); 
                               if (nItem != LB_ERR)
                               {
  -                                hbmpPicture = (HBITMAP)SendMessage(hListBox, LB_GETITEMDATA,
  +                                g_hBmpPicture = (HBITMAP)SendMessage(hListBox, LB_GETITEMDATA,
                                                                  nItem, (LPARAM) 0); 
  -                                if (hbmpPicture == hbmpStop)
  +                                if (g_hBmpPicture == g_hBmpStop)
                                   {
  -                                    ApacheManageService(ap_stServices[nItem].szServiceName,
  -                                                ap_stServices[nItem].szImagePath,
  +                                    ApacheManageService(g_stServices[nItem].szServiceName,
  +                                                g_stServices[nItem].szImagePath,
                                                   SERVICE_CONTROL_CONTINUE);
                                   }
                                   else
  -                                    ApacheManageService(ap_stServices[nItem].szServiceName,
  -                                                ap_stServices[nItem].szImagePath,
  +                                    ApacheManageService(g_stServices[nItem].szServiceName,
  +                                                g_stServices[nItem].szImagePath,
                                                   SERVICE_CONTROL_STOP);
   
                               }
  @@ -1241,59 +1095,46 @@
                   case IDOK: 
                       EndDialog(hDlg, TRUE); 
                       return TRUE; 
  -                break;
                   case IDC_SSTART: 
                       Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
                       hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
                       nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); 
                       if (nItem != LB_ERR)
                       {
  -                        ApacheManageService(ap_stServices[nItem].szServiceName,
  -                                             ap_stServices[nItem].szImagePath,
  +                        ApacheManageService(g_stServices[nItem].szServiceName,
  +                                             g_stServices[nItem].szImagePath,
                                                SERVICE_CONTROL_CONTINUE);
                       }
                       Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE);
                       return TRUE;
  -                break;
                   case IDC_SSTOP: 
                       Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
                       hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
                       nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); 
                       if (nItem != LB_ERR)
                       {
  -                        ApacheManageService(ap_stServices[nItem].szServiceName,
  -                                             ap_stServices[nItem].szImagePath,
  +                        ApacheManageService(g_stServices[nItem].szServiceName,
  +                                             g_stServices[nItem].szImagePath,
                                                SERVICE_CONTROL_STOP);
                       }
                       Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE);
                       return TRUE;
  -                break;
                   case IDC_SRESTART: 
                       Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
                       hListBox = GetDlgItem(hDlg, IDL_SERVICES); 
                       nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); 
                       if (nItem != LB_ERR)
                       {
  -                        ApacheManageService(ap_stServices[nItem].szServiceName,
  -                                             ap_stServices[nItem].szImagePath,
  +                        ApacheManageService(g_stServices[nItem].szServiceName,
  +                                             g_stServices[nItem].szImagePath,
                                                SERVICE_APACHE_RESTART);
                       }
                       Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE);
                       return TRUE;
  -                break;
  -                case IDC_SABOUT: 
  -                   if (!dlgAboutOn)
  -                   {
  -                      dlgAboutOn = TRUE;
  -                      DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX),
  -                             ap_hMainWnd, (DLGPROC)AboutDlgProc);
  -                      dlgAboutOn = FALSE;
  -                      ap_hwndAboutDlg = NULL;                      
  -                   }
  -                   else if (ap_hwndAboutDlg)
  -                       SetFocus(ap_hwndAboutDlg);
  +                case IDC_SEXIT: 
  +                    EndDialog( hDlg, TRUE);
  +                    SendMessage( g_hwndMain, WM_COMMAND, (WPARAM)IDM_EXIT, 0);
                       return TRUE;
  -                break;
                }
           break;
           case WM_SIZE:
  @@ -1305,12 +1146,13 @@
                   break;
               }
           break;
  +        case WM_QUIT:
           case WM_CLOSE: 
               EndDialog(hDlg, TRUE);
               return TRUE;
           case WM_DESTROY: 
  -            DeleteObject(hbmpStart); 
  -            DeleteObject(hbmpStop); 
  +            DeleteObject(g_hBmpStart); 
  +            DeleteObject(g_hBmpStop); 
               return TRUE; 
           default:
               return FALSE;
  @@ -1322,43 +1164,46 @@
   VOID CALLBACK MainTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
   {
       int nPrev = 0, nNew = 0;
  +    EnterCriticalSection(&g_stcSection);
       if (idEvent == WM_TIMER_RESCAN)
       {
  -        if (FindRunningServices() || ap_rescanServices)
  +        if (FindRunningServices() || g_bRescanServices)
           {
               ShowNotifyIcon(hWnd, NIM_MODIFY);
  -            if (ap_hServiceDlg)
  -                PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0);
  +            if (g_hwndServiceDlg)
  +                PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
           }
           /* check if services list changed */
  -        while (ap_stServices[nPrev].szServiceName != NULL)
  +        while (g_stServices[nPrev].szServiceName != NULL)
               ++nPrev;
           GetApacheServicesStatus();
  -        while (ap_stServices[nNew].szServiceName != NULL)
  +        while (g_stServices[nNew].szServiceName != NULL)
               ++nNew;
           if (nPrev != nNew)
           {
               ShowNotifyIcon(hWnd, NIM_MODIFY);
  -            if (ap_hServiceDlg)
  -                PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0);
  +            if (g_hwndServiceDlg)
  +                PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
           }
       }
       else if (idEvent == WM_TIMER_REFRESH)
       {
  -        if (ap_rescanServices)
  +        if (g_bRescanServices)
           {
               GetApacheServicesStatus();
               ShowNotifyIcon(hWnd, NIM_MODIFY);
  -            if (ap_hServiceDlg)
  -                PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0);
  +            if (g_hwndServiceDlg)
  +                PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
           }
           else if (FindRunningServices())
           {
               ShowNotifyIcon(hWnd, NIM_MODIFY);
  -            if (ap_hServiceDlg)
  -                PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0);
  +            if (g_hwndServiceDlg)
  +                PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
           }
       }
  +    LeaveCriticalSection(&g_stcSection);
  +
   }
   
   
  @@ -1366,7 +1211,7 @@
                             WPARAM wParam, LPARAM lParam)
   {
       
  -    if (message == ap_uiTaskbarCreated)
  +    if (message == g_bUiTaskbarCreated)
       {
           /* restore the tray icon on shell restart */
           ShowNotifyIcon(hWnd, NIM_ADD);
  @@ -1375,12 +1220,11 @@
       switch (message) 
       {
           case WM_CREATE:
  -            GetSystemOSVersion(NULL, &ap_OSVersion);
               GetApacheServicesStatus();
               ShowNotifyIcon(hWnd, NIM_ADD);
               SetTimer(hWnd, WM_TIMER_REFRESH, REFRESH_TIME, (TIMERPROC)MainTimerProc);
               SetTimer(hWnd, WM_TIMER_RESCAN,  RESCAN_TIME, (TIMERPROC)MainTimerProc);
  -            ap_hServiceDlg = NULL;                      
  +            g_hwndServiceDlg = NULL;                      
           break;
           case WM_QUIT:
               ShowNotifyIcon(hWnd, NIM_DELETE);
  @@ -1389,22 +1233,22 @@
               switch(lParam)
               {
                   case WM_LBUTTONDBLCLK:
  -                   if (!dlgServiceOn)
  +                   if (!g_bDlgServiceOn)
                      {
  -                       dlgServiceOn = TRUE;
  -                       DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_APSRVMON_DIALOG),
  +                       g_bDlgServiceOn = TRUE;
  +                       DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGSERVICES),
                                hWnd, (DLGPROC)ServiceDlgProc);
  -                       dlgServiceOn = FALSE;
  -                       ap_hServiceDlg = NULL;
  +                       g_bDlgServiceOn = FALSE;
  +                       g_hwndServiceDlg = NULL;
                      }
  -                   else if (ap_hServiceDlg)
  +                   else if (g_hwndServiceDlg)
                      {
                          /* Dirty hack to bring the window to the foreground */
  -                       SetWindowPos(ap_hServiceDlg, HWND_TOPMOST, 0, 0, 0, 0,
  +                       SetWindowPos(g_hwndServiceDlg, HWND_TOPMOST, 0, 0, 0, 0,
                                       SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
  -                       SetWindowPos(ap_hServiceDlg, HWND_NOTOPMOST, 0, 0, 0, 0,
  +                       SetWindowPos(g_hwndServiceDlg, HWND_NOTOPMOST, 0, 0, 0, 0,
                                       SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
  -                       SetFocus(ap_hServiceDlg);
  +                       SetFocus(g_hwndServiceDlg);
                      }
                   break;
                   case WM_RBUTTONUP:
  @@ -1416,34 +1260,21 @@
               switch (LOWORD(wParam))
               {
                  case IDM_RESTORE:
  -                   if (!dlgServiceOn)
  +                   if (!g_bDlgServiceOn)
                      {
  -                       dlgServiceOn = TRUE;
  -                       DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_APSRVMON_DIALOG),
  +                       g_bDlgServiceOn = TRUE;
  +                       DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGSERVICES),
                                hWnd, (DLGPROC)ServiceDlgProc);
  -                       dlgServiceOn = FALSE;
  -                       ap_hServiceDlg = NULL;
  +                       g_bDlgServiceOn = FALSE;
  +                       g_hwndServiceDlg = NULL;
                      }
  -                   else if (ap_hServiceDlg)
  -                       SetFocus(ap_hServiceDlg);
  +                   else if (g_hwndServiceDlg)
  +                       SetFocus(g_hwndServiceDlg);
                  break;
  -               case IDM_ABOUT:
  -                   if (!dlgAboutOn)
  -                   {
  -                      dlgAboutOn = TRUE;
  -                      DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX),
  -                             hWnd, (DLGPROC)AboutDlgProc);
  -                      dlgAboutOn = FALSE;
  -                      ap_hwndAboutDlg = NULL;                      
  -                   }
  -                   else if (ap_hwndAboutDlg)
  -                       SetFocus(ap_hwndAboutDlg);
  -                break;
  -                case IDM_EXIT:
  -                    ShowNotifyIcon(hWnd, NIM_DELETE);
  -                    PostQuitMessage(0);
  -                    return TRUE;
  -                break;
  +               case IDM_EXIT:
  +                   ShowNotifyIcon(hWnd, NIM_DELETE);
  +                   PostQuitMessage(0);
  +                   return TRUE;
               }
           default:
               return DefWindowProc(hWnd, message, wParam, lParam);
  @@ -1458,6 +1289,12 @@
       HWND       hWnd = NULL;
       WNDCLASSEX wcex;
   
  +    if (!GetSystemOSVersion(&g_dwOSVersion))
  +    {
  +        ErrorMessage(NULL, TRUE);
  +        return hWnd;
  +    }
  +
       wcex.cbSize = sizeof(WNDCLASSEX); 
   
       wcex.style          = CS_HREDRAW | CS_VREDRAW;
  @@ -1465,19 +1302,19 @@
       wcex.cbClsExtra     = 0;
       wcex.cbWndExtra     = 0;
       wcex.hInstance      = hInstance;
  -    wcex.hIcon          = LoadIcon(hInstance, (LPCTSTR)IDI_APSRVMON);
  -    wcex.hCursor        = ap_cArrow;
  +    wcex.hIcon          = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APSRVMON),
  +                                           IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
  +    wcex.hCursor        = g_hCursorArrow;
       wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  -    wcex.lpszMenuName   = (LPCSTR)IDC_APSRVMON;
  -    wcex.lpszClassName  = szWindowClass;
  -    wcex.hIconSm        = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_APSMALL);
  +    wcex.lpszMenuName   = 0;
  +    wcex.lpszClassName  = g_szWindowClass;
  +    wcex.hIconSm        = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APSRVMON),
  +                                           IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
   
       if (RegisterClassEx(&wcex))
  -    {
  -        hWnd = CreateWindow(szWindowClass, szTitle,
  +        hWnd = CreateWindow(g_szWindowClass, g_szTitle,
                                0, 0, 0, 0, 0,
                                NULL, NULL, hInstance, NULL);
  -    }
   
       return hWnd;
   
  @@ -1486,41 +1323,64 @@
   
   int WINAPI WinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
  -                    LPTSTR lpCmdLine,
  +                    LPSTR lpCmdLine,
                       int nCmdShow)
   {
       MSG     msg;
       /* single instance mutex */
  -    HANDLE hMutex = CreateMutex(NULL, FALSE, "APSRVMON_MUTEX");
  +    HANDLE hMutex;
  +    g_LangID = GetUserDefaultLangID();
  +    switch (g_LangID & 0xFF)
  +    {
  +        case LANG_ENGLISH:
  +            g_lpMsg = g_lpEnMessages;
  +            break;
  +        default:
  +            g_LangID = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
  +            g_lpMsg = g_lpEnMessages;
  +            break;
  +    }        
  +    hMutex = CreateMutex(NULL, FALSE, "APSRVMON_MUTEX");
       if((hMutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS))
       {
  +        ErrorMessage(g_lpMsg[AM_MSG_APPRUNNING], FALSE);
           if (hMutex)
               CloseHandle(hMutex);
   
           return 0;
       }
       InitCommonControls();
  -    ap_hInstance = hInstance;
  +    g_hInstance = hInstance;
   
  -    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  -    LoadString(hInstance, IDC_APSRVMON,  szWindowClass, MAX_LOADSTRING);
  -    ap_icoStop  = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICOSTOP));
  -    ap_icoRun   = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICORUN));
  -    ap_cHourglass = LoadCursor(NULL, IDC_WAIT);
  -    ap_cArrow     = LoadCursor(NULL, IDC_ARROW);
  -
  -    ZeroMemory(ap_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
  -    ap_hMainWnd = CreateMainWindow(hInstance);
  -    if (ap_hMainWnd != NULL)
  +    LoadString(hInstance, IDS_APMONITORTITLE, g_szTitle, MAX_LOADSTRING);
  +    LoadString(hInstance, IDS_APMONITORCLASS,  g_szWindowClass, MAX_LOADSTRING);
  +    g_icoStop          = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICOSTOP),
  +                                   IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  +    g_icoRun           = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICORUN),
  +                                   IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
  +    g_hCursorHourglass = LoadImage(NULL, MAKEINTRESOURCE(OCR_WAIT), IMAGE_CURSOR,
  +                                   LR_DEFAULTSIZE, LR_DEFAULTSIZE, LR_SHARED);
  +    g_hCursorArrow     = LoadImage(NULL, MAKEINTRESOURCE(OCR_NORMAL), IMAGE_CURSOR,
  +                                   LR_DEFAULTSIZE, LR_DEFAULTSIZE, LR_SHARED);
  +
  +    ZeroMemory(g_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
  +    g_hwndMain = CreateMainWindow(hInstance);
  +    InitializeCriticalSection(&g_stcSection);
  +    if (g_hwndMain != NULL)
       {
  -        ap_uiTaskbarCreated = RegisterWindowMessage("TaskbarCreated");
  +        g_bUiTaskbarCreated = RegisterWindowMessage("TaskbarCreated");
           while (GetMessage(&msg, NULL, 0, 0) == TRUE) 
           {
               TranslateMessage(&msg);
               DispatchMessage(&msg);
           }    
  -        ap_ClearServicesSt();
  +        am_ClearServicesSt();
       }
  +    DeleteCriticalSection(&g_stcSection);
       CloseHandle(hMutex);
  +    DestroyIcon(g_icoStop);
  +    DestroyIcon(g_icoRun);
  +    DestroyCursor(g_hCursorHourglass);
  +    DestroyCursor(g_hCursorArrow);
       return 0;
   }
  
  
  
  1.3       +18 -33    httpd-2.0/support/win32/ApacheMonitor.h
  
  Index: ApacheMonitor.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/win32/ApacheMonitor.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApacheMonitor.h	2001/08/07 19:54:10	1.2
  +++ ApacheMonitor.h	2001/08/14 19:30:21	1.3
  @@ -1,35 +1,20 @@
  -#define IDD_APSRVMON_DIALOG             101
  -#define IDD_ABOUTBOX                    102
  -#define IDS_APP_TITLE                   103
  +#define IDD_DLGSERVICES		            101
  +#define IDS_APMONITORTITLE              102
  +#define IDS_APMONITORCLASS              103
   #define IDM_RESTORE                     104
  -#define IDM_ABOUT                       105
  -#define IDM_EXIT                        106
  -#define IDI_APSRVMONM                   107
  -#define IDI_APSRVMON                    108
  -#define IDI_APSMALL                     109
  -#define IDC_APSRVMON                    110
  -#define IDS_VERSION_ERROR               111
  -#define IDS_VER_INFO_LANG               112
  -#define IDR_MAINFRAME                   128
  -#define IDI_ICOSTOP                     129
  -#define IDI_ICORUN                      130
  -#define IDC_STATBAR                     134
  -#define DLG_VERFIRST                    140
  -#define IDC_COMPANY                     140
  -#define IDC_FILEDESC                    141
  -#define IDC_PRODVER                     142
  -#define IDC_COPYRIGHT                   143
  -#define IDC_OSVERSION                   144
  -#define IDC_TRADEMARK                   145
  -#define DLG_VERLAST                     145
  -#define IDC_LABEL                       146
  -#define IDB_BMPSTOP                     155
  -#define IDB_BMPRUN                      156
  -#define IDB_BMPHEADER                   158
  -#define IDL_SERVICES                    1001
  -#define IDL_STDOUT                      1002
  -#define IDC_SSTART                      1003
  -#define IDC_SSTOP                       1004
  -#define IDC_SRESTART                    1005
  -#define IDC_SABOUT                      1006
  +#define IDM_EXIT                        105
  +#define IDI_APSRVMON                    106
  +#define IDI_ICOSTOP                     107
  +#define IDI_ICORUN                      108
  +#define IDC_STATBAR                     109
  +#define IDC_SSTATUS                     110
  +#define IDB_BMPSTOP                     111
  +#define IDB_BMPRUN                      112
  +#define IDB_BMPHEADER                   113
  +#define IDL_SERVICES                    114
  +#define IDL_STDOUT                      115
  +#define IDC_SSTART                      116
  +#define IDC_SSTOP                       117
  +#define IDC_SRESTART                    118
  +#define IDC_SEXIT                       119
   #define IDC_STATIC                      -1
  
  
  
  1.3       +13 -63    httpd-2.0/support/win32/ApacheMonitor.rc
  
  Index: ApacheMonitor.rc
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/win32/ApacheMonitor.rc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApacheMonitor.rc	2001/08/07 20:57:39	1.2
  +++ ApacheMonitor.rc	2001/08/14 19:30:21	1.3
  @@ -1,21 +1,14 @@
  -#include "ApacheMonitor.h"
  -#include "windows.h"
  -
  -IDI_APSRVMONM           ICON    DISCARDABLE     "ApacheMonitor.ico"
  -IDI_APSMALL             ICON    DISCARDABLE     "apsmall.ico"
  -IDI_APSRVMON            ICON    DISCARDABLE     "apsrvmon.ico"
  +#include "apachemonitor.h"
  +#include <windows.h>
  +IDI_APSRVMON            ICON    DISCARDABLE     "ApacheMonitor.ico"
   IDI_ICOSTOP             ICON    DISCARDABLE     "apstop.ico"
   IDI_ICORUN              ICON    DISCARDABLE     "aprun.ico"
   
   VS_VERSION_INFO VERSIONINFO
  - FILEVERSION 1,0,0,1
  - PRODUCTVERSION 1,0,0,1
  + FILEVERSION 1,0,1,1
  + PRODUCTVERSION 1,0,1,1
    FILEFLAGSMASK 0x3fL
  -#ifdef _DEBUG
  - FILEFLAGS 0x1L
  -#else
    FILEFLAGS 0x0L
  -#endif
    FILEOS 0x40004L
    FILETYPE 0x1L
    FILESUBTYPE 0x0L
  @@ -27,14 +20,14 @@
               VALUE "Comments", "Contributed by Mladen Turk <mt...@mappingsoft.com>\0"
               VALUE "CompanyName", "Apache Software Foundation.\0"
               VALUE "FileDescription", "Apache service monitor\0"
  -            VALUE "FileVersion", "1.0\0"
  +            VALUE "FileVersion", "1.1\0"
               VALUE "InternalName", "apsrvmon\0"
               VALUE "LegalCopyright", "Copyright � 2001 The Apache Software Foundation.\0"
               VALUE "LegalTrademarks", "This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation.  For more information on the Apache Software Foundation, please see <http://www.apache.org/>\0"
               VALUE "OriginalFilename", "apsrvmon.exe\0"
               VALUE "PrivateBuild", "\0"
               VALUE "ProductName", "Apache service monitor\0"
  -            VALUE "ProductVersion", "1.0\0"
  +            VALUE "ProductVersion", "1.1\0"
               VALUE "SpecialBuild", "\0"
           END
       END
  @@ -44,7 +37,7 @@
       END
   END
   
  -IDD_APSRVMON_DIALOG DIALOGEX 0, 0, 350, 174
  +IDD_DLGSERVICES DIALOGEX 0, 0, 350, 174
   STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_MINIMIZEBOX | WS_VISIBLE | 
       WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
   EXSTYLE WS_EX_CONTROLPARENT
  @@ -57,63 +50,20 @@
                       LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
       LISTBOX         IDL_STDOUT,2,124,285,37,LBS_NOINTEGRALHEIGHT | 
                       LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL
  -    LTEXT           "Service Status :",IDC_STATIC,3,40,51,8
  +    LTEXT           "Service Status :",IDC_SSTATUS,3,40,272,8
       PUSHBUTTON      "&Start",IDC_SSTART,298,75,50,14
       PUSHBUTTON      "S&top",IDC_SSTOP,298,91,50,14
       PUSHBUTTON      "&Restart",IDC_SRESTART,298,107,50,14
  -    PUSHBUTTON      "&About",IDC_SABOUT,298,147,50,14
  -    CONTROL         158,IDC_STATIC,"Static",SS_BITMAP,0,0,349,38
  -END
  -
  -IDD_ABOUTBOX DIALOG DISCARDABLE  50, 50, 214, 114
  -STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
  -CAPTION "About"
  -FONT 8, "MS Sans Serif"
  -BEGIN
  -    DEFPUSHBUTTON   "OK",IDOK,161,3,50,14,WS_GROUP
  -    ICON            IDI_APSRVMON,IDC_STATIC,3,3,20,20
  -    LTEXT           "CompanyName",IDC_COMPANY,30,3,125,8
  -    LTEXT           "FileDescription",IDC_FILEDESC,30,13,93,8
  -    LTEXT           "ProductVersion",IDC_PRODVER,123,13,33,8
  -    LTEXT           "LegalCopyright",IDC_COPYRIGHT,30,23,174,8
  -    LTEXT           "OSVERSION",IDC_OSVERSION,61,44,150,20
  -    LTEXT           "LegalTrademarks",IDC_TRADEMARK,3,69,210,40
  -    LTEXT           "Running on:",IDC_LABEL,3,44,50,11
  -    CONTROL         "",IDC_STATIC,"Static",SS_BLACKRECT,2,41,210,1
  -    CONTROL         "",IDC_STATIC,"Static",SS_BLACKRECT,2,65,210,1
  +    PUSHBUTTON      "&Exit",IDC_SEXIT,298,147,50,14
  +    CONTROL         113,IDC_STATIC,"Static",SS_BITMAP,0,0,349,38
   END
   
   IDB_BMPSTOP             BITMAP  DISCARDABLE     "sstop.bmp"
   IDB_BMPRUN              BITMAP  DISCARDABLE     "srun.bmp"
   IDB_BMPHEADER           BITMAP  DISCARDABLE     "apache_header.bmp"
   
  -IDC_APSRVMON MENU DISCARDABLE 
  -BEGIN
  -    POPUP "&File"
  -    BEGIN
  -        MENUITEM "&Restore",                    IDM_RESTORE
  -        MENUITEM "E&xit",                       IDM_EXIT
  -    END
  -    POPUP "&Help"
  -    BEGIN
  -        MENUITEM "&About ...",                  IDM_ABOUT
  -    END
  -END
  -
  -IDC_APSRVMON ACCELERATORS MOVEABLE PURE 
  -BEGIN
  -    "?",            IDM_ABOUT,              ASCII,  ALT
  -    "/",            IDM_ABOUT,              ASCII,  ALT
  -END
  -
  -STRINGTABLE DISCARDABLE 
  -BEGIN
  -    IDS_APP_TITLE           "Apache service monitor"
  -    IDC_APSRVMON            "ApacheServiceMonitorClass"
  -    IDS_VERSION_ERROR       "Error %lu"
  -END
  -
   STRINGTABLE DISCARDABLE 
   BEGIN
  -    IDS_VER_INFO_LANG       "\\StringFileInfo\\000004B0\\"
  +    IDS_APMONITORTITLE      "Apache service monitor"
  +    IDS_APMONITORCLASS      "ApacheServiceMonitorClass"
   END