https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a631c8455a0edf055157c...
commit 8a631c8455a0edf055157c6792f0d8c23e643397 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sat Jul 20 19:27:22 2019 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sat Jul 20 19:30:27 2019 +0200
[WUAUSERV] Make the wuauserv service startable and stoppable. --- base/services/wuauserv/CMakeLists.txt | 5 ++++- base/services/wuauserv/wuauserv.c | 11 ++++++++--- boot/bootdata/hivesft.inf | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/base/services/wuauserv/CMakeLists.txt b/base/services/wuauserv/CMakeLists.txt index 14ffee84197..7984b706184 100644 --- a/base/services/wuauserv/CMakeLists.txt +++ b/base/services/wuauserv/CMakeLists.txt @@ -1,6 +1,9 @@ +spec2def(wuauserv.dll wuauserv.spec ADD_IMPORTLIB) + add_library(wuauserv MODULE wuauserv.c - wuauserv.rc) + wuauserv.rc + ${CMAKE_CURRENT_BINARY_DIR}/wuauserv.def)
set_module_type(wuauserv win32dll UNICODE) add_importlibs(wuauserv advapi32 msvcrt kernel32 ntdll) diff --git a/base/services/wuauserv/wuauserv.c b/base/services/wuauserv/wuauserv.c index d302169826d..cd9062c1145 100644 --- a/base/services/wuauserv/wuauserv.c +++ b/base/services/wuauserv/wuauserv.c @@ -37,6 +37,9 @@ UpdateServiceStatus(DWORD dwState) else ServiceStatus.dwWaitHint = 0;
+ if (dwState == SERVICE_RUNNING) + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + SetServiceStatus(ServiceStatusHandle, &ServiceStatus); DPRINT1("WU UpdateServiceStatus() called\n"); @@ -52,8 +55,8 @@ ServiceControlHandler(DWORD dwControl, { case SERVICE_CONTROL_STOP: DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_STOP received\n"); - UpdateServiceStatus(SERVICE_STOPPED); SetEvent(exitEvent); + UpdateServiceStatus(SERVICE_STOP_PENDING); return ERROR_SUCCESS;
case SERVICE_CONTROL_PAUSE: @@ -74,7 +77,8 @@ ServiceControlHandler(DWORD dwControl,
case SERVICE_CONTROL_SHUTDOWN: DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_SHUTDOWN received\n"); - UpdateServiceStatus(SERVICE_STOPPED); + SetEvent(exitEvent); + UpdateServiceStatus(SERVICE_STOP_PENDING); return ERROR_SUCCESS;
default : @@ -100,9 +104,10 @@ ServiceMain(DWORD argc, LPTSTR *argv) return; }
+ exitEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + UpdateServiceStatus(SERVICE_RUNNING);
- exitEvent = CreateEvent(NULL, TRUE, FALSE, NULL); WaitForSingleObject(exitEvent, INFINITE); CloseHandle(exitEvent);
diff --git a/boot/bootdata/hivesft.inf b/boot/bootdata/hivesft.inf index 818d26745a4..3cbf73b7361 100644 --- a/boot/bootdata/hivesft.inf +++ b/boot/bootdata/hivesft.inf @@ -1781,7 +1781,7 @@ HKLM,"SOFTWARE\Microsoft\Ole","EnableRemoteConnect",0x00000000,"N" ; SvcHost services HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","DcomLaunch",0x00010000,"DcomLaunch","PlugPlay" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"DHCP","BITS","lanmanserver","lanmanworkstation","Schedule","Themes","winmgmt","W32Time" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"DHCP","BITS","lanmanserver","lanmanworkstation","Schedule","Themes","W32Time","winmgmt","wuauserv"
; Win32 config HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows",,0x00000012