cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jchristman
Pilgrim

InstallScript Service params

I am currently using ServiceAddService to add a service but I would like to set the username and password to run the service and the recovery options to restart. I know this can be done with SERVICE_IS_PARAMS but cannot find examples of how it works or works with the ServiceAddService. Could someone show me a couple of examples of this.
Labels (1)
0 Kudos
5 Replies
Highlighted
jchristman
Pilgrim

Re: InstallScript Service params

Currently this is what I have, but it will not compile saying numeric value required. even though what I have seen shows passing in the string values.


STRING szServiceUser, szServicePass;

ServiceInitParams ();
SERVICE_IS_PARAMS.dwServiceType = SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.lpServiceStartName = szServiceUser;
SERVICE_IS_PARAMS.lpPassword = szServicePass;
ServiceAddService (szServiceName,szServiceName,szServiceName,MyService1,'');



The service I am adding in not a .Net service so it will not automatically prompt for username and password, is there a way to force this or am I on the right path.
0 Kudos
Highlighted
jchristman
Pilgrim

Re: InstallScript Service params

It appears that when I use the SERVICE_IS_PARAMS like above it does not install my service now or unintall it. Any suggestions on how I can get this to install the service with a user name and password
0 Kudos
Highlighted
RobertDickau
Pilgrim

Re: InstallScript Service params

Which line or lines give you the compiler errors? For the string fields, perhaps try:

SERVICE_IS_PARAMS.lpServiceStartName = &szServiceUser; // pointer to user name string
Highlighted
jchristman
Pilgrim

Re: InstallScript Service params

I believe I see what I was doing wrong I was not doing this as a pointer &szServiceUser. I am trying this now. Thanks.
0 Kudos
Highlighted
SimonG
Occasional contributor

Re: InstallScript Service params

This was a very helpful post, thanks.

Could I ask that this kind of information is added to the online help (if it hasn't been already) so developers know how to use these parameters. Examples are always the most useful part of online help.

0 Kudos