ReactOS  0.4.12-dev-57-g7050ac4
thmsvc.c File Reference
#include <windows.h>
#include <wine/debug.h>
Include dependency graph for thmsvc.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shsvcs)
 
static VOID UpdateServiceStatus (DWORD dwState)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
VOID WINAPI ThemeServiceMain (DWORD argc, LPTSTR *argv)
 

Variables

static WCHAR ServiceName [] = L"Themes"
 
SERVICE_STATUS_HANDLE ServiceStatusHandle
 
SERVICE_STATUS ServiceStatus
 
HANDLE StartEvent
 
HANDLE StopEvent
 

Function Documentation

◆ ServiceControlHandler()

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

Definition at line 59 of file thmsvc.c.

Referenced by ThemeServiceMain().

63 {
64  TRACE("ServiceControlHandler() called\n");
65 
66  switch (dwControl)
67  {
69  TRACE(" SERVICE_CONTROL_STOP received\n");
70 
71  /* Signal the theme server in winlogon to remove theme hooks */
75  return ERROR_SUCCESS;
76 
78  TRACE(" SERVICE_CONTROL_PAUSE received\n");
80  return ERROR_SUCCESS;
81 
83  TRACE(" SERVICE_CONTROL_CONTINUE received\n");
85  return ERROR_SUCCESS;
86 
88  TRACE(" SERVICE_CONTROL_INTERROGATE received\n");
90  &ServiceStatus);
91  return ERROR_SUCCESS;
92 
94  TRACE(" SERVICE_CONTROL_SHUTDOWN received\n");
96  return ERROR_SUCCESS;
97 
98  default :
99  TRACE(" Control %lu received\n");
101  }
102 }
SERVICE_STATUS ServiceStatus
Definition: thmsvc.c:21
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SERVICE_PAUSED
Definition: winsvc.h:27
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
HANDLE StopEvent
Definition: thmsvc.c:26
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:957
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
#define TRACE(s)
Definition: solgame.cpp:4
static VOID UpdateServiceStatus(DWORD dwState)
Definition: thmsvc.c:29
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
HANDLE StartEvent
Definition: thmsvc.c:26
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
#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
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: thmsvc.c:20

◆ ThemeServiceMain()

VOID WINAPI ThemeServiceMain ( DWORD  argc,
LPTSTR argv 
)

Definition at line 106 of file thmsvc.c.

107 {
110 
113  NULL);
114  if (!ServiceStatusHandle)
115  {
116  ERR("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
117  return;
118  }
119 
120  StartEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStartEvent");
121  StopEvent = CreateEventW(NULL, TRUE, FALSE, L"Global\\ThemeStopEvent");
122 
124 
125  /* Signal the theme server in winlogon to install theme hooks */
128 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static char ** argv
Definition: ServiceArgs.c:11
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
HANDLE StopEvent
Definition: thmsvc.c:26
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: thmsvc.c:59
static VOID UpdateServiceStatus(DWORD dwState)
Definition: thmsvc.c:29
static const WCHAR L[]
Definition: oid.c:1087
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:773
#define ERR(fmt,...)
Definition: debug.h:109
HANDLE StartEvent
Definition: thmsvc.c:26
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
static WCHAR ServiceName[]
Definition: thmsvc.c:18
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: thmsvc.c:20

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 29 of file thmsvc.c.

Referenced by ServiceControlHandler(), and ThemeServiceMain().

30 {
32  ServiceStatus.dwCurrentState = dwState;
33 
34  if (dwState == SERVICE_RUNNING)
36  else if (dwState == SERVICE_PAUSED)
38  else
40 
44 
45  if (dwState == SERVICE_START_PENDING ||
46  dwState == SERVICE_STOP_PENDING ||
47  dwState == SERVICE_PAUSE_PENDING ||
48  dwState == SERVICE_CONTINUE_PENDING)
49  ServiceStatus.dwWaitHint = 10000;
50  else
52 
54  &ServiceStatus);
55 }
SERVICE_STATUS ServiceStatus
Definition: thmsvc.c:21
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_PAUSED
Definition: winsvc.h:27
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#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_RUNNING
Definition: winsvc.h:24
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
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 SERVICE_STOP_PENDING
Definition: winsvc.h:23
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: thmsvc.c:20

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shsvcs  )

Variable Documentation

◆ ServiceName

WCHAR ServiceName[] = L"Themes"
static

Definition at line 18 of file thmsvc.c.

Referenced by ThemeServiceMain().

◆ ServiceStatus

SERVICE_STATUS ServiceStatus

Definition at line 21 of file thmsvc.c.

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle

Definition at line 20 of file thmsvc.c.

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

◆ StartEvent

HANDLE StartEvent

Definition at line 26 of file thmsvc.c.

Referenced by CreateTestThread().

◆ StopEvent

HANDLE StopEvent

Definition at line 26 of file thmsvc.c.