mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 15:47:54 +02:00
* Dotted filenames for package fcl-extra
This commit is contained in:
parent
b3a5a03163
commit
e55c2b0fb7
3
packages/fcl-extra/namespaced/System.DaemonApp.pp
Normal file
3
packages/fcl-extra/namespaced/System.DaemonApp.pp
Normal file
@ -0,0 +1,3 @@
|
||||
unit System.DaemonApp;
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
{$i daemonapp.pp}
|
3
packages/fcl-extra/namespaced/System.Fileinfo.pp
Normal file
3
packages/fcl-extra/namespaced/System.Fileinfo.pp
Normal file
@ -0,0 +1,3 @@
|
||||
unit System.Fileinfo;
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
{$i fileinfo.pp}
|
@ -0,0 +1,3 @@
|
||||
unit System.Win.ServiceManager;
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
{$i ServiceManager.pas}
|
7
packages/fcl-extra/namespaces.lst
Normal file
7
packages/fcl-extra/namespaces.lst
Normal file
@ -0,0 +1,7 @@
|
||||
src/fileinfo.pp=namespaced/System.Fileinfo.pp
|
||||
{s*:src/}=namespaced/
|
||||
{i+:src/}
|
||||
src/win/ServiceManager.pas=namespaced/System.Win.ServiceManager.pas
|
||||
{s*:src/win/}=namespaced/
|
||||
{i+:src/win/}
|
||||
src/daemonapp.pp=namespaced/System.DaemonApp.pp
|
@ -11,14 +11,21 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit daemonapp;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
uses
|
||||
Fcl.CustApp, System.Classes, System.SysUtils, Fcl.EventLog, System.RtlConsts;
|
||||
{$ELSE FPC_DOTTEDUNITS}
|
||||
uses
|
||||
Custapp, Classes, SysUtils, eventlog, rtlconsts;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
Type
|
||||
TCustomDaemon = Class;
|
||||
|
@ -13,14 +13,21 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit FileInfo;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
{$mode objfpc}
|
||||
{$h+}
|
||||
interface
|
||||
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
uses
|
||||
System.SysUtils, System.Classes, System.Resources.Resource, System.Resources.VersionTypes, System.Resources.Version;
|
||||
{$ELSE FPC_DOTTEDUNITS}
|
||||
uses
|
||||
SysUtils, Classes, resource, versiontypes, versionresource;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
type
|
||||
// Low level interface
|
||||
|
@ -13,7 +13,11 @@
|
||||
**********************************************************************}
|
||||
{ System dependent service stuff }
|
||||
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
uses UnixApi.Base;
|
||||
{$ELSE FPC_DOTTEDUNITS}
|
||||
uses baseunix;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
Resourcestring
|
||||
SErrFailedToFork = 'Failed to fork daemon process.';
|
||||
|
@ -13,12 +13,19 @@
|
||||
**********************************************************************}
|
||||
{$mode objfpc}
|
||||
{$h+}
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit ServiceManager;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
uses
|
||||
WinApi.Windows, System.SysUtils, System.Classes, WinApi.Jedi.Winnt, WinApi.Jedi.Winsvc;
|
||||
{$ELSE FPC_DOTTEDUNITS}
|
||||
uses
|
||||
Windows, SysUtils, Classes, jwawinnt, jwawinsvc;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
type
|
||||
|
||||
@ -699,7 +706,7 @@ begin
|
||||
Pargs:=StringsToPcharList(Args);
|
||||
end;
|
||||
Try
|
||||
If not jwawinsvc.StartService(SHandle,Argc,PChar(PArgs)) then
|
||||
If not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.StartService(SHandle,Argc,PChar(PArgs)) then
|
||||
RaiseLastOSError;
|
||||
Finally
|
||||
If (PArgs<>Nil) then
|
||||
@ -725,7 +732,7 @@ end;
|
||||
Procedure TServiceManager.LockServiceDatabase;
|
||||
|
||||
begin
|
||||
FDBLock:=jwawinsvc.LockServiceDatabase(Handle);
|
||||
FDBLock:={$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.LockServiceDatabase(Handle);
|
||||
If FDBLock=Nil then
|
||||
RaiseLastOSError;
|
||||
end;
|
||||
@ -735,7 +742,7 @@ begin
|
||||
If (FDBLock<>Nil) then
|
||||
begin
|
||||
Try
|
||||
If Not jwawinsvc.UnLockServiceDatabase(FDBLock) then
|
||||
If Not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.UnLockServiceDatabase(FDBLock) then
|
||||
RaiseLastOSError;
|
||||
Finally
|
||||
FDBLock:=Nil;
|
||||
@ -750,12 +757,12 @@ Var
|
||||
BytesNeeded : DWord;
|
||||
|
||||
begin
|
||||
jwawinsvc.QueryServiceConfig(SHandle,Nil,0,BytesNeeded);
|
||||
{$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.QueryServiceConfig(SHandle,Nil,0,BytesNeeded);
|
||||
If (GetLastError<>ERROR_INSUFFICIENT_BUFFER) then
|
||||
RaiseLastOSError;
|
||||
GetMem(SvcCfg,BytesNeeded);
|
||||
Try
|
||||
If Not jwawinsvc.QueryServiceConfig(SHandle,SvcCfg,BytesNeeded,BytesNeeded) then
|
||||
If Not {$IFDEF FPC_DOTTEDUNITS}WinApi.Jedi.WinSvc{$ELSE}jwawinsvc{$ENDIF}.QueryServiceConfig(SHandle,SvcCfg,BytesNeeded,BytesNeeded) then
|
||||
RaiseLastOSError;
|
||||
With config,SvcCfg^ do
|
||||
begin
|
||||
@ -976,3 +983,4 @@ begin
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -13,7 +13,11 @@
|
||||
**********************************************************************}
|
||||
{ Win32 implementation of service application }
|
||||
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
uses WinApi.Windows,WinApi.Jedi.Winsvc;
|
||||
{$ELSE FPC_DOTTEDUNITS}
|
||||
uses windows,jwawinsvc;
|
||||
{$ENDIF FPC_DOTTEDUNITS}
|
||||
|
||||
Const
|
||||
CM_SERVICE_CONTROL_CODE = WM_USER+1;
|
||||
@ -345,7 +349,7 @@ begin
|
||||
if not GetClassInfoA(HInstance,AWClass.lpszClassName,TClass) then
|
||||
begin
|
||||
AWClass.hInstance := HInstance;
|
||||
if Windows.RegisterClassA(AWClass) = 0 then
|
||||
if {$IFDEF FPC_DOTTEDUNITS}WinApi.{$ENDIF}Windows.RegisterClassA(AWClass) = 0 then
|
||||
DaemonError(SErrWindowClass);
|
||||
end;
|
||||
GUIHandle := CreateWindowA(AWClass.lpszClassName, PAnsiChar(Title),
|
||||
|
Loading…
Reference in New Issue
Block a user