Browse Source

* Allow disable of registering of message file

git-svn-id: trunk@24457 -
michael 12 years ago
parent
commit
bef9b11dad
1 changed files with 14 additions and 4 deletions
  1. 14 4
      packages/fcl-extra/src/daemonapp.pp

+ 14 - 4
packages/fcl-extra/src/daemonapp.pp

@@ -335,6 +335,7 @@ Type
     FRunMode: TDaemonRunMode;
     FRunMode: TDaemonRunMode;
     FSysData: TObject;
     FSysData: TObject;
     FControllerCount : Integer;
     FControllerCount : Integer;
+    FAutoRegisterMessageFile : Boolean;
     procedure BindDaemonDefs(AMapper: TCustomDaemonMapper);
     procedure BindDaemonDefs(AMapper: TCustomDaemonMapper);
     function  InstallRun: Boolean;
     function  InstallRun: Boolean;
     procedure SysInstallDaemon(Daemon: TCustomDaemon);
     procedure SysInstallDaemon(Daemon: TCustomDaemon);
@@ -362,6 +363,7 @@ Type
     procedure DoLog(EventType: TEventType; const Msg: String); override;
     procedure DoLog(EventType: TEventType; const Msg: String); override;
     Property SysData : TObject Read FSysData Write FSysData;
     Property SysData : TObject Read FSysData Write FSysData;
   Public
   Public
+    Constructor Create(AOwner : TComponent); override;
     destructor Destroy; override;
     destructor Destroy; override;
     Procedure ShowException(E : Exception); override;
     Procedure ShowException(E : Exception); override;
     Function CreateDaemon(DaemonDef : TDaemonDef) : TCustomDaemon;
     Function CreateDaemon(DaemonDef : TDaemonDef) : TCustomDaemon;
@@ -376,6 +378,7 @@ Type
     Property GUIMainLoop : TGuiLoopEvent Read FGUIMainLoop Write FGuiMainLoop;
     Property GUIMainLoop : TGuiLoopEvent Read FGUIMainLoop Write FGuiMainLoop;
     Property GuiHandle : THandle Read FGUIHandle Write FGUIHandle;
     Property GuiHandle : THandle Read FGUIHandle Write FGUIHandle;
     Property RunMode : TDaemonRunMode Read FRunMode;
     Property RunMode : TDaemonRunMode Read FRunMode;
+    Property AutoRegisterMessageFile : Boolean Read FAutoRegisterMessageFile Write FAutoRegisterMessageFile default true;
   end;
   end;
   TCustomDaemonApplicationClass = Class of TCustomDaemonApplication;
   TCustomDaemonApplicationClass = Class of TCustomDaemonApplication;
   
   
@@ -692,7 +695,6 @@ end;
 
 
 { TCustomServiceApplication }
 { TCustomServiceApplication }
 
 
-
 procedure TCustomDaemonApplication.CreateServiceMapper(Var AMapper : TCustomDaemonMapper);
 procedure TCustomDaemonApplication.CreateServiceMapper(Var AMapper : TCustomDaemonMapper);
 
 
 begin
 begin
@@ -794,7 +796,6 @@ Var
 
 
 begin
 begin
   FrunMode:=drmInstall;
   FrunMode:=drmInstall;
-  EventLog.RegisterMessageFile('');
   SysStartInstallDaemons;
   SysStartInstallDaemons;
   try
   try
     FMapper.DoOnInstall;
     FMapper.DoOnInstall;
@@ -826,7 +827,8 @@ Var
 
 
 begin
 begin
   FrunMode:=drmUnInstall;
   FrunMode:=drmUnInstall;
-  EventLog.UnRegisterMessageFile;
+  if FAutoRegisterMessageFile then
+    EventLog.UnRegisterMessageFile;
   SysStartUnInstallDaemons;
   SysStartUnInstallDaemons;
   Try
   Try
     FMapper.DoOnUnInstall;
     FMapper.DoOnUnInstall;
@@ -919,7 +921,8 @@ begin
     begin
     begin
     FEventLog:=TEventlog.Create(Self);
     FEventLog:=TEventlog.Create(Self);
     FEventLog.RaiseExceptionOnError:=False;
     FEventLog.RaiseExceptionOnError:=False;
-    FEventLog.RegisterMessageFile('');
+    if FAutoRegisterMessageFile then
+      FEventLog.RegisterMessageFile('');
     end;
     end;
   result := FEventLog;
   result := FEventLog;
 end;
 end;
@@ -932,6 +935,13 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
+constructor TCustomDaemonApplication.Create(AOwner : TComponent);
+
+begin
+  inherited;
+  FAutoRegisterMessageFile:=True;
+end;
+
 procedure TCustomDaemonApplication.DoRun;
 procedure TCustomDaemonApplication.DoRun;
 
 
 begin
 begin