Talk:Services plug-in

From NSIS Wiki
Jump to navigationJump to search

Function Level Docs : [ extracted from the source ]


GetServiceNameFromDisplayName:

 DESC: Find the internal service name of all services whose display name (as
 DESC: seen in the Services Control Panel) contains the given name or name
 DESC: fragment (case insensitive match).
 ARGS: Push the display name or display name fragment onto the stack
 RETN: One or more values on the stack.
 RETN:   The first will be the count of matches found.
 RETN:   The second will be the reason for finding no matches, OR the first match.
 RETN:   The third and so on will be the remaining matches upto the count.
 USGE: See the FindServices.nsi example.

IsProcessUserAdministrator:

 DESC: Find out if the user (the owner of the current process) is a member of
 DESC: the administrators group on the local computer (not on the domain!).
 ARGS: Push the service name onto the stack.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Yes' or 'No' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::IsProcessUserAdministrator
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

HasLogonAsAService:

 DESC: Find out if the current user (the owner of the process) has the LSA
 DESC: (Local Security Authority) policy right 'SeServiceLogonRight'.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Yes' or 'No' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::HasLogonAsAService '3B2\Ximon_Eighteen'
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

GrantLogonAsAService:

 DESC: Grant the current user (the owner of the process) the LSA
 DESC: (Local Security Authority) policy right 'SeServiceLogonRight'.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Ok' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::GrantLogonAsAService '3B2\Ximon_Eighteen'
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

RemoveLogonAsAService:

 DESC: Deny the current user (the owner of the process) the LSA
 DESC: (Local Security Authority) policy right 'SeServiceLogonRight'.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Ok' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::RemoveLogonAsAService '3B2\Ximon_Eighteen'
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

IsServiceInstalled:

 DESC: Find out if the named service is installed.
 ARGS: Push the service name onto the stack.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Yes' or 'No' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::IsServiceInstalled 'MyServiceName'
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

IsServiceRunning

 DESC: Find out if the named service is installed and running.
 ARGS: Push the service name onto the stack.
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Yes' or 'No' if there were no problems, otherwise
 RETN: the reason for the failure will be in the result string.
 USGE: Use it like this :-
 USGE:
 USGE:   services::IsServiceRunning 'MyServiceName'
 USGE:   Pop $0
 USGE:   ; $0 now contains either 'Yes', 'No' or an error description

SendServiceCommand:

 DESC: Send a command (Start, Stop, Pause, Continue or Delete) to the Service
 DESC: Control Manager (SCM) for a given service.
 ARGS: Push service command string onto the stack
 ARGS: Push service name string onto the stack
 RETN: Pop the result string from the stack.
 RETN: The result will be 'Ok' if there were no problems, or the reason for
 RETN: failure otherwise.
 USGE: Use it like this :-
 USGE:
 USGE:   services::SendServiceCommand 'start' 'MyServiceName'
 USGE:   Pop $0
 USGE:   StrCmp $0 'Ok' success 0
 USGE:     MessageBox MB_OK|MB_ICONSTOP 'Failed to send service command: Reason: $0' 0 0
 USGE:     Abort
 USGE:   success:

Mjog upplysandi

lart mikid