/// <include file='doc\ServiceBase.uex' path='docs/doc[@for="ServiceBase.Initialize"]/*' /> /// <devdoc> /// Starts the service object, creates the objects and /// allocates the memory needed. /// </devdoc> /// <internalonly/> internal NativeMethods.ENTRY Initialize(bool multipleServices) { //Cannot register the service with NT service manatger if the object has been disposed, since finalization has been suppressed. if (this.disposed) { throw new ObjectDisposedException(GetType().Name); } if (multipleServices) { status.serviceType = NativeMethods.SERVICE_TYPE_WIN32_OWN_PROCESS; } else { status.serviceType = NativeMethods.SERVICE_TYPE_WIN32_SHARE_PROCESS; } status.currentState = NativeMethods.STATE_START_PENDING; status.controlsAccepted = 0; status.win32ExitCode = 0; status.serviceSpecificExitCode = 0; status.checkPoint = 0; status.waitHint = 0; NativeMethods.ENTRY entry = new NativeMethods.ENTRY(); this.mainCallback = new NativeMethods.ServiceMainCallback(this.ServiceMainCallback); this.commandCallback = new NativeMethods.ServiceControlCallback(this.ServiceCommandCallback); this.commandCallbackEx = new NativeMethods.ServiceControlCallbackEx(this.ServiceCommandCallbackEx); this.handleName = Marshal.StringToHGlobalUni(this.ServiceName); nameFrozen = true; entry.callback = (Delegate)mainCallback; entry.name = this.handleName; return(entry); }
private void Initialize(bool multipleServices) { if (this.initialized) { return; } if (this.disposed) { throw new ObjectDisposedException(this.GetType().Name); } this.status.serviceType = multipleServices ? 32 : 16; 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 NativeMethods.ServiceMainCallback(this.ServiceMainCallback); this.commandCallback = new NativeMethods.ServiceControlCallback(this.ServiceCommandCallback); this.commandCallbackEx = new NativeMethods.ServiceControlCallbackEx(this.ServiceCommandCallbackEx); this.handleName = Marshal.StringToHGlobalUni(this.ServiceName); this.initialized = true; }
private void Initialize(bool multipleServices) { if (this.initialized) return; if (this.disposed) throw new ObjectDisposedException(this.GetType().Name); this.status.serviceType = multipleServices ? 32 : 16; 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 NativeMethods.ServiceMainCallback(this.ServiceMainCallback); this.commandCallback = new NativeMethods.ServiceControlCallback(this.ServiceCommandCallback); this.commandCallbackEx = new NativeMethods.ServiceControlCallbackEx(this.ServiceCommandCallbackEx); this.handleName = Marshal.StringToHGlobalUni(this.ServiceName); this.initialized = true; }