Recent

Author Topic: Windows Daemon with params  (Read 3120 times)

Beppeoioi

  • Newbie
  • Posts: 2
Windows Daemon with params
« on: August 27, 2018, 09:36:35 am »
Good morning to all of you
it's the first time I write in this forum, if I'm wrong I beg you to forgive me.
I'm writing a service for Windows using a TDaemon.
I would like to be able to perform the service installation by specifying a file path ( or two) as a parameter.
How can I do ?
I tried to look for documentation, but I did not find anything.
Sorry if my English is not perfect.
Thank you all

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Windows Daemon with params
« Reply #1 on: August 27, 2018, 09:52:24 am »
Hello Beppeoioi,
Welcome to the forum.

I don' know much about daemons and services but I found these info, which I think may be useful for you:

http://wiki.lazarus.freepascal.org/ServiceManager
http://wiki.freepascal.org/Daemons_and_Services
https://www.freepascal.org/docs-html/fcl/daemonapp/tdaemondef.html

Beppeoioi

  • Newbie
  • Posts: 2
Re: Windows Daemon with params
« Reply #2 on: August 27, 2018, 10:03:27 am »
Hi Handoko,
thanks for the reply.
I have already read the links you have posted to me but I have not found answers to my question.
I created a watchdog service.
He monitors the presence of a process in memory and when he does not find it, he launches the executable.
I manually entered the path of the executable in the code, but I would like to be able to indicate which process to monitor through a parameter to the installation of the service.
Is there anyone who has any ideas?
Thanks again

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: Windows Daemon with params
« Reply #3 on: August 27, 2018, 08:20:20 pm »
...
I manually entered the path of the executable in the code, but I would like to be able to indicate which process to monitor through a parameter to the installation of the service.
Is there anyone who has any ideas?
StartService has lpServiceArgVectors parameter. You can pass params through "sc start MyService Param1 Param2", or "net start MyService /Param1 /Param2" or through GUI "Start parameters" box.

 

TinyPortal © 2005-2018