Example #1
0
 public static void Run(DecompiledServiceBase service)
 {
     if (service == null)
     {
         throw new ArgumentException(Res.GetString("NoServices"));
     }
     Run(new DecompiledServiceBase[] { service });
 }
Example #2
0
 static void Main(string[] args)
 {
     DecompiledServiceBase[] ServicesToRun = new DecompiledServiceBase[]
     {
         new BotBugService()
     };
     DecompiledServiceBase.Run(ServicesToRun);
 }
Example #3
0
 static void Main(string[] args)
 {
     DecompiledServiceBase[] ServicesToRun = new DecompiledServiceBase[]
         {
         new BotBugService()
         };
     DecompiledServiceBase.Run(ServicesToRun);
 }
 public static void Run(DecompiledServiceBase service)
 {
     if (service == null)
         {
         throw new ArgumentException(Res.GetString("NoServices"));
         }
     Run(new DecompiledServiceBase[] { service });
 }
 public static void Run(DecompiledServiceBase[] services)
 {
     if ((services == null) || (services.Length == 0))
         {
         throw new ArgumentException(Res.GetString("NoServices"));
         }
     if (Environment.OSVersion.Platform != PlatformID.Win32NT)
         {
         string message = Res.GetString("CantRunOnWin9x");
         string title = Res.GetString("CantRunOnWin9xTitle");
         LateBoundMessageBoxShow(message, title);
         }
     else
         {
         IntPtr entry = Marshal.AllocHGlobal((IntPtr)((services.Length + 1) * Marshal.SizeOf(typeof(WIN32.SERVICE_TABLE_ENTRY))));
         WIN32.SERVICE_TABLE_ENTRY[] service_table_entryArray = new WIN32.SERVICE_TABLE_ENTRY[services.Length];
         bool multipleServices = services.Length > 1;
         IntPtr zero = IntPtr.Zero;
         for (int i = 0; i < services.Length; i++)
             {
             services[i].Initialize(multipleServices);
             service_table_entryArray[i] = services[i].GetEntry();
             zero = (IntPtr)(((long)entry) + (Marshal.SizeOf(typeof(WIN32.SERVICE_TABLE_ENTRY)) * i));
             Marshal.StructureToPtr(service_table_entryArray[i], zero, true);
             }
         WIN32.SERVICE_TABLE_ENTRY structure = new WIN32.SERVICE_TABLE_ENTRY
             {
             callback = null,
             name = IntPtr.Zero
             };
         zero = (IntPtr)(((long)entry) + (Marshal.SizeOf(typeof(WIN32.SERVICE_TABLE_ENTRY)) * services.Length));
         Marshal.StructureToPtr(structure, zero, true);
         bool flag2 = WIN32.StartServiceCtrlDispatcher(entry);
         string exceptionMessage = "";
         if (!flag2)
             {
             exceptionMessage = new Win32Exception().Message;
             string str4 = Res.GetString("CantStartFromCommandLine");
             if (Environment.UserInteractive)
                 {
                 string str5 = Res.GetString("CantStartFromCommandLineTitle");
                 LateBoundMessageBoxShow(str4, str5);
                 }
             else
                 {
                 Console.WriteLine(str4);
                 }
             }
         foreach (DecompiledServiceBase base2 in services)
             {
             base2.Dispose();
             if (!flag2 && (base2.EventLog.Source.Length != 0))
                 {
                 base2.WriteEventLogEntry(Res.GetString("StartFailed", new object[] { exceptionMessage }), EventLogEntryType.Error);
                 }
             }
         }
 }