Subversion Repositories simple_log_event

Compare Revisions

No changes between revisions

Regard whitespace Rev 5 → Rev 6

/trunk/Setup/DllRes.RES
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Setup/DllResCompile.bat
1,5 → 1,7
@echo on
@echo on^
 
del DllRes.RES
 
rem RC => RES
rc DllRes.rc
 
/trunk/Setup/SimpleLogEventSetup.dproj
56,17 → 56,18
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<VerInfo_Locale>1031</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=ViaThinkSoft;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=(C) 2020 Daniel Marschall, ViaThinkSoft;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=www.viathinksoft.com</VerInfo_Keys>
<SanitizedProjectName>SimpleLogEventSetup</SanitizedProjectName>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;RESTComponents;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;svnui;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;FireDAC;vcltouch;vcldb;bindcompfmx;svn;FireDACSqliteDriver;FireDACPgDriver;inetdb;soaprtl;DbxCommonDriver;fmx;FireDACIBDriver;fmxdae;xmlrtl;soapmidas;fmxobj;vclwinx;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;SynEditDR;bindcomp;appanalytics;dsnap;FireDACCommon;IndyIPClient;bindcompvcl;RESTBackendComponents;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;CloudService;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;FireDACCommonDriver;inet;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<Icon_MainIcon>SimpleLogEventSetup_Icon.ico</Icon_MainIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;RESTComponents;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;FireDAC;vcltouch;vcldb;bindcompfmx;FireDACSqliteDriver;FireDACPgDriver;inetdb;soaprtl;DbxCommonDriver;fmx;FireDACIBDriver;fmxdae;xmlrtl;soapmidas;fmxobj;vclwinx;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;SynEditDR;bindcomp;appanalytics;dsnap;FireDACCommon;IndyIPClient;bindcompvcl;RESTBackendComponents;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;CloudService;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;FireDACCommonDriver;inet;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
95,6 → 96,9
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=ViaThinkSoft;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=(C) 2020 Daniel Marschall, ViaThinkSoft;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=www.viathinksoft.com</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
/trunk/Setup/SimpleLogEventSetup.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Setup/SimpleLogEventSetup.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Setup/SimpleLogEventSetup_Icon.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/TLB/ViaThinkSoftSimpleLogEvent.dproj
9,7 → 9,7
<ProjectVersion>18.8</ProjectVersion>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Library</AppType>
</PropertyGroup>
31,6 → 31,12
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
52,8 → 58,9
<GenDll>true</GenDll>
<SanitizedProjectName>ViaThinkSoftSimpleLogEvent</SanitizedProjectName>
<VerInfo_Locale>1031</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=ViaThinkSoft;FileDescription=ViaThinkSoft Simple Log Event DLL;FileVersion=1.0.0.0;InternalName=;LegalCopyright=(C) 2020 Daniel Marschall, ViaThinkSoft;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=www.viathinksoft.com</VerInfo_Keys>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;System.Win;Winapi;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
84,6 → 91,12
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Version>7.0</Version>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
/trunk/TLB/ViaThinkSoftSimpleLogEvent.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/TLB/ViaThinkSoftSimpleLogEvent.ridl
6,7 → 6,7
// Änderungen. Wenn Sie aber Änderungen mit dem Editor vornehmen, wird diese
// Datei neu erzeugt und Kommentare oder Formatänderungen gehen verloren.
// ************************************************************************ //
// Datei erzeugt am 30.04.2020 23:03:28 (- $Rev: 12980 $, 10609955).
// Datei erzeugt am 03.05.2020 21:20:06 (- $Rev: 12980 $, 10716816).
 
[
uuid(D7654BA7-41D0-4FF9-8543-C3A4DA936856),
45,6 → 45,8
{
[id(0x000000C9)]
HRESULT _stdcall LogEvent([in] BSTR SourceName, [in] enum LogEventType EventType, [in] BSTR LogMsg);
[id(0x000000CA)]
HRESULT _stdcall LogSimulate([in] BSTR SourceName, [in] enum LogEventType EventType, [in] BSTR LogMsg, [out] VARIANT* Reason);
};
 
[
/trunk/TLB/ViaThinkSoftSimpleLogEvent.tlb
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/TLB/ViaThinkSoftSimpleLogEvent32.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/TLB/ViaThinkSoftSimpleLogEvent64.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/TLB/ViaThinkSoftSimpleLogEvent_Impl.pas
12,11 → 12,13
protected
procedure LogEvent(const SourceName: WideString; EventType: LogEventType; const LogMsg: WideString);
safecall;
procedure LogSimulate(const SourceName: WideString; EventType: LogEventType; const LogMsg: WideString;
out Reason: OleVariant); safecall;
end;
 
implementation
 
uses ComServ, Windows;
uses ComServ, Windows, SysUtils;
 
const
MSG_SUCCESS = $20000000;
24,17 → 26,20
MSG_WARNING = $A0000002;
MSG_ERROR = $E0000003;
 
function WriteEventLog(AProvider: string; AEventType: word; AEventId: Cardinal; AEntry: string): boolean;
procedure WriteEventLog(AProvider: string; AEventType: word; AEventId: Cardinal; AEntry: string);
var
EventLog: integer;
EventLog: THandle;
P: Pointer;
begin
Result := False;
P := PChar(AEntry);
EventLog := RegisterEventSource(nil, PChar(AProvider));
if EventLog = 0 then
begin
raise Exception.CreateFmt('RegisterEventSource failed with error code %d', [GetLastError]);
end;
if EventLog <> 0 then
try
ReportEvent(EventLog, // event log handle
if not ReportEvent(EventLog, // event log handle
AEventType, // event type
0, // category zero
AEventId, // event identifier
42,8 → 47,10
1, // one substitution string
0, // no data
@P, // pointer to string array
nil); // pointer to data
Result := True;
nil) then // pointer to data
begin
raise Exception.CreateFmt('ReportEvent failed with error code %d', [GetLastError]);
end;
finally
DeregisterEventSource(EventLog);
end;
61,9 → 68,44
WriteEventLog(SourceName, EVENTLOG_WARNING_TYPE, MSG_WARNING, LogMsg);
ViaThinkSoftSimpleLogEvent_TLB.Error:
WriteEventLog(SourceName, EVENTLOG_ERROR_TYPE, MSG_ERROR, LogMsg);
else
begin
raise Exception.CreateFmt('ViaThinkSoftSimpleEventLog.LogEvent: Unexpected event type %d', [Ord(EventType)]);
end;
end;
end;
 
procedure TViaThinkSoftSimpleEventLog.LogSimulate(const SourceName: WideString; EventType: LogEventType;
const LogMsg: WideString; out Reason: OleVariant);
var
EventLog: THandle;
begin
try
Reason := '';
if (EventType < 0) or (EventType > ViaThinkSoftSimpleLogEvent_TLB.Error) then
begin
Reason := Format('Unexpected event type %d', [Ord(EventType)]);
Exit;
end;
 
EventLog := RegisterEventSource(nil, PChar(SourceName));
if EventLog = 0 then
begin
Reason := Format('RegisterEventSource failed with error code %d', [GetLastError]);
Exit;
end
else
begin
DeregisterEventSource(EventLog);
end;
except
on E: Exception do
begin
Reason := Format('Unexpected error: %s', [e.Message]);
end;
end;
end;
 
initialization
TAutoObjectFactory.Create(ComServer, TViaThinkSoftSimpleEventLog, Class_ViaThinkSoftSimpleEventLog,
ciMultiInstance, tmApartment);
/trunk/TLB/ViaThinkSoftSimpleLogEvent_TLB.pas
12,7 → 12,7
// ************************************************************************ //
 
// $Rev: 52393 $
// Datei am 30.04.2020 23:02:59 erzeugt aus der unten beschriebenen Typbibliothek.
// Datei am 03.05.2020 21:20:05 erzeugt aus der unten beschriebenen Typbibliothek.
 
// ************************************************************************ //
// Typbib.: C:\Users\DELL User\SVN\SimpleLogEvent\trunk\TLB\ViaThinkSoftSimpleLogEvent (1)
87,6 → 87,8
['{4094657E-8199-460F-A3DD-5BB63B6B0F65}']
procedure LogEvent(const SourceName: WideString; EventType: LogEventType;
const LogMsg: WideString); safecall;
procedure LogSimulate(const SourceName: WideString; EventType: LogEventType;
const LogMsg: WideString; out Reason: OleVariant); safecall;
end;
 
// *********************************************************************//
98,6 → 100,8
['{4094657E-8199-460F-A3DD-5BB63B6B0F65}']
procedure LogEvent(const SourceName: WideString; EventType: LogEventType;
const LogMsg: WideString); dispid 201;
procedure LogSimulate(const SourceName: WideString; EventType: LogEventType;
const LogMsg: WideString; out Reason: OleVariant); dispid 202;
end;
 
// *********************************************************************//