--- ApacheMonitor.c.old	Wed Aug  8 09:07:52 2001
+++ ApacheMonitor.c	Thu Aug  9 11:56:26 2001
@@ -106,14 +106,12 @@
 
 /* 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];
@@ -181,10 +179,6 @@
 {
     OSVERSIONINFOEX osvi;
     BOOL    bOsVersionInfoEx;
-    char    szBuff[256];
-    HKEY    hKey;
-    char    szProductType[80];
-    DWORD   dwBufLen;
     
     /* 
     Try calling GetVersionEx using the OSVERSIONINFOEX structure.
@@ -205,72 +199,6 @@
     {
     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)
@@ -278,40 +206,13 @@
             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;
     default:
@@ -388,7 +289,6 @@
 
     if (hMenu)
     {
-        appendMenuItem(hMenu,  IDM_ABOUT, "&About...", FALSE);
         appendMenuItem(hMenu,  IDM_RESTORE, "&Show Services...", TRUE);
         appendMenuItem(hMenu,  0, "", FALSE);
         appendMenuItem(hMenu,  IDM_EXIT,  "&Exit...", FALSE);
@@ -875,7 +775,6 @@
     CHAR    achKey[MAX_PATH];
     CHAR    szImagePath[MAX_PATH];
     CHAR    szBuf[MAX_PATH];
-
     HKEY    hKey, hSubKey;
     DWORD   retCode, rv, dwKeyType;
     DWORD   dwBufLen = MAX_PATH;
@@ -912,7 +811,9 @@
                 {
                     lstrcpy(szBuf, szImagePath);
                     CharLower(szBuf);
-                    if (strstr(szBuf, "\\apache.exe") != NULL)
+                    
+                    if (strstr(szBuf, "\\apache") != NULL && strstr(szBuf, ".exe") != NULL &&
+                       (strstr(szBuf, "--ntservice") != NULL || strstr(szBuf, "-k runservice") != NULL))
                     {
                         ap_stServices[stPos].szServiceName = strdup(achKey);
                         ap_stServices[stPos].szImagePath = strdup(szImagePath);
@@ -939,117 +840,6 @@
     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)
 {
 
@@ -1281,19 +1071,6 @@
                     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);
-                    return TRUE;
-                break;
              }
         break;
         case WM_SIZE:
@@ -1427,18 +1204,6 @@
                    else if (ap_hServiceDlg)
                        SetFocus(ap_hServiceDlg);
                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);
