https://git.reactos.org/?p=reactos.git;a=commitdiff;h=55368bacc8cba3f9b729d1...
commit 55368bacc8cba3f9b729d1e06e0184f11907e294 Author: Denis Malikov filedem@gmail.com AuthorDate: Sat Feb 3 05:03:17 2018 +0700 Commit: Mark Jansen mark.jansen@reactos.org CommitDate: Sun Aug 19 19:56:18 2018 +0200
[UPDATES] New stubs for Automatic Updates service and WUSA.exe. Presence of this modules required for installation by some NT6+ applications. --- base/applications/CMakeLists.txt | 1 + base/applications/wusa/CMakeLists.txt | 6 ++ base/applications/wusa/res/setup.ico | Bin 0 -> 22486 bytes base/applications/wusa/resource.h | 3 + base/applications/wusa/resource.rc | 14 ++++ base/applications/wusa/wusa.c | 19 +++++ base/applications/wusa/wusa.h | 4 ++ base/services/CMakeLists.txt | 1 + base/services/wuauserv/CMakeLists.txt | 7 ++ base/services/wuauserv/wuauserv.c | 128 ++++++++++++++++++++++++++++++++++ base/services/wuauserv/wuauserv.h | 11 +++ base/services/wuauserv/wuauserv.rc | 5 ++ base/services/wuauserv/wuauserv.spec | 1 + boot/bootdata/hivesys.inf | 13 ++++ 14 files changed, 213 insertions(+)
diff --git a/base/applications/CMakeLists.txt b/base/applications/CMakeLists.txt index 4c7677abdc..87cbdbf5e1 100644 --- a/base/applications/CMakeLists.txt +++ b/base/applications/CMakeLists.txt @@ -43,3 +43,4 @@ add_subdirectory(winhlp32) add_subdirectory(winver) add_subdirectory(wordpad) add_subdirectory(write) +add_subdirectory(wusa) diff --git a/base/applications/wusa/CMakeLists.txt b/base/applications/wusa/CMakeLists.txt new file mode 100644 index 0000000000..ab27e96541 --- /dev/null +++ b/base/applications/wusa/CMakeLists.txt @@ -0,0 +1,6 @@ + +add_rc_deps(resource.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/setup.ico) +add_executable(wusa wusa.c resource.rc) +set_module_type(wusa win32gui UNICODE) +add_importlibs(wusa shell32 msvcrt kernel32) +add_cd_file(TARGET wusa DESTINATION reactos/system32 FOR all) diff --git a/base/applications/wusa/res/setup.ico b/base/applications/wusa/res/setup.ico new file mode 100644 index 0000000000..cd786edc67 Binary files /dev/null and b/base/applications/wusa/res/setup.ico differ diff --git a/base/applications/wusa/resource.h b/base/applications/wusa/resource.h new file mode 100644 index 0000000000..0901b426ea --- /dev/null +++ b/base/applications/wusa/resource.h @@ -0,0 +1,3 @@ +#pragma once + +#define IDI_WUSA 101 diff --git a/base/applications/wusa/resource.rc b/base/applications/wusa/resource.rc new file mode 100644 index 0000000000..d4141fce21 --- /dev/null +++ b/base/applications/wusa/resource.rc @@ -0,0 +1,14 @@ +#include <windef.h> + +#include "resource.h" + +/* Common resources */ + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS WUSA stub" +#define REACTOS_STR_INTERNAL_NAME "wusa" +#define REACTOS_STR_ORIGINAL_FILENAME "wusa.exe" +#include <reactos/version.rc> + +IDI_WUSA ICON "res/setup.ico" diff --git a/base/applications/wusa/wusa.c b/base/applications/wusa/wusa.c new file mode 100644 index 0000000000..c6a7245f95 --- /dev/null +++ b/base/applications/wusa/wusa.c @@ -0,0 +1,19 @@ +/* +* PROJECT: ReactOS Update Service +* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) +* PURPOSE: Windows Update Stand-Alone installer. +* Stub is required for some application at the installation phase. +* COPYRIGHT: Copyright 2018 Denis Malikov (filedem@gmail.com) +*/ + +#include "wusa.h" + +int +WINAPI +wWinMain(HINSTANCE hCurInst, + HINSTANCE hPrevInst, + LPWSTR lpsCmdLine, + int nCmdShow) +{ + return 0; +} diff --git a/base/applications/wusa/wusa.h b/base/applications/wusa/wusa.h new file mode 100644 index 0000000000..4b4669d575 --- /dev/null +++ b/base/applications/wusa/wusa.h @@ -0,0 +1,4 @@ +#define WIN32_NO_STATUS +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <wchar.h> diff --git a/base/services/CMakeLists.txt b/base/services/CMakeLists.txt index 75b547844c..977b5edf68 100644 --- a/base/services/CMakeLists.txt +++ b/base/services/CMakeLists.txt @@ -15,3 +15,4 @@ add_subdirectory(umpnpmgr) add_subdirectory(wkssvc) add_subdirectory(wlansvc) add_subdirectory(wmisvc) +add_subdirectory(wuauserv) diff --git a/base/services/wuauserv/CMakeLists.txt b/base/services/wuauserv/CMakeLists.txt new file mode 100644 index 0000000000..841d836fa6 --- /dev/null +++ b/base/services/wuauserv/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(wuauserv SHARED + wuauserv.c + wuauserv.rc) + +set_module_type(wuauserv win32dll UNICODE) +add_importlibs(wuauserv advapi32 msvcrt kernel32 ntdll) +add_cd_file(TARGET wuauserv DESTINATION reactos/system32 FOR all) diff --git a/base/services/wuauserv/wuauserv.c b/base/services/wuauserv/wuauserv.c new file mode 100644 index 0000000000..d302169826 --- /dev/null +++ b/base/services/wuauserv/wuauserv.c @@ -0,0 +1,128 @@ +/* +* PROJECT: ReactOS Update Service +* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) +* PURPOSE: Automatic Updates service stub. +* Stub is required for some application at the installation phase. +* COPYRIGHT: Copyright 2018 Denis Malikov (filedem@gmail.com) +*/ + +#include "wuauserv.h" + +/* GLOBALS ******************************************************************/ + +static WCHAR ServiceName[] = L"wuauserv"; + +static SERVICE_STATUS_HANDLE ServiceStatusHandle; +static SERVICE_STATUS ServiceStatus; + +static HANDLE exitEvent = NULL; + +/* FUNCTIONS *****************************************************************/ + +static VOID +UpdateServiceStatus(DWORD dwState) +{ + ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ServiceStatus.dwCurrentState = dwState; + ServiceStatus.dwControlsAccepted = 0; + ServiceStatus.dwWin32ExitCode = 0; + ServiceStatus.dwServiceSpecificExitCode = 0; + ServiceStatus.dwCheckPoint = 0; + + if (dwState == SERVICE_START_PENDING || + dwState == SERVICE_STOP_PENDING || + dwState == SERVICE_PAUSE_PENDING || + dwState == SERVICE_CONTINUE_PENDING) + ServiceStatus.dwWaitHint = 1000; + else + ServiceStatus.dwWaitHint = 0; + + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); + DPRINT1("WU UpdateServiceStatus() called\n"); +} + +static DWORD WINAPI +ServiceControlHandler(DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) +{ + switch (dwControl) + { + case SERVICE_CONTROL_STOP: + DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_STOP received\n"); + UpdateServiceStatus(SERVICE_STOPPED); + SetEvent(exitEvent); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_PAUSE: + DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_PAUSE received\n"); + UpdateServiceStatus(SERVICE_PAUSED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_CONTINUE: + DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_CONTINUE received\n"); + UpdateServiceStatus(SERVICE_RUNNING); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_INTERROGATE: + DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_INTERROGATE received\n"); + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_SHUTDOWN: + DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_SHUTDOWN received\n"); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + default : + DPRINT1("WU ServiceControlHandler() Control %lu received\n"); + return ERROR_CALL_NOT_IMPLEMENTED; + } +} + +VOID WINAPI +ServiceMain(DWORD argc, LPTSTR *argv) +{ + UNREFERENCED_PARAMETER(argc); + UNREFERENCED_PARAMETER(argv); + + DPRINT("WU ServiceMain() called\n"); + + ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, + ServiceControlHandler, + NULL); + if (!ServiceStatusHandle) + { + DPRINT1("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError()); + return; + } + + UpdateServiceStatus(SERVICE_RUNNING); + + exitEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + WaitForSingleObject(exitEvent, INFINITE); + CloseHandle(exitEvent); + + UpdateServiceStatus(SERVICE_STOPPED); +} + +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} diff --git a/base/services/wuauserv/wuauserv.h b/base/services/wuauserv/wuauserv.h new file mode 100644 index 0000000000..7134c2642b --- /dev/null +++ b/base/services/wuauserv/wuauserv.h @@ -0,0 +1,11 @@ +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include <stdarg.h> +#include <windef.h> +#include <winbase.h> +#include <winreg.h> +#include <winsvc.h> + +#define NDEBUG +#include <debug.h> diff --git a/base/services/wuauserv/wuauserv.rc b/base/services/wuauserv/wuauserv.rc new file mode 100644 index 0000000000..83feb925b1 --- /dev/null +++ b/base/services/wuauserv/wuauserv.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "AutoUpdate Service Stub" +#define REACTOS_STR_INTERNAL_NAME "wuauserv" +#define REACTOS_STR_ORIGINAL_FILENAME "wuauserv.dll" +#include <reactos/version.rc> diff --git a/base/services/wuauserv/wuauserv.spec b/base/services/wuauserv/wuauserv.spec new file mode 100644 index 0000000000..1b27fe5386 --- /dev/null +++ b/base/services/wuauserv/wuauserv.spec @@ -0,0 +1 @@ +@ stdcall ServiceMain(long ptr) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index 31f50ed773..1f58e5c939 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -2035,6 +2035,16 @@ HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","Start",0x00010001,0x00000002 HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","Type",0x00010001,0x00000020 HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\wbem\wmisvc.dll"
+; AutoUpdate Service +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","DisplayName",0x00000000,%WUAUSERV_SERVICE% +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","Description",0x00000000,%WUAUSERV_SERVICE_DESCRIPTION% +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","ErrorControl",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","ObjectName",0x00000000,"LocalSystem" +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","Start",0x00010001,0x00000002 +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv","Type",0x00010001,0x00000020 +HKLM,"SYSTEM\CurrentControlSet\Services\wuauserv\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\wuauserv.dll" + ; Sound Blaster (NT4) ;HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Description",0x00000000,"Sound Blaster (NT4)" ;HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ErrorControl",0x00010001,0x00000001 @@ -2191,6 +2201,9 @@ THEMES_SERVICE_DESCRIPTION="Themes support" WINMGMT_SERVICE="ReactOS Management Infrastructure" WINMGMT_SERVICE_DESCRIPTION="Provides interface to system management information."
+WUAUSERV_SERVICE="Automatic Updates" +WUAUSERV_SERVICE_DESCRIPTION="AutoUpdate Service stub." + WLANSVC_SERVICE="WLAN Service" WLANSVC_SERVICE_DESCRIPTION="WLAN Service"