mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-22 11:13:21 +00:00
Added 'exstate' parameter that returns the windows service manager service state as the status code
This commit is contained in:
@@ -598,6 +598,12 @@ int wmain(int argc, char* wargv[])
|
|||||||
integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1);
|
integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1);
|
||||||
integragedJavaScriptLen = (int)sizeof(script) - 1;
|
integragedJavaScriptLen = (int)sizeof(script) - 1;
|
||||||
}
|
}
|
||||||
|
if (argc > 1 && (strcasecmp(argv[1], "exstate") == 0))
|
||||||
|
{
|
||||||
|
char script[] = "var r={rawState: -1, state: 'NOT INSTALLED'};try{r=require('service-manager').manager.getService(require('_agentNodeId').serviceName()).status;}catch(z){};console.log(r.state);process.exit(r.rawState);";
|
||||||
|
integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1);
|
||||||
|
integragedJavaScriptLen = (int)sizeof(script) - 1;
|
||||||
|
}
|
||||||
if (argc > 1 && (strcasecmp(argv[1], "state") == 0))
|
if (argc > 1 && (strcasecmp(argv[1], "state") == 0))
|
||||||
{
|
{
|
||||||
char script[] = "try{console.log(require('service-manager').manager.getService(require('_agentNodeId').serviceName()).status.state);}catch(z){console.log('NOT INSTALLED');};process.exit();";
|
char script[] = "try{console.log(require('service-manager').manager.getService(require('_agentNodeId').serviceName()).status.state);}catch(z){console.log('NOT INSTALLED');};process.exit();";
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -80,7 +80,8 @@ function parseServiceStatus(token)
|
|||||||
j.isOwnProcess = ((serviceType & 0x00000010) == 0x00000010);
|
j.isOwnProcess = ((serviceType & 0x00000010) == 0x00000010);
|
||||||
j.isInteractive = ((serviceType & 0x00000100) == 0x00000100);
|
j.isInteractive = ((serviceType & 0x00000100) == 0x00000100);
|
||||||
j.waitHint = token.Deref((6 * 4), 4).toBuffer().readUInt32LE();
|
j.waitHint = token.Deref((6 * 4), 4).toBuffer().readUInt32LE();
|
||||||
switch (token.Deref((1 * 4), 4).toBuffer().readUInt32LE())
|
j.rawState = token.Deref((1 * 4), 4).toBuffer().readUInt32LE();
|
||||||
|
switch (j.rawState)
|
||||||
{
|
{
|
||||||
case 0x00000005:
|
case 0x00000005:
|
||||||
j.state = 'CONTINUE_PENDING';
|
j.state = 'CONTINUE_PENDING';
|
||||||
|
|||||||
Reference in New Issue
Block a user