Exemplo n.º 1
0
 private void Initialize(bool multipleServices)
 {
     if (!this.initialized)
     {
         if (this.disposed)
         {
             throw new ObjectDisposedException(base.GetType().Name);
         }
         if (!multipleServices)
         {
             this.status.serviceType = 0x10;
         }
         else
         {
             this.status.serviceType = 0x20;
         }
         this.status.currentState            = 2;
         this.status.controlsAccepted        = 0;
         this.status.win32ExitCode           = 0;
         this.status.serviceSpecificExitCode = 0;
         this.status.checkPoint = 0;
         this.status.waitHint   = 0;
         this.mainCallback      = new System.ServiceProcess.NativeMethods.ServiceMainCallback(this.ServiceMainCallback);
         this.commandCallback   = new System.ServiceProcess.NativeMethods.ServiceControlCallback(this.ServiceCommandCallback);
         this.commandCallbackEx = new System.ServiceProcess.NativeMethods.ServiceControlCallbackEx(this.ServiceCommandCallbackEx);
         this.handleName        = Marshal.StringToHGlobalUni(this.ServiceName);
         this.initialized       = true;
     }
 }
 private void Initialize(bool multipleServices)
 {
     if (!this.initialized)
     {
         if (this.disposed)
         {
             throw new ObjectDisposedException(base.GetType().Name);
         }
         if (!multipleServices)
         {
             this.status.serviceType = 0x10;
         }
         else
         {
             this.status.serviceType = 0x20;
         }
         this.status.currentState = 2;
         this.status.controlsAccepted = 0;
         this.status.win32ExitCode = 0;
         this.status.serviceSpecificExitCode = 0;
         this.status.checkPoint = 0;
         this.status.waitHint = 0;
         this.mainCallback = new System.ServiceProcess.NativeMethods.ServiceMainCallback(this.ServiceMainCallback);
         this.commandCallback = new System.ServiceProcess.NativeMethods.ServiceControlCallback(this.ServiceCommandCallback);
         this.commandCallbackEx = new System.ServiceProcess.NativeMethods.ServiceControlCallbackEx(this.ServiceCommandCallbackEx);
         this.handleName = Marshal.StringToHGlobalUni(this.ServiceName);
         this.initialized = true;
     }
 }