--- ApacheMonitor.c.old	Fri Aug 17 07:26:02 2001
+++ ApacheMonitor.c	Fri Aug 17 08:46:02 2001
@@ -583,27 +583,33 @@
     if (g_dwOSVersion == OS_VERSION_WIN9X)
     {
         sPos = strstr(szImagePath, "-k start");
+        if (!sPos) 
+            sPos = strstr(szImagePath, "-k runservice");
         if (sPos)
         {
             lstrcpyn(szBuf, szImagePath, sPos - szImagePath);
             switch (dwCommand)
             {
             case SERVICE_CONTROL_STOP:
-                lstrcat(szBuf, " -k stop -n ");
+                lstrcat(szBuf, " -k stop");
                 break;
             case SERVICE_CONTROL_CONTINUE:
                 sprintf(szMsg, g_lpMsg[IDS_MSG_SRVSTART-IDS_MSG_FIRST], szServiceName);
                 addListBoxString(g_hwndStdoutList, szMsg);
-                lstrcat(szBuf, " -k start -n ");
+                lstrcpy(szBuf, szImagePath);
                 serviceFlag = FALSE;
                 break;
             case SERVICE_APACHE_RESTART:
-                lstrcat(szBuf, " -k restart -n ");
+                lstrcat(szBuf, " -k restart");
                 break;
             default:
                 return FALSE;
             }
-            lstrcat(szBuf, szServiceName);
+            if (!strstr(szBuf, " -n "))
+            {
+                lstrcat(szBuf, " -n ");
+                lstrcat(szBuf, szServiceName);
+            }
         }
         else
             return FALSE;
@@ -845,14 +851,20 @@
 
     HKEY    hKey, hSubKey;
     DWORD   retCode, rv, dwKeyType;
-    DWORD   dwBufLen = MAX_PATH;
+    DWORD   dwBufLen = MAX_PATH, dwKeyLen = MAX_PATH;
     int     i, stPos = 0;
 
     g_bRescanServices = FALSE;
 
-    retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                            "System\\CurrentControlSet\\Services\\",
-                            0, KEY_READ, &hKey);
+    if (g_dwOSVersion >= OS_VERSION_WINNT)
+        retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                              "System\\CurrentControlSet\\Services\\",
+                              0, KEY_READ, &hKey);
+    else
+        retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                              "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices\\",
+                              0, KEY_READ, &hKey);
+
     if (retCode != ERROR_SUCCESS)
     {
         ErrorMessage(NULL, FALSE);
@@ -861,20 +873,24 @@
     am_ClearServicesSt();
     for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++)
     {
-
-        retCode = RegEnumKey(hKey, i, achKey, MAX_PATH);
-        if (retCode == ERROR_SUCCESS)
+        dwBufLen = MAX_PATH;
+        dwKeyLen = MAX_PATH;
+        dwKeyType = REG_SZ;
+        if (g_dwOSVersion >= OS_VERSION_WINNT)
+            retCode = RegEnumKey(hKey, i, achKey, MAX_PATH);
+        else
+            retCode = RegEnumValue(hKey, i, achKey, &dwKeyLen, NULL, &dwKeyType, szImagePath, &dwBufLen);
+        if (retCode == ERROR_SUCCESS && (dwKeyType == REG_SZ  || dwKeyType == REG_EXPAND_SZ))
         {
             lstrcpy(szKey, "System\\CurrentControlSet\\Services\\");
             lstrcat(szKey, achKey);
-
-            if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, 
-                KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS)
+            if ((rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, 
+                KEY_QUERY_VALUE, &hSubKey)) == ERROR_SUCCESS)
             {
                 dwBufLen = MAX_PATH;
-                rv = RegQueryValueEx(hSubKey, "ImagePath", NULL,
-                                      &dwKeyType, szImagePath, &dwBufLen);
-
+                if (g_dwOSVersion >= OS_VERSION_WINNT)
+                    rv = RegQueryValueEx(hSubKey, "ImagePath", NULL,
+                                        &dwKeyType, szImagePath, &dwBufLen);
                 if (rv == ERROR_SUCCESS && (dwKeyType == REG_SZ  || dwKeyType == REG_EXPAND_SZ) && dwBufLen)
                 {
                     lstrcpy(szBuf, szImagePath);
