ReactOS 0.4.15-dev-7704-gc07eb9f
thmsvc.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: base/services/shsvcs/thmsvc.c
5 * PURPOSE: Themes service
6 * PROGRAMMER: Giannis Adamopoulos
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include <windows.h>
12#include <wine/debug.h>
13
15
16/* GLOBALS ******************************************************************/
17
18static WCHAR ServiceName[] = L"Themes";
19
22
23
24/* FUNCTIONS *****************************************************************/
25
27
28static VOID
30{
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)
50 else
52
55}
56
57
58static DWORD WINAPI
60 DWORD dwEventType,
61 LPVOID lpEventData,
62 LPVOID lpContext)
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");
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}
103
104VOID
105WINAPI
107{
110
113 NULL);
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}
129
130/* EOF */
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
static int argc
Definition: ServiceArgs.c:12
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ERR(fmt,...)
Definition: debug.h:110
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
#define argv
Definition: mplay32.c:18
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
#define TRACE(s)
Definition: solgame.cpp:4
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
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
static WCHAR ServiceName[]
Definition: thmsvc.c:18
HANDLE StartEvent
Definition: thmsvc.c:26
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
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: thmsvc.c:20
VOID WINAPI ThemeServiceMain(DWORD argc, LPTSTR *argv)
Definition: thmsvc.c:106
SERVICE_STATUS ServiceStatus
Definition: thmsvc.c:21
HANDLE StopEvent
Definition: thmsvc.c:26
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#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_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
__wchar_t WCHAR
Definition: xmlstorage.h:180
CHAR * LPTSTR
Definition: xmlstorage.h:192