ReactOS 0.4.15-dev-7953-g1f49173
srvsvc.c File Reference
#include "precomp.h"
Include dependency graph for srvsvc.c:

Go to the source code of this file.

Functions

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

Variables

static WCHAR ServiceName [] = L"Lanmanserver"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 
DWORD dwServiceBits = 0
 

Function Documentation

◆ DllMain()

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

Definition at line 185 of file srvsvc.c.

188{
189 switch (fdwReason)
190 {
193 break;
194
196 break;
197 }
198
199 return TRUE;
200}
#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 71 of file srvsvc.c.

75{
76 TRACE("ServiceControlHandler() called\n");
77
78 switch (dwControl)
79 {
81 TRACE(" SERVICE_CONTROL_STOP received\n");
83 /* Stop listening to incoming RPC messages */
86 return ERROR_SUCCESS;
87
89 TRACE(" SERVICE_CONTROL_PAUSE received\n");
91 return ERROR_SUCCESS;
92
94 TRACE(" SERVICE_CONTROL_CONTINUE received\n");
96 return ERROR_SUCCESS;
97
99 TRACE(" SERVICE_CONTROL_INTERROGATE received\n");
102 return ERROR_SUCCESS;
103
105 TRACE(" SERVICE_CONTROL_SHUTDOWN received\n");
107 /* Stop listening to incoming RPC messages */
110 return ERROR_SUCCESS;
111
112 default :
113 TRACE(" Control %lu received\n", dwControl);
115 }
116}
static VOID UpdateServiceStatus(DWORD dwState)
Definition: srvsvc.c:46
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: srvsvc.c:37
static SERVICE_STATUS ServiceStatus
Definition: srvsvc.c:38
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
#define TRACE(s)
Definition: solgame.cpp:4
#define SERVICE_STOPPED
Definition: winsvc.h:21
#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

Referenced by ServiceMain().

◆ ServiceInit()

static DWORD ServiceInit ( VOID  )
static

Definition at line 121 of file srvsvc.c.

122{
124
126 0,
128 NULL,
129 0,
130 NULL);
131
132 if (!hThread)
133 {
134 ERR("Can't create PortThread\n");
135 return GetLastError();
136 }
137 else
139
140 /* Report a running server service */
143 TRUE,
144 TRUE);
145
146 return ERROR_SUCCESS;
147}
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpcserver.c:20
#define ERR(fmt,...)
Definition: debug.h:110
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define SV_TYPE_SERVER
Definition: lmserver.h:428
HANDLE hThread
Definition: wizard.c:28
BOOL WINAPI SetServiceBits(SERVICE_STATUS_HANDLE hServiceStatus, DWORD dwServiceBits, BOOL bSetBitsOn, BOOL bUpdateImmediately)
Definition: sctrl.c:975
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:729

Referenced by ServiceMain().

◆ ServiceMain()

VOID WINAPI ServiceMain ( DWORD  argc,
LPTSTR argv 
)

Definition at line 152 of file srvsvc.c.

153{
154 DWORD dwError;
155
158
159 TRACE("ServiceMain() called\n");
160
163 NULL);
165 {
166 ERR("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
167 return;
168 }
169
171
172 dwError = ServiceInit();
173 if (dwError != ERROR_SUCCESS)
174 {
175 ERR("Service stopped (dwError: %lu\n", dwError);
177 return;
178 }
179
181}
static int argc
Definition: ServiceArgs.c:12
static WCHAR ServiceName[]
Definition: srvsvc.c:35
static DWORD ServiceInit(VOID)
Definition: srvsvc.c:121
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: srvsvc.c:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#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 SERVICE_START_PENDING
Definition: winsvc.h:22

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 46 of file srvsvc.c.

47{
54
55 if (dwState == SERVICE_START_PENDING ||
56 dwState == SERVICE_STOP_PENDING ||
57 dwState == SERVICE_PAUSE_PENDING ||
58 dwState == SERVICE_CONTINUE_PENDING)
60 else
62
63 if (dwState == SERVICE_RUNNING)
65
68}
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_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_SHARE_PROCESS
Definition: cmtypes.h:963

Referenced by ServiceControlHandler(), and ServiceMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( srvsvc  )

Variable Documentation

◆ dwServiceBits

◆ ServiceName

WCHAR ServiceName[] = L"Lanmanserver"
static

Definition at line 35 of file srvsvc.c.

Referenced by ServiceMain().

◆ ServiceStatus

SERVICE_STATUS ServiceStatus
static

Definition at line 38 of file srvsvc.c.

Referenced by ServiceControlHandler(), and UpdateServiceStatus().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 37 of file srvsvc.c.

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