The code has been taken from here This code example works fine my side its just add a service own local system) But I prepare Setup program I must think StartMode and User Account Type method because of customers system.
so How can I set Account Type and StartType method when I gonna add windows service.
there is every appearance that ServiceBootFlag enum provide StartType but Account Type still a problem. Or I'm open different idiom for set mentioned method for adding a windows service programmatically
And I read this question all post and comments I didn't see anything for set Startmode and User Account Type method When add a windows service.
[DllImport("advapi32.dll", EntryPoint = "CreateServiceA")]
private static extern IntPtr CreateService(IntPtr hSCManager, string
lpServiceName, string lpDisplayName, ServiceRights dwDesiredAccess, int
dwServiceType, ServiceBootFlag dwStartType, ServiceError dwErrorControl,
string lpBinaryPathName, string lpLoadOrderGroup, IntPtr lpdwTagId, string
lpDependencies, string lp, string lpPassword);