ReactOS 0.4.15-dev-8127-g6338913
main.c File Reference
#include "precomp.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

static void _UpdateServiceStatus (DWORD dwNewStatus, DWORD dwCheckPoint)
 
static DWORD WINAPI _ServiceControlHandlerEx (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
static VOID WINAPI _ServiceMain (DWORD dwArgc, LPWSTR *lpszArgv)
 
int wmain (int argc, WCHAR *argv[])
 

Variables

SERVICE_STATUS_HANDLE hServiceStatus
 
SERVICE_STATUS ServiceStatus
 
WCHAR wszServiceName [] = L"Spooler"
 

Function Documentation

◆ _ServiceControlHandlerEx()

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

Definition at line 23 of file main.c.

24{
25 switch (dwControl)
26 {
32 return NO_ERROR;
33
35 return NO_ERROR;
36
37 default:
39 }
40}
#define NO_ERROR
Definition: dderror.h:5
#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
static void _UpdateServiceStatus(DWORD dwNewStatus, DWORD dwCheckPoint)
Definition: main.c:15
#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_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39

Referenced by _ServiceMain().

◆ _ServiceMain()

static VOID WINAPI _ServiceMain ( DWORD  dwArgc,
LPWSTR lpszArgv 
)
static

Definition at line 43 of file main.c.

44{
46
48 UNREFERENCED_PARAMETER(lpszArgv);
49
50 // Register our service for control
52
53 // Report initial SERVICE_START_PENDING status
60
61 // Create a thread for serving RPC requests
63 if (!hThread)
64 {
65 ERR("CreateThread failed with error %u!\n", GetLastError());
67 return;
68 }
69
70 // We don't need the thread handle. Keeping it open blocks the thread from terminating.
72
73 // Initialize the routing layer in spoolss.dll
75 {
76 ERR("InitializeRouter failed with error %lu!\n", GetLastError());
78 return;
79 }
80
81 // We're alive!
83}
#define ERR(fmt,...)
Definition: debug.h:113
#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
HANDLE hThread
Definition: wizard.c:28
#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
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 dwServiceSpecificExitCode
Definition: winsvc.h:103
BOOL WINAPI InitializeRouter(HANDLE SpoolerStatusHandle)
Definition: main.c:199
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10
static DWORD WINAPI _ServiceControlHandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: main.c:23
WCHAR wszServiceName[]
Definition: main.c:12
SERVICE_STATUS ServiceStatus
Definition: main.c:11
DWORD WINAPI LrpcThreadProc(LPVOID lpParameter)
Definition: rpcserver.c:11
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:729
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

Referenced by wmain().

◆ _UpdateServiceStatus()

static void _UpdateServiceStatus ( DWORD  dwNewStatus,
DWORD  dwCheckPoint 
)
static

Definition at line 15 of file main.c.

16{
17 ServiceStatus.dwCheckPoint = dwCheckPoint;
18 ServiceStatus.dwCurrentState = dwNewStatus;
20}
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
DWORD dwCurrentState
Definition: winsvc.h:100
DWORD dwCheckPoint
Definition: winsvc.h:104

Referenced by _ServiceControlHandlerEx(), and _ServiceMain().

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 86 of file main.c.

87{
89 {
91 {NULL, NULL}
92 };
93
96
98
99 return 0;
100}
static int argc
Definition: ServiceArgs.c:12
static SERVICE_TABLE_ENTRYW ServiceTable[2]
Definition: eventlog.c:24
#define argv
Definition: mplay32.c:18
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1134
static VOID WINAPI _ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
Definition: main.c:43

Variable Documentation

◆ hServiceStatus

◆ ServiceStatus

SERVICE_STATUS ServiceStatus

Definition at line 11 of file main.c.

Referenced by _ServiceMain(), and _UpdateServiceStatus().

◆ wszServiceName

WCHAR wszServiceName[] = L"Spooler"

Definition at line 12 of file main.c.

Referenced by _ServiceMain(), and wmain().