Exemplo n.º 1
0
 private static extern bool ChangeServiceConfigW(
     ServiceHandle service,
     ServiceType serviceType,
     ServiceStartType startType,
     ErrorSeverity errorSeverity,
     string binaryPath,
     string loadOrderGroup,
     IntPtr outUIntTagId,
     string dependencies,
     string serviceUserName,
     string servicePassword,
     string displayName);
Exemplo n.º 2
0
 private static extern bool ChangeServiceConfig2W(ServiceHandle service, ServiceConfigInfoTypeLevel infoTypeLevel, IntPtr info);
Exemplo n.º 3
0
 private static extern bool DeleteService(ServiceHandle service);
Exemplo n.º 4
0
 private static extern bool StartServiceW(ServiceHandle service, uint argc, IntPtr wargv);
Exemplo n.º 5
0
 bool INativeInterop.ChangeServiceConfig2W(ServiceHandle service, ServiceConfigInfoTypeLevel infoTypeLevel, IntPtr info)
 {
     return(ChangeServiceConfig2W(service, infoTypeLevel, info));
 }
Exemplo n.º 6
0
 bool INativeInterop.DeleteService(ServiceHandle service)
 {
     return(DeleteService(service));
 }
Exemplo n.º 7
0
 bool INativeInterop.StartServiceW(ServiceHandle service, uint argc, IntPtr wargv)
 {
     return(StartServiceW(service, argc, wargv));
 }
Exemplo n.º 8
0
 bool INativeInterop.ChangeServiceConfigW(ServiceHandle service, ServiceType serviceType, ServiceStartType startType, ErrorSeverity errorSeverity, string binaryPath, string loadOrderGroup, IntPtr outUIntTagId, string dependencies, string serviceUserName, string servicePassword, string displayName)
 {
     return(ChangeServiceConfigW(service, serviceType, startType, errorSeverity, binaryPath, loadOrderGroup, outUIntTagId, dependencies, serviceUserName, servicePassword, displayName));
 }
Exemplo n.º 9
0
 private static void DoUpdateService(string displayName, string description, string binaryPath, Win32ServiceCredentials credentials, bool autoStart, ErrorSeverity errorSeverity, ServiceHandle existingService)
 {
     existingService.ChangeConfig(displayName, binaryPath, ServiceType.Win32OwnProcess,
                                  autoStart ? ServiceStartType.AutoStart : ServiceStartType.StartOnDemand, errorSeverity, credentials);
     existingService.SetDescription(description);
     existingService.Start(throwIfAlreadyRunning: false);
 }
Exemplo n.º 10
0
        public virtual bool TryOpenService(string serviceName, ServiceControlAccessRights desiredControlAccess, out ServiceHandle serviceHandle, out Win32Exception errorException)
        {
            var service = NativeInterop.OpenServiceW(this, serviceName, desiredControlAccess);

            service.NativeInterop = NativeInterop;

            if (service.IsInvalid)
            {
                errorException = new Win32Exception(Marshal.GetLastWin32Error());
                serviceHandle  = null;
                return(false);
            }

            serviceHandle  = service;
            errorException = null;
            return(true);
        }