ReactOS 0.4.16-dev-122-g325d74c
serviceentry.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winsvc.h>
#include <wine/debug.h>
Include dependency graph for serviceentry.c:

Go to the source code of this file.

Functions

int kickoff_telnetd (void)
 
 WINE_DEFAULT_DEBUG_CHANNEL (telnetd)
 
static DWORD WINAPI service_handler (DWORD ctrl, DWORD event_type, LPVOID event_data, LPVOID context)
 
static void WINAPI serv_main (DWORD argc, LPWSTR *argv)
 
int main (int argc, char **argv)
 

Variables

static WCHAR telnetdW [] = {'t','e','l','n','e','t','d',0}
 
static SERVICE_STATUS_HANDLE service_handle
 
static HANDLE stop_event
 

Function Documentation

◆ kickoff_telnetd()

int kickoff_telnetd ( void  )

Definition at line 48 of file telnetd.c.

49{
50 printf("Attempting to start Simple TelnetD\n");
51
52// DetectPlatform();
54
56 ErrorExit("Unable to start socket interface\n");
57
59
60 while(!bShutdown) {
62 }
63
64 WSACleanup();
65 return 0;
66}
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2109
static const WCHAR Cleanup[]
Definition: register.c:80
#define printf
Definition: freeldr.h:97
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
static BOOLEAN StartSocketInterface(void)
Definition: telnetd.c:79
static void CreateSocket(void)
Definition: telnetd.c:102
static BOOLEAN bShutdown
Definition: telnetd.c:36
static void WaitForConnect(void)
Definition: telnetd.c:120
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60

Referenced by serv_main().

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 95 of file serviceentry.c.

96{
97 static const SERVICE_TABLE_ENTRYW servtbl[] = {
99 {NULL, NULL}
100 };
101
102 WINE_TRACE("(%d %p)\n", argc, argv);
103
105 return 0;
106}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
#define argv
Definition: mplay32.c:18
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1134
#define WINE_TRACE
Definition: debug.h:354
static WCHAR telnetdW[]
Definition: serviceentry.c:29
static void WINAPI serv_main(DWORD argc, LPWSTR *argv)
Definition: serviceentry.c:63

◆ serv_main()

static void WINAPI serv_main ( DWORD  argc,
LPWSTR argv 
)
static

Definition at line 63 of file serviceentry.c.

64{
66
67 WINE_TRACE( "starting service\n" );
68
70
72 if (!service_handle)
73 return;
74
75 status.dwServiceType = SERVICE_WIN32;
76 status.dwCurrentState = SERVICE_RUNNING;
78 status.dwWin32ExitCode = 0;
79 status.dwServiceSpecificExitCode = 0;
80 status.dwCheckPoint = 0;
81 status.dwWaitHint = 10000;
83
84 /* Argument Ignored for now */
86
88
89 status.dwCurrentState = SERVICE_STOPPED;
90 status.dwControlsAccepted = 0;
92 WINE_TRACE( "service stopped\n" );
93}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INFINITE
Definition: serial.h:102
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, LPVOID event_data, LPVOID context)
Definition: serviceentry.c:34
int kickoff_telnetd(void)
Definition: telnetd.c:48
static HANDLE stop_event
Definition: serviceentry.c:32
static SERVICE_STATUS_HANDLE service_handle
Definition: serviceentry.c:31
Definition: ps.c:97
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
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define SERVICE_WIN32
Definition: cmtypes.h:964

Referenced by main().

◆ service_handler()

static DWORD WINAPI service_handler ( DWORD  ctrl,
DWORD  event_type,
LPVOID  event_data,
LPVOID  context 
)
static

Definition at line 34 of file serviceentry.c.

35{
37
38 status.dwServiceType = SERVICE_WIN32;
39 status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
40 status.dwWin32ExitCode = 0;
41 status.dwServiceSpecificExitCode = 0;
42 status.dwCheckPoint = 0;
43 status.dwWaitHint = 0;
44
45 switch(ctrl)
46 {
49 WINE_TRACE( "shutting down\n" );
50 status.dwCurrentState = SERVICE_STOP_PENDING;
51 status.dwControlsAccepted = 0;
54 return NO_ERROR;
55 default:
56 WINE_FIXME( "got service ctrl %x\n", ctrl );
57 status.dwCurrentState = SERVICE_RUNNING;
59 return NO_ERROR;
60 }
61}
#define NO_ERROR
Definition: dderror.h:5
#define ctrl
Definition: input.c:1756
#define WINE_FIXME
Definition: debug.h:366
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_CONTROL_STOP
Definition: winsvc.h:36

Referenced by serv_main().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( telnetd  )

Variable Documentation

◆ service_handle

SERVICE_STATUS_HANDLE service_handle
static

Definition at line 31 of file serviceentry.c.

Referenced by serv_main(), and service_handler().

◆ stop_event

HANDLE stop_event
static

Definition at line 32 of file serviceentry.c.

Referenced by serv_main(), and service_handler().

◆ telnetdW

WCHAR telnetdW[] = {'t','e','l','n','e','t','d',0}
static

Definition at line 29 of file serviceentry.c.

Referenced by main(), and serv_main().