Windows: Can now install/uninstall Apache as a service and start/stop apache via

net start and net stop commands. Not extensively tested, so there may be bugs
in this still.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bill Stoddard
1999-12-20 19:52:51 +00:00
parent f69d6ac434
commit e32d1edaaa
6 changed files with 57 additions and 55 deletions

View File

@ -49,7 +49,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 lib\apr\Release\aprlib.lib CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 lib\apr\Release\aprlib.lib CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "Apache - Win32 Debug"
@ -73,7 +73,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 lib\apr\debug\aprlib.lib CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 lib\apr\debug\aprlib.lib CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386
!ENDIF
@ -88,26 +88,10 @@ LINK32=link.exe
SOURCE=.\os\win32\main_win32.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\registry.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\service.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\os\win32\registry.h
# End Source File
# Begin Source File
SOURCE=.\os\win32\service.h
# End Source File
# End Group
# Begin Group "Resource Files"

View File

@ -369,9 +369,16 @@ EXPORTS
regerror @364
ap_send_error_response @365
ap_start_shutdown @366
; ap_send_signal @367
ap_pid_fname @368
ap_read_config @369
ap_server_pre_read_config @370
ap_server_post_read_config @371
ap_setup_prelinked_modules @372
send_signal_to_service @367
ap_read_config @368
ap_server_pre_read_config @369
ap_server_post_read_config @370
ap_setup_prelinked_modules @371
RemoveService @372
InstallService @373
isValidService @374
service_main @375
isProcessService @376
ap_registry_get_server_root @377
ap_registry_get_service_conf @378

View File

@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".\include" /I ".\lib\apr\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /FR /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
@ -222,10 +222,18 @@ SOURCE=.\os\win32\modules.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\registry.c
# End Source File
# Begin Source File
SOURCE=.\main\rfc1413.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\service.c
# End Source File
# Begin Source File
SOURCE=.\main\util.c
# End Source File
# Begin Source File

View File

@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".\include" /I ".\lib\apr\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /FR /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
@ -222,10 +222,18 @@ SOURCE=.\os\win32\modules.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\registry.c
# End Source File
# Begin Source File
SOURCE=.\main\rfc1413.c
# End Source File
# Begin Source File
SOURCE=.\os\win32\service.c
# End Source File
# Begin Source File
SOURCE=.\main\util.c
# End Source File
# Begin Source File

View File

@ -369,9 +369,16 @@ EXPORTS
regerror @364
ap_send_error_response @365
ap_start_shutdown @366
; ap_send_signal @367
ap_pid_fname @368
ap_read_config @369
ap_server_pre_read_config @370
ap_server_post_read_config @371
ap_setup_prelinked_modules @372
send_signal_to_service @367
ap_read_config @368
ap_server_pre_read_config @369
ap_server_post_read_config @370
ap_setup_prelinked_modules @371
RemoveService @372
InstallService @373
isValidService @374
service_main @375
isProcessService @376
ap_registry_get_server_root @377
ap_registry_get_service_conf @378

View File

@ -67,7 +67,8 @@
#include "ap_config.h"
#include "ap_listen.h"
#include "mpm_default.h"
#include "../os/win32/iol_socket.h"
#include "service.h"
#include "iol_socket.h"
#include "winnt.h"
@ -1555,11 +1556,7 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even
/* Create child process
* Should only be one in this version of Apache for WIN32
*/
#if 1
// ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000);
#else
// service_set_status(SERVICE_START_PENDING);
#endif
service_set_status(SERVICE_START_PENDING);
while (remaining_children_to_start--) {
if (create_process(pconf, process_handles, process_kill_events,
&current_live_processes) < 0) {
@ -1569,11 +1566,8 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even
goto die_now;
}
}
#if 1
// ReportStatusToSCMgr(SERVICE_RUNNING, NO_ERROR, 3000);
#else
// service_set_status(SERVICE_RUNNING);
#endif
service_set_status(SERVICE_RUNNING);
restart_pending = shutdown_pending = 0;
/* Wait for shutdown or restart events or for child death */
@ -1769,11 +1763,8 @@ API_EXPORT(int) ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec
setup_signal_names(ap_psprintf(pconf,"ap%d", parent_pid));
if (!restart) {
ap_log_pid(pconf, ap_pid_fname);
#if 1
// ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000);
#else
// service_set_status(SERVICE_START_PENDING);
#endif
service_set_status(SERVICE_START_PENDING);
AMCSocketInitialize();
// setup_signal_names(ap_psprintf(pconf,"ap%d", parent_pid));
@ -1827,11 +1818,8 @@ API_EXPORT(int) ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec
CloseHandle(restart_event);
CloseHandle(shutdown_event);
AMCSocketCleanup();
#if 1
// ReportStatusToSCMgr(SERVICE_STOPPED, NO_ERROR, 3000);
#else
// service_set_status(SERVICE_STOPPED);
#endif
service_set_status(SERVICE_STOPPED);
}
}
return !restart;