Class TService (unit SvcObj)

Inherits from

TServiceThread

Constructors


Constructor Create (Const AServiceName, ADisplayName: String);

- TService


Functions

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


Procedure Check (Value: Bool);

is it necessary or should Event.

Destructor Destroy;

allow WatchDog thread to kill service if it is not responding

Procedure Install;

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

Procedure Remove;


Procedure ReportStatus;

- report current Status to Service Control Manager

Function ServiceEntry: TServiceTableEntry;

Status:= SERVICE_STOPPED

Procedure Ctrl (Code: Integer);

reset wait hint

Procedure Execute;


Procedure InitStatus;

according to SDK doc

Procedure InternalContinue;


Procedure InternalPause;


Procedure InternalShutdown;

AfterExecute;

Procedure InternalStop;

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

Procedure Main (ArgCount: Integer; Args: TCharArray);

the system is shut down there are 20 seconds left for clean up (this value is hard-wired in HKLM\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeOut

Function ProcessType: Integer;

- preset FStatus

Procedure Start;


Procedure Stop;


Function GetDependencies: String;


Function GetStatus: Integer;


Function GetStatusHandle: Service_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 : Service_Status_Handle


Events

Variables

Arguments : TStrings;


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 : TServiceStatus;


FStatusHandle : Service_Status_Handle;


FWaitHint : Integer;



Constructors


Constructor Create (Const AServiceName, ADisplayName: String);

- TService


Functions


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


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


Procedure Install;

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


Procedure Remove;


Procedure ReportStatus;

- report current Status to Service Control Manager


Function ServiceEntry: TServiceTableEntry;

Status:= SERVICE_STOPPED


Procedure Ctrl (Code: Integer);

reset wait hint


Procedure Execute;


Procedure InitStatus;

according to SDK doc


Procedure InternalContinue;


Procedure InternalPause;


Procedure InternalShutdown;

AfterExecute;


Procedure InternalStop;

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


Procedure Main (ArgCount: Integer; Args: TCharArray);

the system is shut down there are 20 seconds left for clean up (this value is hard-wired in HKLM\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeOut


Function ProcessType: Integer;

- preset FStatus


Procedure Start;


Procedure Stop;


Function GetDependencies: String;


Function GetStatus: Integer;


Function GetStatusHandle: Service_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 : Service_Status_Handle


Events


Variables


Arguments : TStrings;


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 : TServiceStatus;


FStatusHandle : Service_Status_Handle;


FWaitHint : Integer;