ReactOS  0.4.15-dev-439-g292f67a
browser.c File Reference
#include "precomp.h"
Include dependency graph for browser.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (browser)
 
static VOID UpdateServiceStatus (DWORD dwState)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
static DWORD ServiceInit (VOID)
 
VOID WINAPI ServiceMain (_In_ INT ArgCount, _In_ PWSTR *ArgVector)
 
BOOL WINAPI DllMain (_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID pvReserved)
 

Variables

HINSTANCE hDllInstance
 
static WCHAR ServiceName [] = L"browser"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( _In_ HINSTANCE  hinstDLL,
_In_ DWORD  fdwReason,
_In_ PVOID  pvReserved 
)

Definition at line 163 of file browser.c.

167 {
169 
170  switch (fdwReason)
171  {
172  case DLL_PROCESS_ATTACH:
173  DisableThreadLibraryCalls(hinstDLL);
174  hDllInstance = hinstDLL;
175  break;
176 
177  case DLL_PROCESS_DETACH:
178  break;
179  }
180 
181  return TRUE;
182 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HINSTANCE hDllInstance
Definition: browser.c:17
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static LPCSTR DWORD void * pvReserved
Definition: str.c:196

◆ ServiceControlHandler()

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

Definition at line 55 of file browser.c.

60 {
61  TRACE("ServiceControlHandler()\n");
62 
63  switch (dwControl)
64  {
66  TRACE(" SERVICE_CONTROL_STOP received\n");
67  /* Stop listening to incoming RPC messages */
70  return ERROR_SUCCESS;
71 
73  TRACE(" SERVICE_CONTROL_PAUSE received\n");
75  return ERROR_SUCCESS;
76 
78  TRACE(" SERVICE_CONTROL_CONTINUE received\n");
80  return ERROR_SUCCESS;
81 
83  TRACE(" SERVICE_CONTROL_INTERROGATE received\n");
85  &ServiceStatus);
86  return ERROR_SUCCESS;
87 
89  TRACE(" SERVICE_CONTROL_SHUTDOWN received\n");
91  return ERROR_SUCCESS;
92 
93  default :
94  TRACE(" Control %lu received\n", dwControl);
96  }
97 }
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SERVICE_PAUSED
Definition: winsvc.h:27
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:995
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
static VOID UpdateServiceStatus(DWORD dwState)
Definition: browser.c:29
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: browser.c:21
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40

Referenced by ServiceMain().

◆ ServiceInit()

static DWORD ServiceInit ( VOID  )
static

Definition at line 102 of file browser.c.

103 {
104  HANDLE hThread;
105 
107  0,
109  NULL,
110  0,
111  NULL);
112 
113  if (!hThread)
114  {
115  ERR("Can't create PortThread\n");
116  return GetLastError();
117  }
118  else
120 
121  return ERROR_SUCCESS;
122 }
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:707
#define CloseHandle
Definition: compat.h:407
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpcserver.c:20
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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
#define ERR(fmt,...)
Definition: debug.h:110
HANDLE hThread
Definition: wizard.c:27

Referenced by ServiceMain(), and wWinMain().

◆ ServiceMain()

VOID WINAPI ServiceMain ( _In_ INT  ArgCount,
_In_ PWSTR ArgVector 
)

Definition at line 127 of file browser.c.

130 {
131  DWORD dwError;
132 
133  UNREFERENCED_PARAMETER(ArgCount);
134  UNREFERENCED_PARAMETER(ArgVector);
135 
136  FIXME("ServiceMain(%d %p)\n", ArgCount, ArgVector);
137 
140  NULL);
141  if (!ServiceStatusHandle)
142  {
143  ERR("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
144  return;
145  }
146 
148 
149  dwError = ServiceInit();
150  if (dwError != ERROR_SUCCESS)
151  {
152  ERR("Service stopped (dwError: %lu\n", dwError);
154  return;
155  }
156 
158 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_STOPPED
Definition: winsvc.h:21
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: browser.c:55
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:810
static DWORD ServiceInit(VOID)
Definition: browser.c:102
#define ERR(fmt,...)
Definition: debug.h:110
static VOID UpdateServiceStatus(DWORD dwState)
Definition: browser.c:29
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: browser.c:21
static WCHAR ServiceName[]
Definition: browser.c:19

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 29 of file browser.c.

31 {
33  ServiceStatus.dwCurrentState = dwState;
38 
39  if (dwState == SERVICE_START_PENDING ||
40  dwState == SERVICE_STOP_PENDING ||
41  dwState == SERVICE_PAUSE_PENDING ||
42  dwState == SERVICE_CONTINUE_PENDING)
43  ServiceStatus.dwWaitHint = 10000;
44  else
46 
48  &ServiceStatus);
49 }
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:995
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962
DWORD dwWaitHint
Definition: winsvc.h:105
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
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
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: browser.c:21

Referenced by ServiceControlHandler(), and ServiceMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( browser  )

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 17 of file browser.c.

Referenced by DllMain().

◆ ServiceName

WCHAR ServiceName[] = L"browser"
static

Definition at line 19 of file browser.c.

Referenced by ServiceMain().

◆ ServiceStatus

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 21 of file browser.c.

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