My knowledge about Windows Services is a bit amateurish. With that being said, do I need to add anything to these macros? I'm asking because I'm going to be using this little library in an open source project I'm working on that will be using these macros heavily. Here's the macros I've written for use with the ServiceLib.nsh include file:
;= ${ServiceLib::Create}
!define ServiceLib::Create `!insertmacro _ServiceLib::Create`
!macro _ServiceLib::Create _RETURN _NAME _PATH _TYPE _START _DEPEND
Push
Push "start"
Push "${_NAME}"
StrCmp "${_DEPEND}" "" 0 +3
Push "path=${_PATH};servicetype=${_TYPE};starttype=${_START};"
Goto +2
Push "path=${_PATH};servicetype=${_TYPE};starttype=${_START};depend=${_DEPEND};"
Call Service
Pop ${_RETURN}
!macroend
;= ${ServiceLib::Start}
!define ServiceLib::Start `!insertmacro _ServiceLib::Start`
!macro _ServiceLib::Start _RETURN _NAME
Push
Push "start"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns true/false
!macroend
;= ${ServiceLib::Remove}
!define ServiceLib::Remove `!insertmacro _ServiceLib::Remove`
!macro _ServiceLib::Remove _RETURN _NAME
Push
Push "delete"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns true/false
!macroend
;= ${ServiceLib::Stop}
!define ServiceLib::Stop `!insertmacro _ServiceLib::Stop`
!macro _ServiceLib::Stop _RETURN _NAME
Push
Push "stop"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns true/false
!macroend
;= ${ServiceLib::Pause}
!define ServiceLib::Pause `!insertmacro _ServiceLib::Pause`
!macro _ServiceLib::Pause _RETURN _NAME
Push
Push "pause"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns true/false
!macroend
;= ${ServiceLib::Continue}
!define ServiceLib::Continue `!insertmacro _ServiceLib::Continue`
!macro _ServiceLib::Continue _RETURN _NAME
Push
Push "continue"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns true/false
!macroend
;= ${ServiceLib::Status}
!define ServiceLib::Status `!insertmacro _ServiceLib::Status`
!macro _ServiceLib::Status _RETURN _NAME
Push
Push "status"
Push "${_NAME}"
Push ""
Call Service
Pop ${_RETURN} ;= Returns stopped/running/start_pending/stop_pending/continue_pending/pause_pending/pause/unknown
!macroend Also, I'd like to ask about working with dependencies. When I use my ${ServiceLib::Create} macro, how would I add dependencies? I know you're supposed to end the parameter with a semicolon (;) but there isn't anything specifing how to separate values if there are multiple dependencies needed. What's the delimiter to use to add more than just one? Is it a simple comma (,) to separate each value?Thanks in advance! =)
Kind Regards,
demon.devin