Class TService (unit SvcObj)

Inherits from

TThread

Constructors


Constructor Create (Const AServiceName, ADisplayName: String);

- TService


Functions

Procedure AddToEventLog (AType: TEventLogType; Value: String);

remove cr and newline character

Procedure Check (Value: Bool);

is it necessary or should Event.

Destructor Destroy;

allow WatchDog thread to kill service if it is not responding

Function GetLastErrorText: String;


Procedure Install;

- installation stuff --------------------------------------------------

Procedure Remove;


Procedure ReportStatus;

- report current Status to Service Control Manager

Function ServiceEntry: TService_Table_Entry;

because we are not running in the TThread context, we can wait for Self (the thread) to finish

Procedure Ctrl (Code: Integer);

reset wait hint

Procedure Execute;


Procedure InitStatus;

according to SDK doc

Procedure InternalContinue;


Procedure InternalPause;

AfterExecute;

Procedure InternalStop;

-this waits much more efficiently than checking for 'Terminated'

Procedure Main (NumArgs: DWord; Var Args: PChar);


Function ProcessType: Integer;

- preset FStatus

Procedure Start;


Procedure Stop;


Function GetDependencies: String;


Function GetStatus: Integer;


Function GetStatusHandle: TService_Status_Handle;


Procedure SetDependencies (Const Value: String);


Procedure SetServiceName (Const Value: String);


Procedure SetStatus (Value: Integer);


Properties

property Account : String


property CanHardStop : Boolean


property CanPause : Boolean


property Dependencies : String


property DisplayName : String


property Interactive : Boolean


property Password : String


property ServiceName : String


property ServiceType : TServiceType


property StartType : DWord


property WaitHint : Integer


property Debug : Boolean


property Status : Integer


property StatusHandle : TService_Status_Handle


Events

Variables

EventLog : TEventLog;


StopEvent : TEvent;


FAccount : String;

private fields

FCanHardStop : Boolean;


FCanPause : Boolean;


FCtrlWrapper : TWrapper;


FDebug : Boolean;


FDependencies : Array[0..100] Of Char;

fields in API format

FDisplayName : String;


FInteractive : Boolean;


FMainWrapper : TWrapper;


FPassword : String;


FServiceName : String;


FServiceType : TServiceType;


FStartType : DWord;


FStatus : TService_Status;


FStatusHandle : TService_Status_Handle;


FWaitHint : Integer;



Constructors


Constructor Create (Const AServiceName, ADisplayName: String);

- TService


Functions


Procedure AddToEventLog (AType: TEventLogType; Value: String);

remove cr and newline character


Procedure Check (Value: Bool);

is it necessary or should Event.Free signal?


Destructor Destroy;

allow WatchDog thread to kill service if it is not responding


Function GetLastErrorText: String;


Procedure Install;

- installation stuff --------------------------------------------------


Procedure Remove;


Procedure ReportStatus;

- report current Status to Service Control Manager


Function ServiceEntry: TService_Table_Entry;

because we are not running in the TThread context, we can wait for Self (the thread) to finish


Procedure Ctrl (Code: Integer);

reset wait hint


Procedure Execute;


Procedure InitStatus;

according to SDK doc


Procedure InternalContinue;


Procedure InternalPause;

AfterExecute;


Procedure InternalStop;

-this waits much more efficiently than checking for 'Terminated'


Procedure Main (NumArgs: DWord; Var Args: PChar);


Function ProcessType: Integer;

- preset FStatus


Procedure Start;


Procedure Stop;


Function GetDependencies: String;


Function GetStatus: Integer;


Function GetStatusHandle: TService_Status_Handle;


Procedure SetDependencies (Const Value: String);


Procedure SetServiceName (Const Value: String);


Procedure SetStatus (Value: Integer);


Properties


property Account : String


property CanHardStop : Boolean


property CanPause : Boolean


property Dependencies : String


property DisplayName : String


property Interactive : Boolean


property Password : String


property ServiceName : String


property ServiceType : TServiceType


property StartType : DWord


property WaitHint : Integer


property Debug : Boolean


property Status : Integer


property StatusHandle : TService_Status_Handle


Events


Variables


EventLog : TEventLog;


StopEvent : TEvent;


FAccount : String;

private fields


FCanHardStop : Boolean;


FCanPause : Boolean;


FCtrlWrapper : TWrapper;


FDebug : Boolean;


FDependencies : Array[0..100] Of Char;

fields in API format


FDisplayName : String;


FInteractive : Boolean;


FMainWrapper : TWrapper;


FPassword : String;


FServiceName : String;


FServiceType : TServiceType;


FStartType : DWord;


FStatus : TService_Status;


FStatusHandle : TService_Status_Handle;


FWaitHint : Integer;