ReactOS  0.4.13-dev-92-gf251225
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  {
136  case DLL_PROCESS_ATTACH:
137  DisableThreadLibraryCalls(hinstDLL);
138  break;
139 
140  case DLL_PROCESS_DETACH:
141  break;
142  }
143 
144  return TRUE;
145 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_PROCESS_DETACH
Definition: compat.h:119

◆ 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");
83  &ServiceStatus);
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");
95  }
96 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SERVICE_PAUSED
Definition: winsvc.h:27
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
static VOID UpdateServiceStatus(DWORD dwState)
Definition: dcomlaunch.c:33
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: dcomlaunch.c:26
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:986
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
static HANDLE ShutdownEvent
Definition: dcomlaunch.c:28
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
#define DPRINT1
Definition: precomp.h:8
#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()

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);
111  if (!ServiceStatusHandle)
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
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static VOID UpdateServiceStatus(DWORD dwState)
Definition: dcomlaunch.c:33
#define argv
Definition: mplay32.c:18
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: dcomlaunch.c:26
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: dcomlaunch.c:55
void DPRINT(...)
Definition: polytest.cpp:61
static HANDLE ShutdownEvent
Definition: dcomlaunch.c:28
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:802
static WCHAR ServiceName[]
Definition: dcomlaunch.c:24
VOID DealWithDeviceEvent()
#define DPRINT1
Definition: precomp.h:8
#define INFINITE
Definition: serial.h:102

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 33 of file dcomlaunch.c.

34 {
36  ServiceStatus.dwCurrentState = dwState;
41 
42  if (dwState == SERVICE_START_PENDING ||
43  dwState == SERVICE_STOP_PENDING ||
44  dwState == SERVICE_PAUSE_PENDING ||
45  dwState == SERVICE_CONTINUE_PENDING)
46  ServiceStatus.dwWaitHint = 10000;
47  else
49 
51  &ServiceStatus);
52 }
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: dcomlaunch.c:26
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:986
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwControlsAccepted
Definition: winsvc.h:101
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23

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

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