I have a service which takes a few parameters on the image path.
eg:
ImagePath = "C:\Program Files (x86)\SomeApp\ServiceApp.exe -arg1=123 -arg2=234"
Is it possible to store non-standard values for a service via any particular function?
I would like to store -arg1=123
and -arg2=234
as values for the service.
I know services are described by keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services
, but I don't know if adding values directly to the registry key is a good idea (not sure if it would affect loading services into the service database), or if there is another way.
Example key I would want to store:
Name: arg1
Type: REG_SZ
Data: arg1=123
I'm not even sure if storing values like this is best practice, but we have a need to separately store command line parameters provided on the image path.
I have a handle to SCManager
and installation/deleting a service is fine, as is setting the description via ChangeServiceConfig2, but I would like to store a couple of other values if possible without manually modifying the registry.