1#ifndef NT_SERVC_INCLUDED
2#define NT_SERVC_INCLUDED
56 long Init(LPCSTR szInternName,
void *ServiceThread,
57 void (*fpReqAppShutdownCb)()) noexcept;
63 BOOL
Install(
int startType, LPCSTR szInternName, LPCSTR szDisplayName,
64 LPCSTR szFullPath, LPCSTR szAccountName =
NULL,
65 LPCSTR szPassword =
NULL)
noexcept;
66 BOOL
SeekStatus(LPCSTR szInternName,
int OperationType);
67 BOOL
Remove(LPCSTR szInternName);
116 BOOL
SetStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode,
117 DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint,
Definition: nt_servc.h:23
long Init(LPCSTR szInternName, void *ServiceThread, void(*fpReqAppShutdownCb)()) noexcept
LPDWORD lpdwTagID
Definition: nt_servc.h:36
OSVERSIONINFO osVer
Definition: nt_servc.h:38
BOOL is_super_user()
Definition: nt_servc.cc:443
int nStartTimeOut
Definition: nt_servc.h:41
void(* fpRequestApplicationShutdownCallback)()
Definition: nt_servc.h:105
BOOL Remove(LPCSTR szInternName)
Removes the service.
Definition: nt_servc.cc:147
THREAD_FC fpServiceThread
Definition: nt_servc.h:104
HANDLE hExitEvent
Definition: nt_servc.h:99
void Exit(DWORD error)
Definition: nt_servc.cc:342
int nStopTimeOut
Definition: nt_servc.h:42
DWORD dwServiceType
Definition: nt_servc.h:31
NTService()
Definition: nt_servc.cc:26
LPTSTR * my_argv
Definition: nt_servc.h:48
void SetShutdownEvent(HANDLE hEvent) noexcept
Definition: nt_servc.h:60
BOOL StartService()
Definition: nt_servc.cc:244
void Stop(void)
this function should be called before the app.
Definition: nt_servc.cc:178
void SetSlowStarting(unsigned long timeout)
Sets a timeout after which SCM will abort service startup if SetRunning() was not called or the timeo...
Definition: nt_servc.cc:235
void StopService()
Definition: nt_servc.cc:255
~NTService()
Definition: nt_servc.cc:60
void ResumeService()
Definition: nt_servc.cc:270
BOOL Install(int startType, LPCSTR szInternName, LPCSTR szDisplayName, LPCSTR szFullPath, LPCSTR szAccountName=NULL, LPCSTR szPassword=NULL) noexcept
Installs the service with Service manager.
Definition: nt_servc.cc:97
BOOL bOsNT
true if OS is NT, false for Win95
Definition: nt_servc.h:28
DWORD dwErrorControl
Definition: nt_servc.h:33
HANDLE hShutdownEvent
Definition: nt_servc.h:49
BOOL bRunning
Definition: nt_servc.h:102
SERVICE_STATUS_HANDLE hServiceStatusHandle
Definition: nt_servc.h:100
int nError
Definition: nt_servc.h:50
static void ServiceMain(DWORD argc, LPTSTR *argv)
This is the function that is called from the service manager to start the service.
Definition: nt_servc.cc:191
LPSTR szLoadOrderGroup
Definition: nt_servc.h:35
DWORD my_argc
Definition: nt_servc.h:47
void PauseService()
Definition: nt_servc.cc:263
LPSTR szDependencies
Definition: nt_servc.h:37
LPSTR ServiceName
Definition: nt_servc.h:98
HANDLE hThreadHandle
Definition: nt_servc.h:103
BOOL SetStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint, DWORD dwWaitHint)
Definition: nt_servc.cc:277
DWORD dwDesiredAccess
Definition: nt_servc.h:30
void SetRunning(void)
Definition: nt_servc.cc:231
DWORD dwState
Definition: nt_servc.h:51
BOOL bPause
Definition: nt_servc.h:101
int nPauseTimeOut
Definition: nt_servc.h:43
BOOL got_service_option(char **argv, char *service_option)
int nResumeTimeOut
Definition: nt_servc.h:44
BOOL IsNT()
Definition: nt_servc.h:54
static void ServiceCtrlHandler(DWORD ctrlCode)
Definition: nt_servc.cc:315
static BOOL IsService(LPCSTR ServiceName) noexcept
Definition: nt_servc.cc:420
DWORD dwStartType
Definition: nt_servc.h:32
BOOL SeekStatus(LPCSTR szInternName, int OperationType)
Definition: nt_servc.cc:356
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:496
void(* THREAD_FC)(void *)
Definition: nt_servc.h:21
#define NULL
Definition: types.h:55
#define HANDLE
Definition: violite.h:159