[Date Prev][Date Next]
(ITS#5002) Windows Service: logoff causes shutdown
Full_Name: Mark Lakes
Submission from: (NULL) (184.108.40.206)
Summary: LDAP service stops when user logs off.
The LDAP server is registered as a Windows Service and works correctly with
It is registered as an automatic service so should be running all the time.
When a user logs off from the box, the logoff triggers the service to stop
This happens on WindowsXP and Windows 2003 Server that are configured on a
I have a solution.
The problem is that despite the fact it is a service, it receives an event
called CTRL_LOGOFF_EVENT. Since it is not handling this event, the default
behavior by Windows is to shutdown the service.
Add the following code to the source at an appropriate place(probably somewhere
in ntservice.c) for when it runs as a service:
This is used to handle CTRL_LOGOFF_EVENT from shutting us down when we are
running as a service.
Return TRUE works. We dont really care what the crtlType is.
sprintf(logstr, "NTservice: caught signal(%d)\n", ctrlType);
Then, register the above function in the appropriate place as follows: