Proud::CNTService Class Reference
Inheritance diagram for Proud::CNTService:

Public Member Functions

PROUDSRV_API void GetArgv_Internal (CFastArray< String > &output)
 
PROUDSRV_API void GetEnvp_Internal (CFastArray< String > &output)
 
PROUDSRV_API void GetArgvFromSCM_Internal (CFastArray< String > &output)
 
PROUDSRV_API const PNTCHAR * GetName ()
 
PROUDSRV_API bool IsStartedBySCM () const
 
PROUDSRV_API bool FindArg (const PNTCHAR *name)
 
PROUDSRV_API String CreateArg ()
 
PROUDSRV_API BOOL IsInstalled ()
 
PROUDSRV_API void FrequentWarning (const PNTCHAR *text)
 
PROUDSRV_API void FrequentWarningWithCallStack (const PNTCHAR *text)
 

Static Public Member Functions

static PROUDSRV_API void WinMain (int argc, char *argv[], char *envp[], CNTServiceStartParameter &param)
 
static PROUDSRV_API void WinMain (int argc, wchar_t *argv[], wchar_t *envp[], CNTServiceStartParameter &param)
 
static PROUDSRV_API void GetArgv (CFastArray< String > &output)
 
static PROUDSRV_API void GetEnvp (CFastArray< String > &output)
 
static PROUDSRV_API void GetArgvFromSCM (CFastArray< String > &output)
 
- Static Public Member Functions inherited from Proud::DllSingleton< CNTService >
static CNTServiceGetUnsafeRef ()
 
static PtrType GetSharedPtr ()
 

Additional Inherited Members

- Public Types inherited from Proud::DllSingleton< CNTService >
typedef RefCount< CNTServicePtrType
 

Detailed Description

Windows service (daemon) module class

  • CNTService is Singleton. It can be accessed by Instance().

General usage

  • Calls WinMain() either from ::WinMain or ::main(). Can pass parameters from ::WinMain or ::main(). At this time, the previously prepared INTServiceEvent obkect must be attached.
  • Various setting status related to service execution can be acquired through IsInstalled(), IsStartedBySCM() and others.

Program execution parameter

  • -AR : If this option is added when registered to SCM, servive will auto-start after facing a crash. A handy function but can cause major irritation while debugging.
  • -install : Registers at SCM
  • -uninstall : Withdraws from SCM
  • -console : This option allows service to run as a general EXE form. When not wanted running it at SCM, you must use this option.

Member Function Documentation

PROUDSRV_API const PNTCHAR* Proud::CNTService::GetName ( )

Returns the name acquired from INTServiceEvent

PROUDSRV_API bool Proud::CNTService::IsStartedBySCM ( ) const

Is it run by SCM?

static PROUDSRV_API void Proud::CNTService::WinMain ( int  argc,
char *  argv[],
char *  envp[],
CNTServiceStartParameter param 
)
static

This method must be called either by service mudule main function main() or ::WinMain(). Manages followings.

  • Execution parameter handling: service register/withdraw, running console more and so on.
  • Getting event sink object
  • Running service main function(INTServiceEvent.Run())
    Parameters
    argcvalue received from main()
    argvvalue received from main()
    envpvalue received from main()
    paramSetting Value of CNTService
static PROUDSRV_API void Proud::CNTService::WinMain ( int  argc,
wchar_t *  argv[],
wchar_t *  envp[],
CNTServiceStartParameter param 
)
static

Service module main function. Must be called either by ::WinMain()main() or ::WinMain(). Manages followings.

  • Execution parameter handling: service register/withdraw, running console more and so on.
  • Getting event sink object
  • Running service main function(INTServiceEvent.Run())
    Parameters
    argcvalue received from main()
    argvvalue received from main()
    envpvalue received from main()
    paramSetting Value of CNTService