Install service with delphi?

10,181

The proper way to install a service from code is to call the Service Control Manager (SCM) API. The /install parameter supplied by Delphi service does a "standard" call to the SCM that usually is not the best one for most services. Today, very few services, for example, should run with LocalSystem privileges because it's too powerful.

Share:
10,181
Bjarke Moholt
Author by

Bjarke Moholt

Education: Master of Science Technical IT Employment: Software developer at a research group of Aarhus University, Denmark, developing analysis tools and interfaces for geophysics and hydrology

Updated on June 04, 2022

Comments

  • Bjarke Moholt
    Bjarke Moholt almost 2 years

    I want a small executable to install my service with the usual

    path\servicename /install
    

    I've tried running a simple shellexecute in a program with elevated rights,

    ShellExecute(0, nil, 'cmd.exe','/C servicepath\servicename.exe /install', nil, SW_HIDE);
    

    but the service doesn't install. I am not exactly a wiz with ShellEx so I suspect I have gotten it wrong; kindly show me the errors of my ways and possibly supply the correct shellexecute line