detect all Windows service states

This commit is contained in:
idk
2022-09-19 02:40:52 -04:00
parent 0216bc7254
commit c226103bc7
2 changed files with 28 additions and 19 deletions

View File

@ -61,7 +61,7 @@ public class WindowsServiceUtil {
if (indexOfState >= 0) {
int indexOfColon = qResult.indexOf(":", indexOfState);
statePrefix = "STATE";
for (int f = indexOfState+5; f < indexOfColon; f++) {
for (int f = indexOfState + 5; f < indexOfColon; f++) {
statePrefix += " ";
}
statePrefix += ": ";
@ -94,12 +94,21 @@ public class WindowsServiceUtil {
case (2): // service starting
stateString = "starting";
break;
case (3): // don't know yet
// stateString = "started";
case (3): // service stopping
stateString = "stopping";
break;
case (4): // service started
stateString = "started";
break;
case (5): // service resuming from pause
stateString = "resuming";
break;
case (6): // service pausing
stateString = "pausing";
break;
case (7): // service paused
stateString = "paused";
break;
}
return stateString;
}