httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject [ATTN] Tip for 2.0 Win32 Service code.
Date Thu, 08 Jun 2000 13:29:41 GMT
> From: []
> Sent: Thursday, June 08, 2000 12:59 AM
> Just upacked 2.04a a few minutes ago and noticed that 
> the Win32 Service Startup is still jumping through hoops 
> because of the way the Win32 Service Control Manager will 
> 'call' the 'main()' body with no command line parameters when 
> it is trying to 'start' the Service.

   TO USE 2.0x, we are changing several parameters

2) Please look at 2.0.5a-dev, it is an entirely different code path.
3) It is no longer an issue :-)

> Most people's instinct when they download a binary distribution
> and see an executable is to simply type in the name of 
> the executable and see if it has some 'help' or tells them
> what to do first. In the case of Apache 2.0 on Win32
> MANY people are going to try this and it might be handy
> to head off a raft of 'Wuh happened?' PR reports by retaining
> the ability to print some help or a 'You just typed in the name
> of the program and that won't work' console error message.

You make a good point, and even unix utils will ask;

did you mean to ... ? type prog -h for help
> This is NOT a patch because this is no time to confuse the
> issues while you are simply trying to get it working the
> way it is but I thought you should know there is a neat
> trick which might help you work it out.

Always love good tricks :-)
>  STARTUPINFO for manual 'rctpdw -i' from command line...
>  RCTPDW.C  @00235:main():lpsi->dwXCountChars   = 1310720
>  RCTPDW.C  @00236:main():lpsi->dwYCountChars   = 1
>  RCTPDW.C  @00237:main():lpsi->dwFillAttribute = 1322872
>  RCTPDW.C  @00238:main():lpsi->dwFlags         = 0
>  RCTPDW.C  @00239:main():lpsi->wShowWindow     = 1
>  RCTPDW.C  @00240:main():lpsi->cbReserved2     = 0
>  RCTPDW.C  @00241:main():lpsi->lpReserved2     = [(null)]
>  STARTUPINFO when Service Control Manager calls...
>  RCTPDW.C  @00235:main():lpsi->dwXCountChars   = 0
>  RCTPDW.C  @00236:main():lpsi->dwYCountChars   = 0
>  RCTPDW.C  @00237:main():lpsi->dwFillAttribute = 0
>  RCTPDW.C  @00238:main():lpsi->dwFlags         = 128
>  RCTPDW.C  @00239:main():lpsi->wShowWindow     = 0
>  RCTPDW.C  @00240:main():lpsi->cbReserved2     = 0
>  RCTPDW.C  @00241:main():lpsi->lpReserved2     = [(null)]
>  RCTPDW.C  @00242:main():lpsi->hStdInput       = -858993460
>  RCTPDW.C  @00243:main():lpsi->hStdOutput      = -858993460
>  RCTPDW.C  @00244:main():lpsi->hStdError       = -858993460
>  The most obvious thing, of course, is that 'ShowWindow' flag will
>  be TRUE (1) if program executes normally from command line and
>  FALSE (0) if executed in the background by the Service Control
>  Manager. Ditto for screen buffer related dw?CountChars variables.

And, unfortuantely, for the child procs... too narrow a test.
I like the dwFlags or xycountchars, but that would take some extra
research.  I am not certain it is needed if you download the 2.0.5a
build you will see why.

> BTW: If you want to be REALLY sure it's the SCM calling then 
> you can always simply make further calls to 
> NtQueryInformationProcess() on NT or 'GetThreadContext()' for
> Win 9x and find out EXACTLY who is 'calling you'. You can 
> even narrow it down to HOW you are being called ( NET START, 
> or Control Panel, or StartServiceCtrlDispather() )
> though it doesn't really matter from an execution standpoint.

_That_ sounds like the right approach... thank you for the tips!

View raw message