View Single Post
Old 31st May 2017, 15:01   #131
dothebart
Junior Member
 
Join Date: May 2017
Posts: 6
GetServiceFailure / GetServiceFailureFlag returning 0?

I've been trying to add error handling to my installer; Service registering, adding a description, naming and starting works really well.

I'm producing a case where my service will abort its start, set dwWin32ExitCode to ERROR_SERVICE_SPECIFIC_ERROR, dwServiceSpecificExitCode to 1 and report that back. In that case the regular startup invocation via SimpleSC:

code:

SimpleSC::StartService 'ARANGODB' '' 40
Pop $0
DetailPrint "Status: $0"



Will timeout, and then print out the statuscode 1053 others saw in this Forum too.

Revalidating with sc shows the popper SERVICE_EXIT_CODE 1 :
code:

sc query "ArangoDB"

SERVICE_NAME: ArangoDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1066 (0x42a)
SERVICE_EXIT_CODE : 1 (0x1)
CHECKPOINT : 0x0
WAIT_HINT : 0x0



However, trying to invoke these calls as cut'n'pasted from the wiki:
code:

SimpleSC::ServiceIsRunning 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
DetailPrint "ServiceIsRunning 0: $0 1: $1 ${TRI_SVC_NAME}"

SimpleSC::GetServiceFailureFlag 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns the service flag
DetailPrint "GetServiceFailureFlag 0: $0 1: $1"


SimpleSC::GetServiceFailure 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns the reset period
Pop $2 ; returns the reboot message
Pop $3 ; returns the command
Pop $4 ; returns the first action (See "action_type_x" in the parameters)
Pop $5 ; returns the first action delay
Pop $6 ; returns the second action (See "action_type_x" in the parameters)
Pop $7 ; returns the second action delay
Pop $8 ; returns the third action (See "action_type_x" in the parameters)
Pop $9 ; returns the third action delay
DetailPrint "GetServiceFailure 0: $0 1: $1 2: $2 3: $3 4: $4 5: $5 6: $6 7: $7 8: $8 9: $9"



will only print 0's for all variables.

I've tried not setting the ServiceDescription, not setting the Friendly name, switching the all ASCII servicename from camelcase to uppercase, lowercase... No success...

I'm using NSIS 3.02 via cmake and VS 2015 to compile the service; The Host is a Windows Server 2016; the Installer asks for privileges, which seem to be enough to de/register start/stop the service. Any ideas what else I could try?
dothebart is offline   Reply With Quote