ReactOS  0.4.14-dev-604-gcfdd483
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 }
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
#define NO_ERROR
Definition: dderror.h:5
#define SERVICE_STOPPED
Definition: winsvc.h:21
smooth NULL
Definition: ftsmooth.c:416
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
static void _UpdateServiceStatus(DWORD dwNewStatus, DWORD dwCheckPoint)
Definition: main.c:15
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40

Referenced by _ServiceMain().

◆ _ServiceMain()

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

Definition at line 43 of file main.c.

44 {
46 
47  UNREFERENCED_PARAMETER(dwArgc);
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 }
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:707
#define CloseHandle
Definition: compat.h:406
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
WCHAR wszServiceName[]
Definition: main.c:12
#define NO_ERROR
Definition: dderror.h:5
DWORD WINAPI LrpcThreadProc(LPVOID lpParameter)
Definition: rpcserver.c:11
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
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:136
smooth NULL
Definition: ftsmooth.c:416
SERVICE_STATUS ServiceStatus
Definition: main.c:11
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#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
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:810
static void _UpdateServiceStatus(DWORD dwNewStatus, DWORD dwCheckPoint)
Definition: main.c:15
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10
#define ERR(fmt,...)
Definition: debug.h:109
DWORD dwControlsAccepted
Definition: winsvc.h:101
static DWORD WINAPI _ServiceControlHandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: main.c:23
HANDLE hThread
Definition: wizard.c:27
BOOL WINAPI InitializeRouter(HANDLE SpoolerStatusHandle)
Definition: main.c:199

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 }
DWORD dwCurrentState
Definition: winsvc.h:100
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:995
DWORD dwCheckPoint
Definition: winsvc.h:104
SERVICE_STATUS ServiceStatus
Definition: main.c:11
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10

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
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define argv
Definition: mplay32.c:18
WCHAR wszServiceName[]
Definition: main.c:12
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1132
smooth NULL
Definition: ftsmooth.c:416
static VOID WINAPI _ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
Definition: main.c:43
SERVICE_TABLE_ENTRYW ServiceTable[]
Definition: service.c:18

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().