Re: SVCOM - anyone know how to pass a command-line parameter?




"Arthur Hoornweg" <antispam.hoornweg@xxxxxxxxxxxxx> wrote in message
news:474d6845$1@xxxxxxxxxxxxxxxxxxxxxxxxx

I need to pass a command-line parameter to one of my
services when it starts but I can't find how.

There are only three ways I know for a service to receive startup
parameters:

1) when starting the service inside the SCM's UI, go into the service's
Properties dialog and use the "Start parameters" field. This is on a
per-start basis, though, as the dialog does not remember the parameters from
one start to the next.

2) when starting the service from code, the StartService() function has
dwNumServiceArgs and lpServiceArgVectors parameters.

#1 and #2 both pass the parameters to the service's ServiceMain()
callback, which I assume SvCom then exposes in its Params() property
(Borland's TService does).

3) in the Registry key for the service, you can add command-line parameters
to the "ImagePath" value (for example, Microsoft's "Alerter" service does
this).

To retreive these parameters, you need to access the process's
command-line via the Win32 API GetCommandLine() function or the VCL's
ParamStr() function. This is not the same thing as using service startup
parameters above.

4) in the Registry, add a "Parameters" subkey to the service's key (or store
the values anywhere else you want) and then have the service read the values
manually when needed.


Gambit


.



Relevant Pages

  • Re: Virus causing System32 folder to be opened at startup?
    ... If you have any Microsoft Office programs, ... Turn Off the Speech Recognition and Handwriting Recognition Features ... I ran msconfig but did not see anything unexpected under Startup ... but now the ctfmon.exe registry key is gone and the msconfig Startup ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: Virus causing System32 folder to be opened at startup?
    ... I know the date the trojan was put on my computer as I run multiple security ... I ran msconfig but did not see anything unexpected under Startup ... Once I did this it disappeared from the msconfig Startup screen as expected. ... but now the ctfmon.exe registry key is gone and the msconfig Startup ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: Virus causing System32 folder to be opened at startup?
    ... Some malware will come with their own backups to recreate it after it has ... I ran msconfig but did not see anything unexpected under Startup ... Once I did this it disappeared from the msconfig Startup screen as expected. ... but now the ctfmon.exe registry key is gone and the msconfig Startup ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: msconfig Startup Files Need File ID Help
    ... If this bug has only the one executable file and one registry key and ... need a tool to get rid of it. ... > list.I had to use the startup Items file on Spybot Search ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Access 2003 and unsafe macros
    ... No such registry key ... > That sounds more like a database corruption problem, ... > form's name is correct in the startup property, ...
    (microsoft.public.access.security)