ReactOS 0.4.16-dev-329-g9223134
seclogon.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Secondary Logon Service
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Secondary Logon service RPC server
5 * COPYRIGHT: Eric Kohl 2022 <eric.kohl@reactos.org>
6 */
7
8/* INCLUDES *****************************************************************/
9
10#include "precomp.h"
11
13
14
15/* GLOBALS ******************************************************************/
16
19
20static WCHAR ServiceName[] = L"seclogon";
21
24
25
26/* FUNCTIONS *****************************************************************/
27
28static
29VOID
31 _In_ DWORD dwState)
32{
35
36 if (dwState == SERVICE_PAUSED || dwState == SERVICE_RUNNING)
40 else
42
46
47 if (dwState == SERVICE_START_PENDING ||
48 dwState == SERVICE_STOP_PENDING ||
49 dwState == SERVICE_PAUSE_PENDING ||
50 dwState == SERVICE_CONTINUE_PENDING)
52 else
54
57}
58
59
60static
64 _In_ DWORD dwControl,
65 _In_ DWORD dwEventType,
66 _In_ LPVOID lpEventData,
67 _In_ LPVOID lpContext)
68{
69 TRACE("ServiceControlHandlerEx()\n");
70
71 switch (dwControl)
72 {
74 TRACE(" SERVICE_CONTROL_STOP received\n");
78 return ERROR_SUCCESS;
79
81 TRACE(" SERVICE_CONTROL_PAUSE received\n");
85 return ERROR_SUCCESS;
86
88 TRACE(" SERVICE_CONTROL_CONTINUE received\n");
92 return ERROR_SUCCESS;
93
95 TRACE(" SERVICE_CONTROL_INTERROGATE received\n");
98 return ERROR_SUCCESS;
99
101 TRACE(" SERVICE_CONTROL_SHUTDOWN received\n");
105 return ERROR_SUCCESS;
106
107 default :
108 TRACE(" Control %lu received\n", dwControl);
110 }
111}
112
113
114VOID
115WINAPI
117 _In_ PSVCHOST_GLOBAL_DATA lpGlobals)
118{
119 TRACE("SvchostPushServiceGlobals(%p)\n", lpGlobals);
120 lpServiceGlobals = lpGlobals;
121}
122
123
124VOID
125WINAPI
127 _In_ INT ArgCount,
128 _In_ PWSTR *ArgVector)
129{
130 DWORD dwError;
131
132 UNREFERENCED_PARAMETER(ArgCount);
133 UNREFERENCED_PARAMETER(ArgVector);
134
135 TRACE("ServiceMain(%d %p)\n", ArgCount, ArgVector);
136
139 NULL);
141 {
142 ERR("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
143 return;
144 }
145
147
148 dwError = StartRpcServer();
149 if (dwError != ERROR_SUCCESS)
150 {
151 ERR("Service stopped (dwError: %lu\n", dwError);
153 return;
154 }
155
157}
158
159
160BOOL
161WINAPI
163 _In_ HINSTANCE hinstDLL,
164 _In_ DWORD fdwReason,
166{
168
169 switch (fdwReason)
170 {
173 hDllInstance = hinstDLL;
174 break;
175
177 break;
178 }
179
180 return TRUE;
181}
182
183/* EOF */
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD StartRpcServer(VOID)
Definition: rpcserver.c:32
DWORD StopRpcServer(VOID)
Definition: rpcserver.c:44
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#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
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define _In_
Definition: no_sal2.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#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
static WCHAR ServiceName[]
Definition: seclogon.c:20
static VOID UpdateServiceStatus(_In_ DWORD dwState)
Definition: seclogon.c:30
VOID WINAPI SvcEntry_Seclogon(_In_ INT ArgCount, _In_ PWSTR *ArgVector)
Definition: seclogon.c:126
PSVCHOST_GLOBAL_DATA lpServiceGlobals
Definition: seclogon.c:18
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: seclogon.c:22
BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID pvReserved)
Definition: seclogon.c:162
static SERVICE_STATUS ServiceStatus
Definition: seclogon.c:23
VOID WINAPI SvchostPushServiceGlobals(_In_ PSVCHOST_GLOBAL_DATA lpGlobals)
Definition: seclogon.c:116
static DWORD WINAPI ServiceControlHandlerEx(_In_ DWORD dwControl, _In_ DWORD dwEventType, _In_ LPVOID lpEventData, _In_ LPVOID lpContext)
Definition: seclogon.c:63
HINSTANCE hDllInstance
Definition: seclogon.c:17
#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
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
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_SHARE_PROCESS
Definition: cmtypes.h:963
__wchar_t WCHAR
Definition: xmlstorage.h:180