My Project
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes
NTService Class Reference

List of all members.

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

Member Function Documentation

long NTService::Init ( LPCSTR  szInternName,
void *  ServiceThread 
)

Registers the main service thread with the service manager.

Parameters:
ServiceThreadpointer 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:

  • 0 success
  • 1 Can't open the Service manager
  • 2 Failed to create service.
BOOL NTService::Remove ( LPCSTR  szInternName)

Removes the service.

nError values:

  • 0 success
  • 1 Can't open the Service manager
  • 2 Failed to locate service
  • 3 Failed to delete service.
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

  • timeout the timeout to pass to the SCM (in milliseconds)
void NTService::Stop ( void  )

this function should be called before the app. exits to stop the service


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines