My Project
|
Public Member Functions | |
BOOL | GetOS () |
BOOL | IsNT () |
long | Init (LPCSTR szInternName, void *ServiceThread) |
void | SetShutdownEvent (HANDLE hEvent) |
BOOL | Install (int startType, LPCSTR szInternName, LPCSTR szDisplayName, LPCSTR szFullPath, LPCSTR szAccountName=NULL, LPCSTR szPassword=NULL) |
BOOL | SeekStatus (LPCSTR szInternName, int OperationType) |
BOOL | Remove (LPCSTR szInternName) |
BOOL | IsService (LPCSTR ServiceName) |
BOOL | got_service_option (char **argv, char *service_option) |
BOOL | is_super_user () |
void | SetRunning (void) |
void | SetSlowStarting (unsigned long timeout) |
void | Stop (void) |
Public Attributes | |
BOOL | bOsNT |
true if OS is NT, false for Win95 | |
DWORD | dwDesiredAccess |
DWORD | dwServiceType |
DWORD | dwStartType |
DWORD | dwErrorControl |
LPSTR | szLoadOrderGroup |
LPDWORD | lpdwTagID |
LPSTR | szDependencies |
OSVERSIONINFO | osVer |
int | nStartTimeOut |
int | nStopTimeOut |
int | nPauseTimeOut |
int | nResumeTimeOut |
DWORD | my_argc |
LPTSTR * | my_argv |
HANDLE | hShutdownEvent |
int | nError |
DWORD | dwState |
Protected Member Functions | |
void | PauseService () |
void | ResumeService () |
void | StopService () |
BOOL | StartService () |
void | Exit (DWORD error) |
BOOL | SetStatus (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint, DWORD dwWaitHint) |
Static Protected Member Functions | |
static void | ServiceMain (DWORD argc, LPTSTR *argv) |
static void | ServiceCtrlHandler (DWORD ctrlCode) |
Protected Attributes | |
LPSTR | ServiceName |
HANDLE | hExitEvent |
SERVICE_STATUS_HANDLE | hServiceStatusHandle |
BOOL | bPause |
BOOL | bRunning |
HANDLE | hThreadHandle |
THREAD_FC | fpServiceThread |
long NTService::Init | ( | LPCSTR | szInternName, |
void * | ServiceThread | ||
) |
Registers the main service thread with the service manager.
ServiceThread | pointer to the main programs entry function when the service is started |
BOOL NTService::Install | ( | int | startType, |
LPCSTR | szInternName, | ||
LPCSTR | szDisplayName, | ||
LPCSTR | szFullPath, | ||
LPCSTR | szAccountName = NULL , |
||
LPCSTR | szPassword = NULL |
||
) |
Installs the service with Service manager.
nError values:
BOOL NTService::Remove | ( | LPCSTR | szInternName | ) |
Removes the service.
nError values:
void NTService::ServiceMain | ( | DWORD | argc, |
LPTSTR * | argv | ||
) | [static, protected] |
This is the function that is called from the service manager to start the service.
void NTService::SetSlowStarting | ( | unsigned long | timeout | ) |
Sets a timeout after which SCM will abort service startup if SetRunning() was not called or the timeout was not extended with another call to SetSlowStarting(). Should be called when static initialization completes, and the variable initialization part begins
void NTService::Stop | ( | void | ) |
this function should be called before the app. exits to stop the service