httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject RE: Win32 Process Window Termination
Date Wed, 17 May 2000 02:17:04 GMT
> From: Brian Moon []
> Sent: Tuesday, May 16, 2000 11:29 AM
> It seems that the easiest way to go would be to make the app 
> a window-less
> gui app.  I hope that makes sense.  In windows you can have 
> an app that is
> not console but at the same time does not have a window.  
> Now, I do not know
> the code inside and out, but it seems that should work.

The biggest agent against this is the command line style of
Apache.  I am not sure how the process could recapture sharing
of the same console after it has been launched as a windowed app.

I don't want to go to the obvious, one .exe for Apache9x services
(as you described) and one for everything else.  But I suspect 
Win9x will require a Window message loop of it's own, within a
hidden window.  I have found no other realistic mechanism (non-
polled) to detect that the system is shutting down.  But this
solution does nothing to help detect that the user clicked the 
close button of the console window.
> I believe the console windows are owned by a process named
> C:\WINDOWS\SYSTEM\conagent.exe.  If you look at the 
> properties of a console
> window in Win98 you will see that they all show that as the 
> program that is
> running and not the process itself.  Kind of strange.  Now, I 
> do not have
> 2.0 working on 98 yet, but for 1.3, I know that winoldap is 
> fired up when
> you start apache.  Not sure why.  Welcome to MS.

I know the conagent plays some very strange games, especially
compared to WinNT.  All for compatibility with the broad market
of 16 bit dos apps :-P  Unfortunately it's entirely undocumented.

> From: "William A. Rowe, Jr." <>
> To: <>
> > Win32 Folks;
> >
> >   [those easily annoyed by Wintel can ignore this thread -
> > it's another good example of the M$ boneheaded cr*p :-]
> >
> >   I've attacked and substantially conquered the process termination
> > issues under WinNT.  The code I'll be posting handles all manners of
> > ending the server, including Ctrl+C, Ctrl+Break, the close window
> > button and system shutdown.  None of the following applies 
> to WinNT...
> >
> >   Using JJK's submission as a base, I've also conquered starting
> > Apache as a service under Win9x.  When not as-service, it 
> also handles
> > the Ctrl+C and Ctrl+Break situations well.  When 
> as-service, I've tweaked
> > the code to hide, rather than destroy, the console window.  
> But I don't
> > care for the 'hidden window' approach if I can avoid it... since the
> > issue goes hand in hand with the following not-as-service issue:
> >
> >   Win9x uses a different Console wrapper, the window class 
> tty rather
> > than the NT ConsoleWindowClass, and has no provision to 
> send the various
> > shutdown and close events to the executable.  Kermit 5.0, 
> several other
> > compatibility thunks and other console apps seem to share 
> the same issues.
> >
> >   I've tried (unsuccessfully) to handle these events by 
> subclassing the
> > tty window.  This doesn't succeed, but indicates no error code upon
> > failure (other than returning 0 from SetWindowLong, which 
> is unexpected,
> > since the WNDPROC does have a value.)  I'm assuming that 
> another process
> > owns this tty window, even though it appears to be our own 
> (per spy).
> >
> >   I've got only a few other options, none of which I like.  
> The obvious
> > is to create a hidden window (I -hate- this), implement a 
> third party
> > console emulator (yes, a few exist), change to a GUI, poll 
> via the VM
> > calls (not calls, but int 2F!?!) etc, etc, etc.
> >
> >   If anyone has a good suggestion to offer, that does not break the
> > common code base (meaning, don't start in terms of the 
> Win32 rewrite!)
> > I'm all ears.
> >
> > Bill
> >

View raw message