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 =
nullptr,
65 LPCSTR szPassword =
nullptr) 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:444
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:343
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
BOOL Install(int startType, LPCSTR szInternName, LPCSTR szDisplayName, LPCSTR szFullPath, LPCSTR szAccountName=nullptr, LPCSTR szPassword=nullptr) noexcept
Installs the service with Service manager.
Definition: nt_servc.cc:97
void SetShutdownEvent(HANDLE hEvent) noexcept
Definition: nt_servc.h:60
BOOL StartService()
Definition: nt_servc.cc:245
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:236
void StopService()
Definition: nt_servc.cc:256
~NTService()
Definition: nt_servc.cc:60
void ResumeService()
Definition: nt_servc.cc:271
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:264
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:278
DWORD dwDesiredAccess
Definition: nt_servc.h:30
void SetRunning(void)
Definition: nt_servc.cc:232
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:316
static BOOL IsService(LPCSTR ServiceName) noexcept
Definition: nt_servc.cc:421
DWORD dwStartType
Definition: nt_servc.h:32
BOOL SeekStatus(LPCSTR szInternName, int OperationType)
Definition: nt_servc.cc:357
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
void(* THREAD_FC)(void *)
Definition: nt_servc.h:21
#define HANDLE
Definition: violite.h:159