private static extern bool SetServiceStatus(IntPtr handle, ref ServiceStatus serviceStatus);
protected override void OnStart(string[] args) { WriteEventLog("Starting GwupeService" + BuildMarker); // Update the service state to Start Pending. ServiceStatus serviceStatus = new ServiceStatus { dwCurrentState = ServiceState.SERVICE_START_PENDING, dwWaitHint = 100000 }; SetServiceStatus(this.ServiceHandle, ref serviceStatus); ThreadPool.QueueUserWorkItem(state => BackgroundInit()); WriteEventLog("Started Background Init Thread for GwupeService" + BuildMarker); // Update the service state to Running. serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING; SetServiceStatus(this.ServiceHandle, ref serviceStatus); }