ReactOS 0.4.15-dev-8131-g4988de4
wuauserv.c File Reference
#include "wuauserv.h"
Include dependency graph for wuauserv.c:

Go to the source code of this file.

Functions

static VOID UpdateServiceStatus (DWORD dwState)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Variables

static WCHAR ServiceName [] = L"wuauserv"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 
static HANDLE hStopEvent = NULL
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 124 of file wuauserv.c.

127{
128 switch (fdwReason)
129 {
132 break;
133
135 break;
136 }
137
138 return TRUE;
139}
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85

◆ ServiceControlHandler()

static DWORD WINAPI ServiceControlHandler ( DWORD  dwControl,
DWORD  dwEventType,
LPVOID  lpEventData,
LPVOID  lpContext 
)
static

Definition at line 49 of file wuauserv.c.

53{
54 switch (dwControl)
55 {
57 DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_STOP received\n");
60 return ERROR_SUCCESS;
61
63 DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_PAUSE received\n");
65 return ERROR_SUCCESS;
66
68 DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_CONTINUE received\n");
70 return ERROR_SUCCESS;
71
73 DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_INTERROGATE received\n");
76 return ERROR_SUCCESS;
77
79 DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_SHUTDOWN received\n");
82 return ERROR_SUCCESS;
83
84 default :
85 DPRINT1("WU ServiceControlHandler() Control %lu received\n", dwControl);
87 }
88}
#define DPRINT1
Definition: precomp.h:8
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40
#define SERVICE_PAUSED
Definition: winsvc.h:27
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
static VOID UpdateServiceStatus(DWORD dwState)
Definition: wuauserv.c:23
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wuauserv.c:15
static HANDLE hStopEvent
Definition: wuauserv.c:18
static SERVICE_STATUS ServiceStatus
Definition: wuauserv.c:16

Referenced by ServiceMain().

◆ ServiceMain()

VOID WINAPI ServiceMain ( DWORD  argc,
LPTSTR argv 
)

Definition at line 91 of file wuauserv.c.

92{
95
96 DPRINT("WU ServiceMain() called\n");
97
100 NULL);
102 {
103 DPRINT1("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
104 return;
105 }
106
108 if (hStopEvent == NULL)
109 {
110 DPRINT1("CreateEvent() failed! (Error %lu)\n", GetLastError());
111 goto done;
112 }
113
115
118
119done:
121}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
#define argv
Definition: mplay32.c:18
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
#define DPRINT
Definition: sndvol32.h:73
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SERVICE_STOPPED
Definition: winsvc.h:21
static WCHAR ServiceName[]
Definition: wuauserv.c:13
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: wuauserv.c:49

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 23 of file wuauserv.c.

24{
31
32 if (dwState == SERVICE_START_PENDING ||
33 dwState == SERVICE_STOP_PENDING ||
34 dwState == SERVICE_PAUSE_PENDING ||
35 dwState == SERVICE_CONTINUE_PENDING)
37 else
39
40 if (dwState == SERVICE_RUNNING)
42
45 DPRINT1("WU UpdateServiceStatus() called\n");
46}
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwControlsAccepted
Definition: winsvc.h:101
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCurrentState
Definition: winsvc.h:100
DWORD dwCheckPoint
Definition: winsvc.h:104
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

Referenced by ServiceControlHandler(), and ServiceMain().

Variable Documentation

◆ hStopEvent

HANDLE hStopEvent = NULL
static

Definition at line 18 of file wuauserv.c.

Referenced by ServiceControlHandler(), and ServiceMain().

◆ ServiceName

WCHAR ServiceName[] = L"wuauserv"
static

Definition at line 13 of file wuauserv.c.

Referenced by ServiceMain().

◆ ServiceStatus

SERVICE_STATUS ServiceStatus
static

Definition at line 16 of file wuauserv.c.

Referenced by ServiceControlHandler(), and UpdateServiceStatus().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 15 of file wuauserv.c.

Referenced by ServiceControlHandler(), ServiceMain(), and UpdateServiceStatus().