Mail Archives: cygwin/1997/05/03/13:32:04
At 04:19 PM 05/02/97 -0400, scoleman AT sewp DOT nasa DOT gov (Steve Coleman) wrote:
>Hi,
>
>I just downloaded the cygwin suite and ported my first Unix source code to NT
>yesterday and I was quite impressed with the ease at which I was able to do
>it. The program (a derivative of the TIS toolkit "smap") works fine from the
>command line but needs to run as a daemon on the system to be useful. I then
>tried to use the NT resource kit (srvany.exe) to load the application as an NT
>service. Everything works fine until someone logs out of the system at which
>time NT (sends messages? WM_ENDSESSION and CTRL_LOGOFF_EVENT) kills it. If the
>service is loaded when the machine boots the process still dies when the first
>person logs out. Even the cygwin nohup.exe does not help.
This is a known problem with srvany, not Cygwin. From srvany.wri:
"
Programming Considerations:
For WIN32 graphical applications: when the currently logged-in user is
logging-off, all WIN32 top-level windows receive WM_QUERYENDSESSION and
WM_ENDSESSION messages. Some WIN32 applications choose to terminate upon
receipt of such messages. In order for your WIN32 application to survive
logoff, it must not do that: instead, your windows procedure should call the
default windows procedure on these messages.
For WIN32 Console (i.e. character-mode) applications: when the currently
logged-in user is logging-off, all Console applications receive a
CTRL_LOGOFF_EVENT event from the Console.
If your Console application has registered a Console event handler (via
SetConsoleCtrlHandler), it must ignore CTRL_LOGOFF_EVENT in order to
survive the logoff.
"
Either try registering a Console event handler or rewrite the code as a
service (not a trivial task).
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -