ReactOS  0.4.12-dev-51-ge94618b
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 exitEvent = NULL
 

Function Documentation

◆ DllMain()

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

Definition at line 113 of file wuauserv.c.

116 {
117  switch (fdwReason)
118  {
119  case DLL_PROCESS_ATTACH:
120  DisableThreadLibraryCalls(hinstDLL);
121  break;
122 
123  case DLL_PROCESS_DETACH:
124  break;
125  }
126 
127  return TRUE;
128 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_PROCESS_DETACH
Definition: compat.h:119

◆ ServiceControlHandler()

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

Definition at line 46 of file wuauserv.c.

Referenced by ServiceMain().

50 {
51  switch (dwControl)
52  {
54  DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_STOP received\n");
57  return ERROR_SUCCESS;
58 
60  DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_PAUSE received\n");
62  return ERROR_SUCCESS;
63 
65  DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_CONTINUE received\n");
67  return ERROR_SUCCESS;
68 
70  DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_INTERROGATE received\n");
72  &ServiceStatus);
73  return ERROR_SUCCESS;
74 
76  DPRINT1("WU ServiceControlHandler() SERVICE_CONTROL_SHUTDOWN received\n");
78  return ERROR_SUCCESS;
79 
80  default :
81  DPRINT1("WU ServiceControlHandler() Control %lu received\n");
83  }
84 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wuauserv.c:15
#define SERVICE_PAUSED
Definition: winsvc.h:27
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:957
#define SERVICE_STOPPED
Definition: winsvc.h:21
static HANDLE exitEvent
Definition: wuauserv.c:18
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
static VOID UpdateServiceStatus(DWORD dwState)
Definition: wuauserv.c:23
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
#define DPRINT1
Definition: precomp.h:8
static SERVICE_STATUS ServiceStatus
Definition: wuauserv.c:16
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40

◆ ServiceMain()

VOID WINAPI ServiceMain ( DWORD  argc,
LPTSTR argv 
)

Definition at line 87 of file wuauserv.c.

88 {
91 
92  DPRINT("WU ServiceMain() called\n");
93 
96  NULL);
98  {
99  DPRINT1("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
100  return;
101  }
102 
104 
108 
110 }
#define CreateEvent
Definition: winbase.h:3562
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wuauserv.c:15
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: wuauserv.c:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static char ** argv
Definition: ServiceArgs.c:11
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define SERVICE_STOPPED
Definition: winsvc.h:21
static HANDLE exitEvent
Definition: wuauserv.c:18
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static VOID UpdateServiceStatus(DWORD dwState)
Definition: wuauserv.c:23
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:773
static WCHAR ServiceName[]
Definition: wuauserv.c:13
#define DPRINT1
Definition: precomp.h:8
#define INFINITE
Definition: serial.h:102

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 23 of file wuauserv.c.

Referenced by ServiceControlHandler(), and ServiceMain().

24 {
26  ServiceStatus.dwCurrentState = dwState;
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 
41  &ServiceStatus);
42  DPRINT1("WU UpdateServiceStatus() called\n");
43 }
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wuauserv.c:15
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:957
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwControlsAccepted
Definition: winsvc.h:101
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define DPRINT1
Definition: precomp.h:8
static SERVICE_STATUS ServiceStatus
Definition: wuauserv.c:16
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23

Variable Documentation

◆ exitEvent

HANDLE exitEvent = NULL
static

Definition at line 18 of file wuauserv.c.

◆ 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.

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 15 of file wuauserv.c.

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