ReactOS 0.4.16-dev-297-gc569aee
dcomlaunch.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winsvc.h>
#include <debug.h>
Include dependency graph for dcomlaunch.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NDEBUG
 

Functions

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

Variables

static WCHAR ServiceName [] = L"dcomlaunch"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 
static HANDLE ShutdownEvent
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 11 of file dcomlaunch.c.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 12 of file dcomlaunch.c.

◆ NDEBUG

#define NDEBUG

Definition at line 19 of file dcomlaunch.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 10 of file dcomlaunch.c.

Function Documentation

◆ DealWithDeviceEvent()

VOID DealWithDeviceEvent ( )

Referenced by ServiceMain().

◆ DllMain()

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

Definition at line 130 of file dcomlaunch.c.

133{
134 switch (fdwReason)
135 {
138 break;
139
141 break;
142 }
143
144 return TRUE;
145}
#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 55 of file dcomlaunch.c.

59{
60 DPRINT1("ServiceControlHandler() called\n");
61
62 switch (dwControl)
63 {
65 DPRINT1(" SERVICE_CONTROL_STOP received\n");
68 return ERROR_SUCCESS;
69
71 DPRINT1(" SERVICE_CONTROL_PAUSE received\n");
73 return ERROR_SUCCESS;
74
76 DPRINT1(" SERVICE_CONTROL_CONTINUE received\n");
78 return ERROR_SUCCESS;
79
81 DPRINT1(" SERVICE_CONTROL_INTERROGATE received\n");
84 return ERROR_SUCCESS;
85
87 DPRINT1(" SERVICE_CONTROL_SHUTDOWN received\n");
90 return ERROR_SUCCESS;
91
92 default :
93 DPRINT1(" Control %lu received\n", dwControl);
95 }
96}
#define DPRINT1
Definition: precomp.h:8
static VOID UpdateServiceStatus(DWORD dwState)
Definition: dcomlaunch.c:33
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: dcomlaunch.c:26
static HANDLE ShutdownEvent
Definition: dcomlaunch.c:28
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#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().

◆ ServiceMain()

VOID WINAPI ServiceMain ( DWORD  argc,
LPTSTR argv 
)

Definition at line 101 of file dcomlaunch.c.

102{
105
106 DPRINT("ServiceMain() called\n");
107
110 NULL);
112 {
113 DPRINT1("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
114 return;
115 }
116
118
120
122
125
127}
static int argc
Definition: ServiceArgs.c:12
static WCHAR ServiceName[]
Definition: dcomlaunch.c:24
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: dcomlaunch.c:55
VOID DealWithDeviceEvent()
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
#define argv
Definition: mplay32.c:18
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
#define DPRINT
Definition: sndvol32.h:73
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SERVICE_STOPPED
Definition: winsvc.h:21

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 33 of file dcomlaunch.c.

34{
41
42 if (dwState == SERVICE_START_PENDING ||
43 dwState == SERVICE_STOP_PENDING ||
44 dwState == SERVICE_PAUSE_PENDING ||
45 dwState == SERVICE_CONTINUE_PENDING)
47 else
49
52}
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_START_PENDING
Definition: winsvc.h:22
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

Referenced by ServiceControlHandler(), and ServiceMain().

Variable Documentation

◆ ServiceName

WCHAR ServiceName[] = L"dcomlaunch"
static

Definition at line 24 of file dcomlaunch.c.

Referenced by ServiceMain().

◆ ServiceStatus

SERVICE_STATUS ServiceStatus
static

Definition at line 27 of file dcomlaunch.c.

Referenced by ServiceControlHandler(), and UpdateServiceStatus().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 26 of file dcomlaunch.c.

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

◆ ShutdownEvent

HANDLE ShutdownEvent
static

Definition at line 28 of file dcomlaunch.c.

Referenced by RawInputThreadMain(), ServiceControlHandler(), and ServiceMain().