Example #1
0
        private ServiceControlHandle CreateService(ServiceControlHandle managerHandle)
        {
            var startType = GetStartType();

            return(NativeMethods.CreateService(managerHandle, ServiceName, DisplayName,
                                               NativeMethods.SERVICE_ACCESS.SERVICE_ALL_ACCESS,
                                               NativeMethods.SERVICE_TYPES.SERVICE_WIN32_OWN_PROCESS,
                                               startType,
                                               NativeMethods.SERVICE_ERROR_CONTROL.SERVICE_ERROR_NORMAL,
                                               PathName,
                                               null, IntPtr.Zero, null, null, null));
        }
Example #2
0
 public static extern ServiceControlHandle CreateService(
     ServiceControlHandle serviceControlManagerHandle,
     string lpSvcName,
     string lpDisplayName,
     SERVICE_ACCESS dwDesiredAccess,
     SERVICE_TYPES dwServiceType,
     SERVICE_START_TYPES dwStartType,
     SERVICE_ERROR_CONTROL dwErrorControl,
     string lpPathName,
     string lpLoadOrderGroup,
     IntPtr lpdwTagId,
     string lpDependencies,
     string lpServiceStartName,
     string lpPassword);
Example #3
0
 public static extern int DeleteService(ServiceControlHandle serviceHandle);
Example #4
0
 public static extern ServiceControlHandle OpenService(ServiceControlHandle serviceControlManagerHandle, string lpSvcName, SERVICE_ACCESS dwDesiredAccess);
Example #5
0
 public static extern int StartService(ServiceControlHandle serviceHandle, int dwNumServiceArgs, string lpServiceArgVectors);