Fixed: pipe permissions when running as a service
Added: service test application
This commit is contained in:
parent
32847f4988
commit
d3d9fa1d2f
@ -2,13 +2,7 @@ program X2LogNamedPipeClient;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
MainFrm in 'source\MainFrm.pas' {MainForm},
|
MainFrm in 'source\MainFrm.pas' {MainForm};
|
||||||
X2Log.Intf in '..\X2Log.Intf.pas',
|
|
||||||
X2Log.Client.NamedPipe in '..\X2Log.Client.NamedPipe.pas',
|
|
||||||
X2Log.Client.Base in '..\X2Log.Client.Base.pas',
|
|
||||||
X2Log.Observer.Event in '..\X2Log.Observer.Event.pas',
|
|
||||||
X2Log.Constants in '..\X2Log.Constants.pas',
|
|
||||||
X2Log.Observer.Custom in '..\X2Log.Observer.Custom.pas';
|
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base)'!=''">
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<DCC_UnitSearchPath>..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
<DCC_UsePackage>fmx;IndySystem;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DbxCommonDriver;dbxcds;DBXOracleDriver;CustomIPTransport;dsnap;fmxase;IndyCore;inetdbxpress;IPIndyImpl;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;soaprtl;bindengine;DBXInformixDriver;DBXFirebirdDriver;inet;fmxobj;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>fmx;IndySystem;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DbxCommonDriver;dbxcds;DBXOracleDriver;CustomIPTransport;dsnap;fmxase;IndyCore;inetdbxpress;IPIndyImpl;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;soaprtl;bindengine;DBXInformixDriver;DBXFirebirdDriver;inet;fmxobj;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
@ -68,6 +69,7 @@
|
|||||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||||
|
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||||
@ -86,12 +88,6 @@
|
|||||||
<Form>MainForm</Form>
|
<Form>MainForm</Form>
|
||||||
<FormType>dfm</FormType>
|
<FormType>dfm</FormType>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
<DCCReference Include="..\X2Log.Intf.pas"/>
|
|
||||||
<DCCReference Include="..\X2Log.Client.NamedPipe.pas"/>
|
|
||||||
<DCCReference Include="..\X2Log.Client.Base.pas"/>
|
|
||||||
<DCCReference Include="..\X2Log.Observer.Event.pas"/>
|
|
||||||
<DCCReference Include="..\X2Log.Constants.pas"/>
|
|
||||||
<DCCReference Include="..\X2Log.Observer.Custom.pas"/>
|
|
||||||
<BuildConfiguration Include="Release">
|
<BuildConfiguration Include="Release">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
|
@ -25,6 +25,8 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
|
System.SysUtils,
|
||||||
|
|
||||||
X2Log.Constants,
|
X2Log.Constants,
|
||||||
X2Log.Client.NamedPipe,
|
X2Log.Client.NamedPipe,
|
||||||
X2Log.Observer.Event;
|
X2Log.Observer.Event;
|
||||||
@ -44,7 +46,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.DoLog(Sender: TObject; Level: TX2LogLevel; const Msg, Details: string);
|
procedure TMainForm.DoLog(Sender: TObject; Level: TX2LogLevel; const Msg, Details: string);
|
||||||
begin
|
begin
|
||||||
mmoLog.Lines.Add(GetLogLevelText(Level) + ': ' + Msg + ' (' + Details + ')');
|
mmoLog.Lines.Add(DateTimeToStr(Now) + ' ' + GetLogLevelText(Level) + ': ' + Msg + ' (' + Details + ')');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
16
ServiceTest/X2LogServiceTest.dpr
Normal file
16
ServiceTest/X2LogServiceTest.dpr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
program X2LogServiceTest;
|
||||||
|
|
||||||
|
uses
|
||||||
|
Vcl.SvcMgr,
|
||||||
|
ServiceDMU in 'source\ServiceDMU.pas' {ServiceDM: TService};
|
||||||
|
|
||||||
|
{$R *.RES}
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not Application.DelayInitialize or Application.Installing then
|
||||||
|
Application.Initialize;
|
||||||
|
|
||||||
|
Application.CreateForm(TServiceDM, ServiceDM);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
179
ServiceTest/X2LogServiceTest.dproj
Normal file
179
ServiceTest/X2LogServiceTest.dproj
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{F55F63BD-FBEE-4080-B6D6-0410C2731C0F}</ProjectGuid>
|
||||||
|
<ProjectVersion>13.4</ProjectVersion>
|
||||||
|
<FrameworkType>VCL</FrameworkType>
|
||||||
|
<MainSource>X2LogServiceTest.dpr</MainSource>
|
||||||
|
<Base>True</Base>
|
||||||
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
|
<AppType>Application</AppType>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||||
|
<Base_Win64>true</Base_Win64>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||||
|
<Base_Win32>true</Base_Win32>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||||
|
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||||
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||||
|
<Cfg_2>true</Cfg_2>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<DCC_UnitSearchPath>..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
|
<DCC_UsePackage>fmx;IndySystem;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DbxCommonDriver;dbxcds;DBXOracleDriver;CustomIPTransport;dsnap;fmxase;IndyCore;inetdbxpress;IPIndyImpl;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;soaprtl;bindengine;DBXInformixDriver;DBXFirebirdDriver;inet;fmxobj;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||||
|
<Manifest_File>None</Manifest_File>
|
||||||
|
<VerInfo_Locale>1043</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<DCC_DcuOutput>lib</DCC_DcuOutput>
|
||||||
|
<DCC_ExeOutput>bin</DCC_ExeOutput>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
|
<DCC_UsePackage>dxdborRS16;cxLibraryRS16;dxLayoutControlRS16;dxPScxPivotGridLnkRS16;dxCoreRS16;cxExportRS16;dxBarRS16;cxSpreadSheetRS16;cxTreeListdxBarPopupMenuRS16;TeeDB;dxDBXServerModeRS16;dxPsPrVwAdvRS16;vclib;dxPSCoreRS16;cxPivotGridOLAPRS16;dxPScxTLLnkRS16;dxPScxGridLnkRS16;cxPageControlRS16;dxRibbonRS16;DBXSybaseASEDriver;vclimg;cxTreeListRS16;dxComnRS16;vcldb;dxADOServerModeRS16;vcldsnap;dxBarExtDBItemsRS16;DBXDb2Driver;vcl;DBXMSSQLDriver;cxDataRS16;cxBarEditItemRS16;dxDockingRS16;dxPSDBTeeChartRS16;cxPageControldxBarPopupMenuRS16;webdsnap;dxBarExtItemsRS16;dxPSLnksRS16;dxPSTeeChartRS16;adortl;dxPSdxLCLnkRS16;dxorgcRS16;dxWizardControlRS16;dxPScxExtCommonRS16;dxNavBarRS16;dxPSdxDBOCLnkRS16;cxSchedulerTreeBrowserRS16;Tee;DBXOdbcDriver;dxdbtrRS16;dxPScxSSLnkRS16;dxPScxCommonRS16;dxmdsRS16;dxPSPrVwRibbonRS16;cxGridRS16;cxEditorsRS16;TeeUI;vclactnband;dxServerModeRS16;bindcompvcl;cxPivotGridRS16;dxPScxSchedulerLnkRS16;dxPSdxDBTVLnkRS16;vclie;cxSchedulerRibbonStyleEventEditorRS16;cxSchedulerRS16;vcltouch;websnap;VclSmp;dxTabbedMDIRS16;DataSnapConnectors;dxPSdxOCLnkRS16;dsnapcon;dxPSdxFCLnkRS16;dxThemeRS16;dxPScxPCProdRS16;vclx;dxFlowChartRS16;dxGDIPlusRS16;dxBarDBNavRS16;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
|
<DCC_UsePackage>dxdborRS16;cxLibraryRS16;dxLayoutControlRS16;dxPScxPivotGridLnkRS16;dxCoreRS16;cxExportRS16;dxBarRS16;cxSpreadSheetRS16;cxTreeListdxBarPopupMenuRS16;TeeDB;dxDBXServerModeRS16;dxPsPrVwAdvRS16;vclib;inetdbbde;dxPSCoreRS16;cxPivotGridOLAPRS16;dxPScxTLLnkRS16;dxPScxGridLnkRS16;cxPageControlRS16;dxRibbonRS16;DBXSybaseASEDriver;vclimg;fmi;cxTreeListRS16;dxComnRS16;vcldb;dxADOServerModeRS16;vcldsnap;dxBarExtDBItemsRS16;X2CLGL;DBXDb2Driver;vcl;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;cxDataRS16;cxBarEditItemRS16;dxDockingRS16;dxPSDBTeeChartRS16;cxPageControldxBarPopupMenuRS16;cxSchedulerGridRS16;webdsnap;X2CLMB;dxBarExtItemsRS16;dxPSLnksRS16;OmniThreadLibraryRuntimeXE2;dxtrmdRS16;dxPSTeeChartRS16;adortl;dxPSdxLCLnkRS16;madBasic_;dxorgcRS16;dxWizardControlRS16;dxPScxExtCommonRS16;vcldbx;dxNavBarRS16;dxPSdxDBOCLnkRS16;cxSchedulerTreeBrowserRS16;Tee;DBXOdbcDriver;dxdbtrRS16;madDisAsm_;svnui;dxPScxSSLnkRS16;dxPScxCommonRS16;dxmdsRS16;dxPSPrVwRibbonRS16;cxPivotGridChartRS16;cxGridRS16;cxEditorsRS16;FMXTee;TeeUI;vclactnband;dxServerModeRS16;bindcompvcl;cxPivotGridRS16;dxPScxSchedulerLnkRS16;dxPSdxDBTVLnkRS16;vclie;cxSchedulerRibbonStyleEventEditorRS16;cxSchedulerRS16;madExcept_;vcltouch;websnap;VclSmp;dxTabbedMDIRS16;DataSnapConnectors;dxPSdxOCLnkRS16;dsnapcon;dxPSdxFCLnkRS16;dxThemeRS16;dxPScxPCProdRS16;vclx;svn;dxFlowChartRS16;bdertl;VirtualTreesR;dxGDIPlusRS16;dxBarDBNavRS16;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||||
|
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||||
|
<DCC_Optimize>false</DCC_Optimize>
|
||||||
|
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||||
|
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||||
|
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||||
|
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||||
|
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||||
|
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||||
|
<DCC_DebugInformation>false</DCC_DebugInformation>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
<MainSource>MainSource</MainSource>
|
||||||
|
</DelphiCompile>
|
||||||
|
<DCCReference Include="source\ServiceDMU.pas">
|
||||||
|
<Form>ServiceDM</Form>
|
||||||
|
<FormType>dfm</FormType>
|
||||||
|
<DesignClass>TService</DesignClass>
|
||||||
|
</DCCReference>
|
||||||
|
<BuildConfiguration Include="Release">
|
||||||
|
<Key>Cfg_2</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Base">
|
||||||
|
<Key>Base</Key>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Debug">
|
||||||
|
<Key>Cfg_1</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||||
|
<Borland.ProjectType/>
|
||||||
|
<BorlandProject>
|
||||||
|
<Delphi.Personality>
|
||||||
|
<VersionInfo>
|
||||||
|
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||||
|
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||||
|
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||||
|
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Release">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Build">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Debug">False</VersionInfo>
|
||||||
|
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Special">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Private">False</VersionInfo>
|
||||||
|
<VersionInfo Name="DLL">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Locale">1043</VersionInfo>
|
||||||
|
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||||
|
</VersionInfo>
|
||||||
|
<VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="CompanyName"/>
|
||||||
|
<VersionInfoKeys Name="FileDescription"/>
|
||||||
|
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="InternalName"/>
|
||||||
|
<VersionInfoKeys Name="LegalCopyright"/>
|
||||||
|
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||||
|
<VersionInfoKeys Name="OriginalFilename"/>
|
||||||
|
<VersionInfoKeys Name="ProductName"/>
|
||||||
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="Comments"/>
|
||||||
|
</VersionInfoKeys>
|
||||||
|
<Source>
|
||||||
|
<Source Name="MainSource">X2LogServiceTest.dpr</Source>
|
||||||
|
</Source>
|
||||||
|
<Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvAppFrmDesign160.bpl">JVCL Application and Form Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvBandsDesign160.bpl">JVCL Band Objects</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvBDEDesign160.bpl">JVCL BDE Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvCmpDesign160.bpl">JVCL Non-Visual Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvControlsDesign160.bpl">JVCL Visual Controls</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvCoreDesign160.bpl">JVCL Core Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvCryptDesign160.bpl">JVCL Encryption and Compression</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvCustomDesign160.bpl">JVCL Custom Controls</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvDBDesign160.bpl">JVCL Database Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvDlgsDesign160.bpl">JVCL Dialog Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvDockingDesign160.bpl">JVCL Docking Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvDotNetCtrlsDesign160.bpl">JVCL DotNet Controls</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvGlobusDesign160.bpl">JVCL Globus Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvHMIDesign160.bpl">JVCL HMI Controls</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvJansDesign160.bpl">JVCL Jans Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvManagedThreadsDesign160.bpl">JVCL Managed Threads</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvMMDesign160.bpl">JVCL Multimedia and Image Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvNetDesign160.bpl">JVCL Network Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvPageCompsDesign160.bpl">JVCL Page Style Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvPascalInterpreterDesign160.bpl">JVCL Interpreter Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvPluginSystemDesign160.bpl">JVCL Plugin Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvPrintPreviewDesign160.bpl">JVCL Print Preview Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvRuntimeDesignDesign160.bpl">JVCL Runtime Design Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvStdCtrlsDesign160.bpl">JVCL Standard Controls</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvSystemDesign160.bpl">JVCL System Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvTimeFrameworkDesign160.bpl">JVCL Time Framework</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvWizardsDesign160.bpl">JVCL Wizard</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvXPCtrlsDesign160.bpl">JVCL XP Controls</Excluded_Packages>
|
||||||
|
</Excluded_Packages>
|
||||||
|
</Delphi.Personality>
|
||||||
|
<Deployment/>
|
||||||
|
<Platforms>
|
||||||
|
<Platform value="Win64">False</Platform>
|
||||||
|
<Platform value="Win32">True</Platform>
|
||||||
|
</Platforms>
|
||||||
|
</BorlandProject>
|
||||||
|
<ProjectFileVersion>12</ProjectFileVersion>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
|
||||||
|
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
|
||||||
|
</Project>
|
BIN
ServiceTest/X2LogServiceTest.res
Normal file
BIN
ServiceTest/X2LogServiceTest.res
Normal file
Binary file not shown.
13
ServiceTest/source/ServiceDMU.dfm
Normal file
13
ServiceTest/source/ServiceDMU.dfm
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
object ServiceDM: TServiceDM
|
||||||
|
OldCreateOrder = False
|
||||||
|
DisplayName = 'X'#178'Log Test Service'
|
||||||
|
OnStart = ServiceStart
|
||||||
|
Height = 150
|
||||||
|
Width = 215
|
||||||
|
object tmrLog: TTimer
|
||||||
|
Interval = 5000
|
||||||
|
OnTimer = tmrLogTimer
|
||||||
|
Left = 88
|
||||||
|
Top = 56
|
||||||
|
end
|
||||||
|
end
|
67
ServiceTest/source/ServiceDMU.pas
Normal file
67
ServiceTest/source/ServiceDMU.pas
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
unit ServiceDMU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
uses
|
||||||
|
System.Classes,
|
||||||
|
System.SysUtils,
|
||||||
|
Vcl.Controls,
|
||||||
|
Vcl.Dialogs,
|
||||||
|
Vcl.ExtCtrls,
|
||||||
|
Vcl.Graphics,
|
||||||
|
Vcl.SvcMgr,
|
||||||
|
Winapi.Messages,
|
||||||
|
Winapi.Windows;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TServiceDM = class(TService)
|
||||||
|
tmrLog: TTimer;
|
||||||
|
|
||||||
|
procedure ServiceStart(Sender: TService; var Started: Boolean);
|
||||||
|
procedure tmrLogTimer(Sender: TObject);
|
||||||
|
public
|
||||||
|
function GetServiceController: TServiceController; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
ServiceDM: TServiceDM;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
uses
|
||||||
|
X2Log.Intf,
|
||||||
|
X2Log.Global,
|
||||||
|
X2Log.Observer.NamedPipe;
|
||||||
|
|
||||||
|
{$R *.DFM}
|
||||||
|
|
||||||
|
|
||||||
|
procedure ServiceController(CtrlCode: DWord); stdcall;
|
||||||
|
begin
|
||||||
|
ServiceDM.Controller(CtrlCode);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TServiceDM.GetServiceController: TServiceController;
|
||||||
|
begin
|
||||||
|
Result := ServiceController;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TServiceDM.ServiceStart(Sender: TService; var Started: Boolean);
|
||||||
|
begin
|
||||||
|
TX2GlobalLog.Attach(TX2LogNamedPipeObserver.Create('X2LogService', X2LogLevelsAll));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TServiceDM.tmrLogTimer(Sender: TObject);
|
||||||
|
var
|
||||||
|
level: TX2LogLevel;
|
||||||
|
|
||||||
|
begin
|
||||||
|
level := TX2LogLevel(Random(Ord(High(TX2LogLevel))));
|
||||||
|
TX2GlobalLog.Log(level, 'Ping!');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -21,7 +21,8 @@ uses
|
|||||||
X2Log.Observer.MonitorForm in '..\X2Log.Observer.MonitorForm.pas' {X2LogObserverMonitorForm},
|
X2Log.Observer.MonitorForm in '..\X2Log.Observer.MonitorForm.pas' {X2LogObserverMonitorForm},
|
||||||
X2Log.Global in '..\X2Log.Global.pas',
|
X2Log.Global in '..\X2Log.Global.pas',
|
||||||
X2Log.Client.NamedPipe in '..\X2Log.Client.NamedPipe.pas',
|
X2Log.Client.NamedPipe in '..\X2Log.Client.NamedPipe.pas',
|
||||||
X2Log.Client.Base in '..\X2Log.Client.Base.pas';
|
X2Log.Client.Base in '..\X2Log.Client.Base.pas',
|
||||||
|
X2Log.Registry.NamedPipe in '..\X2Log.Registry.NamedPipe.pas';
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@
|
|||||||
<DCCReference Include="..\X2Log.Global.pas"/>
|
<DCCReference Include="..\X2Log.Global.pas"/>
|
||||||
<DCCReference Include="..\X2Log.Client.NamedPipe.pas"/>
|
<DCCReference Include="..\X2Log.Client.NamedPipe.pas"/>
|
||||||
<DCCReference Include="..\X2Log.Client.Base.pas"/>
|
<DCCReference Include="..\X2Log.Client.Base.pas"/>
|
||||||
|
<DCCReference Include="..\X2Log.Registry.NamedPipe.pas"/>
|
||||||
<BuildConfiguration Include="Debug">
|
<BuildConfiguration Include="Debug">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
|
@ -32,6 +32,10 @@ object MainForm: TMainForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object tsEvent: TTabSheet
|
object tsEvent: TTabSheet
|
||||||
Caption = 'Event Observer '
|
Caption = 'Event Observer '
|
||||||
|
ExplicitLeft = 0
|
||||||
|
ExplicitTop = 0
|
||||||
|
ExplicitWidth = 0
|
||||||
|
ExplicitHeight = 0
|
||||||
object mmoEvent: TMemo
|
object mmoEvent: TMemo
|
||||||
AlignWithMargins = True
|
AlignWithMargins = True
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -69,8 +73,6 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object tsFile: TTabSheet
|
object tsFile: TTabSheet
|
||||||
Caption = 'File Observer'
|
Caption = 'File Observer'
|
||||||
ExplicitLeft = -108
|
|
||||||
ExplicitTop = -5
|
|
||||||
object lblFilename: TLabel
|
object lblFilename: TLabel
|
||||||
Left = 12
|
Left = 12
|
||||||
Top = 64
|
Top = 64
|
||||||
@ -135,6 +137,8 @@ object MainForm: TMainForm
|
|||||||
Caption = 'Named Pipe Observer'
|
Caption = 'Named Pipe Observer'
|
||||||
ExplicitLeft = 0
|
ExplicitLeft = 0
|
||||||
ExplicitTop = 30
|
ExplicitTop = 30
|
||||||
|
ExplicitWidth = 0
|
||||||
|
ExplicitHeight = 0
|
||||||
object lblPipeName: TLabel
|
object lblPipeName: TLabel
|
||||||
Left = 12
|
Left = 12
|
||||||
Top = 64
|
Top = 64
|
||||||
@ -313,7 +317,7 @@ object MainForm: TMainForm
|
|||||||
Left = 552
|
Left = 552
|
||||||
Top = 176
|
Top = 176
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
494C01010200140020000C000C00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
494C01010200140024000C000C00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
||||||
0000000000003600000028000000300000000C00000001002000000000000009
|
0000000000003600000028000000300000000C00000001002000000000000009
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
@ -70,7 +70,6 @@ const
|
|||||||
ClearBufferTreshold = 4096;
|
ClearBufferTreshold = 4096;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TX2LogNamedPipeClient }
|
{ TX2LogNamedPipeClient }
|
||||||
constructor TX2LogNamedPipeClient.Create(const APipeName: string);
|
constructor TX2LogNamedPipeClient.Create(const APipeName: string);
|
||||||
begin
|
begin
|
||||||
|
@ -8,6 +8,12 @@ type
|
|||||||
TX2LogLevel = (Verbose, Info, Warning, Error);
|
TX2LogLevel = (Verbose, Info, Warning, Error);
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
X2LogLevelsAll = [Low(TX2LogLevel)..High(TX2LogLevel)];
|
||||||
|
X2LogLevelsDefault = X2LogLevelsAll - [Verbose];
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
IX2LogBase = interface
|
IX2LogBase = interface
|
||||||
['{1949E8DC-6DC5-43DC-B678-55CF8274E79D}']
|
['{1949E8DC-6DC5-43DC-B678-55CF8274E79D}']
|
||||||
procedure Log(ALevel: TX2LogLevel; const AMessage: string; const ADetails: string = '');
|
procedure Log(ALevel: TX2LogLevel; const AMessage: string; const ADetails: string = '');
|
||||||
|
@ -8,10 +8,6 @@ uses
|
|||||||
X2Log.Intf;
|
X2Log.Intf;
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
X2LogLevelsAll = [Low(TX2LogLevel)..High(TX2LogLevel)];
|
|
||||||
X2LogLevelsDefault = X2LogLevelsAll - [Verbose];
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TX2LogLevels = set of TX2LogLevel;
|
TX2LogLevels = set of TX2LogLevel;
|
||||||
|
|
||||||
|
@ -86,6 +86,18 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ Someone went through a lot of trouble to win at Scrabble... }
|
||||||
|
function ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptor: PWideChar;
|
||||||
|
StringSDRevision: DWORD;
|
||||||
|
SecurityDescriptor: PSECURITY_DESCRIPTOR;
|
||||||
|
SecurityDescriptorSize: PULONG): BOOL; stdcall; external advapi32;
|
||||||
|
|
||||||
|
const
|
||||||
|
SDDL_REVISION_1 = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TX2LogNamedPipeObserver }
|
{ TX2LogNamedPipeObserver }
|
||||||
constructor TX2LogNamedPipeObserver.Create(const APipeName: string; ALogLevels: TX2LogLevels);
|
constructor TX2LogNamedPipeObserver.Create(const APipeName: string; ALogLevels: TX2LogLevels);
|
||||||
begin
|
begin
|
||||||
@ -129,6 +141,8 @@ end;
|
|||||||
|
|
||||||
procedure TX2LogNamedPipeClient.Send(AEntry: TX2LogQueueEntry);
|
procedure TX2LogNamedPipeClient.Send(AEntry: TX2LogQueueEntry);
|
||||||
begin
|
begin
|
||||||
|
OutputDebugString(PChar(AEntry.Message));
|
||||||
|
|
||||||
if not Assigned(WriteBuffer) then
|
if not Assigned(WriteBuffer) then
|
||||||
DoSend(AEntry)
|
DoSend(AEntry)
|
||||||
else
|
else
|
||||||
@ -378,13 +392,43 @@ const
|
|||||||
DefaultTimeout = 5000;
|
DefaultTimeout = 5000;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
security: TSecurityAttributes;
|
||||||
pipe: THandle;
|
pipe: THandle;
|
||||||
client: TX2LogNamedPipeClient;
|
client: TX2LogNamedPipeClient;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
pipe := CreateNamedPipe(PChar('\\.\pipe\' + PipeName), PIPE_ACCESS_OUTBOUND or FILE_FLAG_OVERLAPPED,
|
FillChar(security, SizeOf(security), 0);
|
||||||
PIPE_TYPE_MESSAGE or PIPE_READMODE_MESSAGE or PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
|
security.nLength := SizeOf(security);
|
||||||
BufferSize, BufferSize, DefaultTimeout, nil);
|
security.bInheritHandle := False;
|
||||||
|
|
||||||
|
{ Thanks to: http://www.osronline.com/showthread.cfm?link=204207
|
||||||
|
and: http://www.netid.washington.edu/documentation/domains/sddl.aspx
|
||||||
|
|
||||||
|
0x12018d =
|
||||||
|
0x00100000 - SYNCHRONIZE
|
||||||
|
0x00020000 - READ_CONTROL
|
||||||
|
0x00000100 - FILE_WRITE_ATTRIBUTES
|
||||||
|
0x00000080 - FILE_READ_ATTRIBUTES
|
||||||
|
0x00000008 - FILE_READ_EA
|
||||||
|
0x00000004 - FILE_CREATE_PIPE_INSTANCE
|
||||||
|
0x00000001 - FILE_READ_DATA }
|
||||||
|
if ConvertStringSecurityDescriptorToSecurityDescriptorW('D:' + // Discretionary ACL
|
||||||
|
'(D;;FA;;;NU)' + // Deny file all access (FA) to network user access (NU)
|
||||||
|
'(A;;0x12018d;;;WD)' + // Allow specific permissions for everyone (WD)
|
||||||
|
'(A;;0x12018d;;;CO)', // Allow specific permissions for creator owner (CO)
|
||||||
|
SDDL_REVISION_1,
|
||||||
|
@security.lpSecurityDescriptor,
|
||||||
|
nil) then
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
pipe := CreateNamedPipe(PChar('\\.\pipe\' + PipeName), PIPE_ACCESS_OUTBOUND or FILE_FLAG_OVERLAPPED,
|
||||||
|
PIPE_TYPE_MESSAGE or PIPE_READMODE_MESSAGE or PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
|
||||||
|
BufferSize, BufferSize, DefaultTimeout, @security);
|
||||||
|
finally
|
||||||
|
LocalFree(HLOCAL(security.lpSecurityDescriptor));
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
RaiseLastOSError;
|
||||||
|
|
||||||
if pipe <> INVALID_HANDLE_VALUE then
|
if pipe <> INVALID_HANDLE_VALUE then
|
||||||
begin
|
begin
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
<Projects Include="NamedPipeClient\X2LogNamedPipeClient.dproj">
|
<Projects Include="NamedPipeClient\X2LogNamedPipeClient.dproj">
|
||||||
<Dependencies/>
|
<Dependencies/>
|
||||||
</Projects>
|
</Projects>
|
||||||
|
<Projects Include="ServiceTest\X2LogServiceTest.dproj">
|
||||||
|
<Dependencies/>
|
||||||
|
</Projects>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||||
@ -35,14 +38,23 @@
|
|||||||
<Target Name="X2LogNamedPipeClient:Make">
|
<Target Name="X2LogNamedPipeClient:Make">
|
||||||
<MSBuild Projects="NamedPipeClient\X2LogNamedPipeClient.dproj" Targets="Make"/>
|
<MSBuild Projects="NamedPipeClient\X2LogNamedPipeClient.dproj" Targets="Make"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
<Target Name="X2LogServiceTest">
|
||||||
|
<MSBuild Projects="ServiceTest\X2LogServiceTest.dproj"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="X2LogServiceTest:Clean">
|
||||||
|
<MSBuild Projects="ServiceTest\X2LogServiceTest.dproj" Targets="Clean"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="X2LogServiceTest:Make">
|
||||||
|
<MSBuild Projects="ServiceTest\X2LogServiceTest.dproj" Targets="Make"/>
|
||||||
|
</Target>
|
||||||
<Target Name="Build">
|
<Target Name="Build">
|
||||||
<CallTarget Targets="X2LogTest;X2LogNamedPipeClient"/>
|
<CallTarget Targets="X2LogTest;X2LogNamedPipeClient;X2LogServiceTest"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="Clean">
|
<Target Name="Clean">
|
||||||
<CallTarget Targets="X2LogTest:Clean;X2LogNamedPipeClient:Clean"/>
|
<CallTarget Targets="X2LogTest:Clean;X2LogNamedPipeClient:Clean;X2LogServiceTest:Clean"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="Make">
|
<Target Name="Make">
|
||||||
<CallTarget Targets="X2LogTest:Make;X2LogNamedPipeClient:Make"/>
|
<CallTarget Targets="X2LogTest:Make;X2LogNamedPipeClient:Make;X2LogServiceTest:Make"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')" Project="$(BDS)\Bin\CodeGear.Group.Targets"/>
|
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')" Project="$(BDS)\Bin\CodeGear.Group.Targets"/>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user