Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog.Tests", "tests\System.Diagnostics.EventLog.Tests.csproj", "{5B218883-369E-4C3D-8BD0-74843474DCBD}"
ProjectSection(ProjectDependencies) = postProject
{432779B9-3CBD-4871-A7DC-D8A192319DBD} = {432779B9-3CBD-4871-A7DC-D8A192319DBD}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog", "src\System.Diagnostics.EventLog.csproj", "{432779B9-3CBD-4871-A7DC-D8A192319DBD}"
ProjectSection(ProjectDependencies) = postProject
{F405C42E-EF6F-4404-80FD-3B87E216707C} = {F405C42E-EF6F-4404-80FD-3B87E216707C}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog", "ref\System.Diagnostics.EventLog.csproj", "{F405C42E-EF6F-4404-80FD-3B87E216707C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5B218883-369E-4C3D-8BD0-74843474DCBD}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{5B218883-369E-4C3D-8BD0-74843474DCBD}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{5B218883-369E-4C3D-8BD0-74843474DCBD}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{5B218883-369E-4C3D-8BD0-74843474DCBD}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{432779B9-3CBD-4871-A7DC-D8A192319DBD}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{432779B9-3CBD-4871-A7DC-D8A192319DBD}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{432779B9-3CBD-4871-A7DC-D8A192319DBD}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{432779B9-3CBD-4871-A7DC-D8A192319DBD}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{F405C42E-EF6F-4404-80FD-3B87E216707C}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{F405C42E-EF6F-4404-80FD-3B87E216707C}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{F405C42E-EF6F-4404-80FD-3B87E216707C}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{F405C42E-EF6F-4404-80FD-3B87E216707C}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5B218883-369E-4C3D-8BD0-74843474DCBD} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{432779B9-3CBD-4871-A7DC-D8A192319DBD} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
{F405C42E-EF6F-4404-80FD-3B87E216707C} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyKey>Open</AssemblyKey>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netfx;
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,186 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
public partial class EntryWrittenEventArgs : System.EventArgs
{
public EntryWrittenEventArgs() { }
public EntryWrittenEventArgs(System.Diagnostics.EventLogEntry entry) { }
public System.Diagnostics.EventLogEntry Entry { get { throw null; } }
}
public delegate void EntryWrittenEventHandler(object sender, System.Diagnostics.EntryWrittenEventArgs e);
public partial class EventInstance
{
public EventInstance(long instanceId, int categoryId) { }
public EventInstance(long instanceId, int categoryId, System.Diagnostics.EventLogEntryType entryType) { }
public int CategoryId { get { throw null; } set { } }
public System.Diagnostics.EventLogEntryType EntryType { get { throw null; } set { } }
public long InstanceId { get { throw null; } set { } }
}
[System.ComponentModel.DefaultEventAttribute("EntryWritten")]
[System.Diagnostics.MonitoringDescriptionAttribute("Provides interaction with Windows event logs.")]
public partial class EventLog : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize
{
public EventLog() { }
public EventLog(string logName) { }
public EventLog(string logName, string machineName) { }
public EventLog(string logName, string machineName, string source) { }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DefaultValueAttribute(false)]
[System.Diagnostics.MonitoringDescriptionAttribute("Indicates if the component monitors the event log for changes.")]
public bool EnableRaisingEvents { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
[System.Diagnostics.MonitoringDescriptionAttribute("The contents of the log.")]
public System.Diagnostics.EventLogEntryCollection Entries { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute("")]
[System.ComponentModel.ReadOnlyAttribute(true)]
[System.ComponentModel.SettingsBindableAttribute(true)]
[System.Diagnostics.MonitoringDescriptionAttribute("Gets or sets the name of the log to read from and write to.")]
public string Log { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
public string LogDisplayName { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute(".")]
[System.ComponentModel.ReadOnlyAttribute(true)]
[System.ComponentModel.SettingsBindableAttribute(true)]
[System.Diagnostics.MonitoringDescriptionAttribute("The machine on which this event log resides.")]
public string MachineName { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))]
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public long MaximumKilobytes { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public int MinimumRetentionDays { get { throw null; } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public System.Diagnostics.OverflowAction OverflowAction { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute("")]
[System.ComponentModel.ReadOnlyAttribute(true)]
[System.ComponentModel.SettingsBindableAttribute(true)]
[System.Diagnostics.MonitoringDescriptionAttribute("The application name (source name) to use when writing to the event log.")]
public string Source { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DefaultValueAttribute(null)]
[System.Diagnostics.MonitoringDescriptionAttribute("The object used to marshal the event handler calls issued as a result of an EventLog change.")]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Synchronization=true)]get { throw null; } set { } }
[System.Diagnostics.MonitoringDescriptionAttribute("Raised each time any application writes an entry to the event log.")]
public event System.Diagnostics.EntryWrittenEventHandler EntryWritten { add { } remove { } }
public void BeginInit() { }
public void Clear() { }
public void Close() { }
public static void CreateEventSource(System.Diagnostics.EventSourceCreationData sourceData) { }
public static void CreateEventSource(string source, string logName) { }
[System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static void CreateEventSource(string source, string logName, string machineName) { }
public static void Delete(string logName) { }
public static void Delete(string logName, string machineName) { }
public static void DeleteEventSource(string source) { }
public static void DeleteEventSource(string source, string machineName) { }
protected override void Dispose(bool disposing) { }
public void EndInit() { }
public static bool Exists(string logName) { throw null; }
public static bool Exists(string logName, string machineName) { throw null; }
public static System.Diagnostics.EventLog[] GetEventLogs() { throw null; }
public static System.Diagnostics.EventLog[] GetEventLogs(string machineName) { throw null; }
public static string LogNameFromSourceName(string source, string machineName) { throw null; }
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public void ModifyOverflowPolicy(System.Diagnostics.OverflowAction action, int retentionDays) { }
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public void RegisterDisplayName(string resourceFile, long resourceId) { }
public static bool SourceExists(string source) { throw null; }
public static bool SourceExists(string source, string machineName) { throw null; }
public void WriteEntry(string message) { }
public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type) { }
public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID) { }
public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID, short category) { }
public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID, short category, byte[] rawData) { }
public static void WriteEntry(string source, string message) { }
public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type) { }
public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID) { }
public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID, short category) { }
public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID, short category, byte[] rawData) { }
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public void WriteEvent(System.Diagnostics.EventInstance instance, byte[] data, params object[] values) { }
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public void WriteEvent(System.Diagnostics.EventInstance instance, params object[] values) { }
public static void WriteEvent(string source, System.Diagnostics.EventInstance instance, byte[] data, params object[] values) { }
public static void WriteEvent(string source, System.Diagnostics.EventInstance instance, params object[] values) { }
}
[System.ComponentModel.DesignTimeVisibleAttribute(false)]
[System.ComponentModel.ToolboxItemAttribute(false)]
public sealed partial class EventLogEntry : System.ComponentModel.Component, System.Runtime.Serialization.ISerializable
{
internal EventLogEntry() { }
[System.Diagnostics.MonitoringDescriptionAttribute("The category for this message.")]
public string Category { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("An application-specific category number assigned to this entry.")]
public short CategoryNumber { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The binary data associated with this entry in the event log.")]
public byte[] Data { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The type of entry - Information, Warning, etc.")]
public System.Diagnostics.EventLogEntryType EntryType { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The number identifying the message for this source.")]
[System.ObsoleteAttribute("This property has been deprecated. Please use System.Diagnostics.EventLogEntry.InstanceId instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public int EventID { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The sequence of this entry in the event log.")]
public int Index { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The full number identifying the message in the event message dll.")]
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
public long InstanceId { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The machine on which this event log resides.")]
public string MachineName { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The text of the message for this entry.")]
public string Message { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The application-supplied strings used in the message.")]
public string[] ReplacementStrings { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The name of the application that wrote this entry.")]
public string Source { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The time at which the application logged this entry.")]
public System.DateTime TimeGenerated { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The time at which the system logged this entry to the event log.")]
public System.DateTime TimeWritten { get { throw null; } }
[System.Diagnostics.MonitoringDescriptionAttribute("The username of the account associated with this entry by the writing application.")]
public string UserName { get { throw null; } }
public bool Equals(System.Diagnostics.EventLogEntry otherEntry) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class EventLogEntryCollection : System.Collections.ICollection, System.Collections.IEnumerable
{
internal EventLogEntryCollection() { }
public int Count { get { throw null; } }
public virtual System.Diagnostics.EventLogEntry this[int index] { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void CopyTo(System.Diagnostics.EventLogEntry[] entries, int index) { }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
}
public enum EventLogEntryType
{
Error = 1,
FailureAudit = 16,
Information = 4,
SuccessAudit = 8,
Warning = 2,
}
public partial class EventSourceCreationData
{
public EventSourceCreationData(string source, string logName) { }
public int CategoryCount { get { throw null; } set { } }
public string CategoryResourceFile { get { throw null; } set { } }
public string LogName { get { throw null; } set { } }
public string MachineName { get { throw null; } set { } }
public string MessageResourceFile { get { throw null; } set { } }
public string ParameterResourceFile { get { throw null; } set { } }
public string Source { get { throw null; } set { } }
}
public enum OverflowAction
{
DoNotOverwrite = -1,
OverwriteAsNeeded = 0,
OverwriteOlder = 1,
}
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<ProjectGuid>{F405C42E-EF6F-4404-80FD-3B87E216707C}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Diagnostics.EventLog.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
<Reference Include="System" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp-Windows_NT;
netfx;
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,7 @@
advapi32.dll!ClearEventLog
advapi32.dll!CloseEventLog
advapi32.dll!GetNumberOfEventLogRecords
advapi32.dll!GetOldestEventLogRecord
advapi32.dll!NotifyChangeEventLog
advapi32.dll!OpenEventLog
advapi32.dll!ReadEventLog

View File

@@ -0,0 +1,312 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="EventLogDesc" xml:space="preserve">
<value>Provides interaction with Windows event logs.</value>
</data>
<data name="LogEntries" xml:space="preserve">
<value>The contents of the log.</value>
</data>
<data name="LogEntryCategory" xml:space="preserve">
<value>The category for this message.</value>
</data>
<data name="LogEntryCategoryNumber" xml:space="preserve">
<value>An application-specific category number assigned to this entry.</value>
</data>
<data name="LogEntryData" xml:space="preserve">
<value>The binary data associated with this entry in the event log.</value>
</data>
<data name="LogEntryEntryType" xml:space="preserve">
<value>The type of entry - Information, Warning, etc.</value>
</data>
<data name="LogEntryEventID" xml:space="preserve">
<value>The number identifying the message for this source.</value>
</data>
<data name="LogEntryIndex" xml:space="preserve">
<value>The sequence of this entry in the event log.</value>
</data>
<data name="LogEntryMachineName" xml:space="preserve">
<value>The machine on which this event log resides.</value>
</data>
<data name="LogEntryMessage" xml:space="preserve">
<value>The text of the message for this entry.</value>
</data>
<data name="LogEntryReplacementStrings" xml:space="preserve">
<value>The application-supplied strings used in the message.</value>
</data>
<data name="LogEntryResourceId" xml:space="preserve">
<value>The full number identifying the message in the event message dll.</value>
</data>
<data name="LogEntrySource" xml:space="preserve">
<value>The name of the application that wrote this entry.</value>
</data>
<data name="LogEntryTimeGenerated" xml:space="preserve">
<value>The time at which the application logged this entry.</value>
</data>
<data name="LogEntryTimeWritten" xml:space="preserve">
<value>The time at which the system logged this entry to the event log.</value>
</data>
<data name="LogEntryUserName" xml:space="preserve">
<value>The username of the account associated with this entry by the writing application.</value>
</data>
<data name="LogEntryWritten" xml:space="preserve">
<value>Raised each time any application writes an entry to the event log.</value>
</data>
<data name="LogLog" xml:space="preserve">
<value>Gets or sets the name of the log to read from and write to.</value>
</data>
<data name="LogMonitoring" xml:space="preserve">
<value>Indicates if the component monitors the event log for changes.</value>
</data>
<data name="LogSource" xml:space="preserve">
<value>The application name (source name) to use when writing to the event log.</value>
</data>
<data name="LogSynchronizingObject" xml:space="preserve">
<value>The object used to marshal the event handler calls issued as a result of an EventLog change.</value>
</data>
<data name="LogMachineName" xml:space="preserve">
<value>The name of the machine on which to read or write events.</value>
</data>
<data name="BadLogName" xml:space="preserve">
<value>Event log names must consist of printable characters and cannot contain \\, *, ?, or spaces</value>
</data>
<data name="CannotDeleteEqualSource" xml:space="preserve">
<value>The event log source '{0}' cannot be deleted, because it's equal to the log name.</value>
</data>
<data name="CantMonitorEventLog" xml:space="preserve">
<value>Cannot monitor EntryWritten events for this EventLog. This might be because the EventLog is on a remote machine which is not a supported scenario.</value>
</data>
<data name="CantOpenLog" xml:space="preserve">
<value>Cannot open log {0} on computer '{1}'. {2}</value>
</data>
<data name="CantOpenLogAccess" xml:space="preserve">
<value>Cannot open log for source '{0}'. You may not have write access.</value>
</data>
<data name="CantReadLogEntryAt" xml:space="preserve">
<value>Cannot read log entry number {0}. The event log may be corrupt.</value>
</data>
<data name="CantRetrieveEntries" xml:space="preserve">
<value>Cannot retrieve all entries.</value>
</data>
<data name="DuplicateLogName" xml:space="preserve">
<value>Only the first eight characters of a custom log name are significant, and there is already another log on the system using the first eight characters of the name given. Name given: '{0}', name of existing log: '{1}'.</value>
</data>
<data name="EventID" xml:space="preserve">
<value>Invalid eventID value '{0}'. It must be in the range between '{1}' and '{2}'.</value>
</data>
<data name="IndexOutOfBounds" xml:space="preserve">
<value>Index {0} is out of bounds.</value>
</data>
<data name="InitTwice" xml:space="preserve">
<value>Cannot initialize the same object twice.</value>
</data>
<data name="InvalidCustomerLogName" xml:space="preserve">
<value>The log name: '{0}' is invalid for customer log creation.</value>
</data>
<data name="InvalidParameter" xml:space="preserve">
<value>Invalid value '{1}' for parameter '{0}'.</value>
</data>
<data name="InvalidParameterFormat" xml:space="preserve">
<value>Invalid format for argument {0}.</value>
</data>
<data name="LocalLogAlreadyExistsAsSource" xml:space="preserve">
<value>Log {0} has already been registered as a source on the local computer.</value>
</data>
<data name="LocalRegKeyMissing" xml:space="preserve">
<value>Cannot open registry key {0}\\{1}\\{2}.</value>
</data>
<data name="LocalSourceAlreadyExists" xml:space="preserve">
<value>Source {0} already exists on the computer '{1}'.</value>
</data>
<data name="LocalSourceNotRegistered" xml:space="preserve">
<value>Source {0} is not registered on the local computer.</value>
</data>
<data name="LogDoesNotExists" xml:space="preserve">
<value>The event log '{0}' on computer '{1}' does not exist.</value>
</data>
<data name="LogEntryTooLong" xml:space="preserve">
<value>Log entry string is too long. A string written to the event log cannot exceed 32766 characters.</value>
</data>
<data name="LogSourceMismatch" xml:space="preserve">
<value>The source '{0}' is not registered in log '{1}'. (It is registered in log '{2}'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.NoAccountInfo=Cannot obtain account information.</value>
</data>
<data name="MaximumKilobytesOutOfRange" xml:space="preserve">
<value>MaximumKilobytes must be between 64 KB and 4 GB, and must be in 64K increments.</value>
</data>
<data name="MessageNotFormatted" xml:space="preserve">
<value>The description for Event ID '{0}' in Source '{1}' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:</value>
</data>
<data name="MissingLog" xml:space="preserve">
<value>Cannot find Log {0} on computer '{1}'.</value>
</data>
<data name="MissingLogProperty" xml:space="preserve">
<value>Log property value has not been specified.</value>
</data>
<data name="MissingParameter" xml:space="preserve">
<value>Must specify value for {0}.</value>
</data>
<data name="NeedSourceToOpen" xml:space="preserve">
<value>Source property was not set before opening the event log in write mode.</value>
</data>
<data name="NeedSourceToWrite" xml:space="preserve">
<value>Source property was not set before writing to the event log.</value>
</data>
<data name="NoCurrentEntry" xml:space="preserve">
<value>No current EventLog entry available, cursor is located before the first or after the last element of the enumeration.</value>
</data>
<data name="NoLogName" xml:space="preserve">
<value>Log to delete was not specified.</value>
</data>
<data name="ParameterTooLong" xml:space="preserve">
<value>The size of {0} is too big. It cannot be longer than {1} characters.</value>
</data>
<data name="PlatformNotSupported_EventLog" xml:space="preserve">
<value>EventLog access is not supported on this platform.</value>
</data>
<data name="RegKeyMissing" xml:space="preserve">
<value>Cannot open registry key {0}\\{1}\\{2} on computer '{3}'.</value>
</data>
<data name="RegKeyMissingShort" xml:space="preserve">
<value>Cannot open registry key {0} on computer {1}.</value>
</data>
<data name="RegKeyNoAccess" xml:space="preserve">
<value>Cannot open registry key {0} on computer {1}. You might not have access.</value>
</data>
<data name="RentionDaysOutOfRange" xml:space="preserve">
<value>'retentionDays' must be between 1 and 365 days.</value>
</data>
<data name="SomeLogsInaccessible" xml:space="preserve">
<value>The source was not found, but some or all event logs could not be searched. Inaccessible logs: {0}.</value>
</data>
<data name="SomeLogsInaccessibleToCreate" xml:space="preserve">
<value>The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: {0}.</value>
</data>
<data name="SourceAlreadyExists" xml:space="preserve">
<value>Source {0} already exists on the computer '{1}'.</value>
</data>
<data name="SourceNotRegistered" xml:space="preserve">
<value>The source '{0}' is not registered on machine '{1}', or you do not have write access to the {2} registry key.</value>
</data>
<data name="TooManyReplacementStrings" xml:space="preserve">
<value>The maximum allowed number of replacement strings is 255.</value>
</data>
<data name="LogAlreadyExistsAsSource" xml:space="preserve">
<value>Log {0} has already been registered as a source on the local computer.</value>
</data>
</root>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' == 'netstandard'">SR.PlatformNotSupported_EventLog</GeneratePlatformNotSupportedAssemblyMessage>
<!-- Although we have a netstandard configuration, we know we are not currently UAP compatible-->
<UWPCompatible>false</UWPCompatible>
<ProjectGuid>{432779B9-3CBD-4871-A7DC-D8A192319DBD}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System\Diagnostics\CompModSwitches.cs" />
<Compile Include="System\Diagnostics\EntryWrittenEventArgs.cs" />
<Compile Include="System\Diagnostics\EntryWrittenEventHandler.cs" />
<Compile Include="System\Diagnostics\EventData.cs" />
<Compile Include="System\Diagnostics\EventLog.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="System\Diagnostics\EventLogEntry.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="System\Diagnostics\EventLogEntryCollection.cs" />
<Compile Include="System\Diagnostics\EventLogEntryType.cs" />
<Compile Include="System\Diagnostics\EventLogInternal.cs" />
<Compile Include="System\Diagnostics\EventSourceCreationData.cs" />
<Compile Include="System\Diagnostics\NativeMethods.cs" />
<Compile Include="System\Diagnostics\OverflowAction.cs" />
<Compile Include="System\Diagnostics\SafeEventLogReadHandle.cs" />
<Compile Include="System\Diagnostics\SafeEventLogWriteHandle.cs" />
<Compile Include="System\Diagnostics\SharedUtils.cs" />
<Compile Include="System\Diagnostics\UnsafeNativeMethods.cs" />
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.CloseHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.CloseHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FormatMessage_SafeLibraryHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.FormatMessage_SafeLibraryHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FreeLibrary.cs">
<Link>Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LookupAccountSid.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LookupAccountSid.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs">
<Link>Common\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<Reference Include="Microsoft.Win32.Primitives" />
<Reference Include="Microsoft.Win32.Registry" />
<Reference Include="System.Collections.Specialized" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.Primitives" />
<Reference Include="System.ComponentModel.TypeConverter" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Process" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Diagnostics.TraceSource" />
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Security.Permissions" />
<Reference Include="System.Security.Principal.Windows" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.AccessControl" />
<Reference Include="System.Threading.Thread" />
<Reference Include="System.Threading.ThreadPool" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,40 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
namespace System.ComponentModel
{
internal static class CompModSwitches
{
private static volatile BooleanSwitch s_commonDesignerServices;
private static volatile TraceSwitch s_eventLog;
public static BooleanSwitch CommonDesignerServices
{
get
{
if (s_commonDesignerServices == null)
{
s_commonDesignerServices = new BooleanSwitch(nameof(CommonDesignerServices), "Assert if any common designer service is not found.");
}
return s_commonDesignerServices;
}
}
public static TraceSwitch EventLog
{
get
{
if (s_eventLog == null)
{
s_eventLog = new TraceSwitch(nameof(EventLog), "Enable tracing for the EventLog component.");
}
return s_eventLog;
}
}
}
}

View File

@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
public class EntryWrittenEventArgs : EventArgs
{
public EntryWrittenEventArgs()
{
}
public EntryWrittenEventArgs(EventLogEntry entry)
{
Entry = entry;
}
public EventLogEntry Entry { get; }
}
}

View File

@@ -0,0 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
public delegate void EntryWrittenEventHandler(object sender, EntryWrittenEventArgs e);
}

View File

@@ -0,0 +1,62 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
namespace System.Diagnostics
{
public class EventInstance
{
private int _categoryNumber;
private EventLogEntryType _entryType = EventLogEntryType.Information;
private long _instanceId;
public EventInstance(long instanceId, int categoryId)
{
CategoryId = categoryId;
InstanceId = instanceId;
}
public EventInstance(long instanceId, int categoryId, EventLogEntryType entryType) : this(instanceId, categoryId)
{
EntryType = entryType;
}
public int CategoryId
{
get => _categoryNumber;
set
{
if (value > UInt16.MaxValue || value < 0)
throw new ArgumentOutOfRangeException(nameof(CategoryId));
_categoryNumber = value;
}
}
public EventLogEntryType EntryType
{
get => _entryType;
set
{
if (!Enum.IsDefined(typeof(EventLogEntryType), value))
throw new InvalidEnumArgumentException(nameof(EntryType), (int)value, typeof(EventLogEntryType));
_entryType = value;
}
}
public long InstanceId
{
get => _instanceId;
set
{
if (value > UInt32.MaxValue || value < 0)
throw new ArgumentOutOfRangeException(nameof(InstanceId));
_instanceId = value;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,461 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using Microsoft.Win32;
namespace System.Diagnostics
{
[
ToolboxItem(false),
DesignTimeVisible(false),
]
public sealed class EventLogEntry : Component, ISerializable
{
internal byte[] dataBuf;
internal int bufOffset;
private EventLogInternal owner;
private string category;
private string message;
internal EventLogEntry(byte[] buf, int offset, EventLogInternal log)
{
this.dataBuf = buf;
this.bufOffset = offset;
this.owner = log;
GC.SuppressFinalize(this);
}
private EventLogEntry(SerializationInfo info, StreamingContext context)
{
throw new PlatformNotSupportedException();
}
[MonitoringDescription("The machine on which this event log resides.")]
public string MachineName
{
get
{
// first skip over the source name
int pos = bufOffset + FieldOffsets.RAWDATA;
while (CharFrom(dataBuf, pos) != '\0')
pos += 2;
pos += 2;
char ch = CharFrom(dataBuf, pos);
StringBuilder buf = new StringBuilder();
while (ch != '\0')
{
buf.Append(ch);
pos += 2;
ch = CharFrom(dataBuf, pos);
}
return buf.ToString();
}
}
[MonitoringDescription("The binary data associated with this entry in the event log.")]
public byte[] Data
{
get
{
int dataLen = IntFrom(dataBuf, bufOffset + FieldOffsets.DATALENGTH);
byte[] data = new byte[dataLen];
Array.Copy(dataBuf, bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.DATAOFFSET),
data, 0, dataLen);
return data;
}
}
[MonitoringDescription("The sequence of this entry in the event log.")]
public int Index
{
get
{
return IntFrom(dataBuf, bufOffset + FieldOffsets.RECORDNUMBER);
}
}
[MonitoringDescription("The category for this message.")]
public string Category
{
get
{
if (category == null)
{
string dllName = GetMessageLibraryNames("CategoryMessageFile");
string cat = owner.FormatMessageWrapper(dllName, (uint)CategoryNumber, null);
if (cat == null)
category = "(" + CategoryNumber.ToString(CultureInfo.CurrentCulture) + ")";
else
category = cat;
}
return category;
}
}
[MonitoringDescription("An application-specific category number assigned to this entry.")]
public short CategoryNumber
{
get
{
return ShortFrom(dataBuf, bufOffset + FieldOffsets.EVENTCATEGORY);
}
}
[
MonitoringDescription("The number identifying the message for this source."),
Obsolete("This property has been deprecated. Please use System.Diagnostics.EventLogEntry.InstanceId instead. http://go.microsoft.com/fwlink/?linkid=14202")
]
public int EventID
{
get
{
return IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID) & 0x3FFFFFFF;
}
}
[MonitoringDescription("The type of entry - Information, Warning, etc.")]
public EventLogEntryType EntryType
{
get
{
return (EventLogEntryType)ShortFrom(dataBuf, bufOffset + FieldOffsets.EVENTTYPE);
}
}
[MonitoringDescription("The text of the message for this entry.")]
public string Message
{
get
{
if (message == null)
{
string dllNames = GetMessageLibraryNames("EventMessageFile");
int msgId = IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID);
string msg = owner.FormatMessageWrapper(dllNames, (uint)msgId, ReplacementStrings);
if (msg == null)
{
StringBuilder msgBuf = new StringBuilder(SR.MessageNotFormatted + msgId + Source);
string[] strings = ReplacementStrings;
for (int i = 0; i < strings.Length; i++)
{
if (i != 0)
msgBuf.Append(", ");
msgBuf.Append("'");
msgBuf.Append(strings[i]);
msgBuf.Append("'");
}
msg = msgBuf.ToString();
}
else
msg = ReplaceMessageParameters(msg, ReplacementStrings);
message = msg;
}
return message;
}
}
[MonitoringDescription("The name of the application that wrote this entry.")]
public string Source
{
get
{
StringBuilder buf = new StringBuilder();
int pos = bufOffset + FieldOffsets.RAWDATA;
char ch = CharFrom(dataBuf, pos);
while (ch != '\0')
{
buf.Append(ch);
pos += 2;
ch = CharFrom(dataBuf, pos);
}
return buf.ToString();
}
}
[MonitoringDescription("The application-supplied strings used in the message.")]
public string[] ReplacementStrings
{
get
{
string[] strings = new string[ShortFrom(dataBuf, bufOffset + FieldOffsets.NUMSTRINGS)];
int i = 0;
int bufpos = bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.STRINGOFFSET);
StringBuilder buf = new StringBuilder();
while (i < strings.Length)
{
char ch = CharFrom(dataBuf, bufpos);
if (ch != '\0')
buf.Append(ch);
else
{
strings[i] = buf.ToString();
i++;
buf = new StringBuilder();
}
bufpos += 2;
}
return strings;
}
}
[
MonitoringDescription("The full number identifying the message in the event message dll."),
ComVisible(false)
]
public Int64 InstanceId
{
get
{
return (UInt32)IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID);
}
}
[MonitoringDescription("The time at which the application logged this entry.")]
public DateTime TimeGenerated
{
get
{
return beginningOfTime.AddSeconds(IntFrom(dataBuf, bufOffset + FieldOffsets.TIMEGENERATED)).ToLocalTime();
}
}
[MonitoringDescription("The time at which the system logged this entry to the event log.")]
public DateTime TimeWritten
{
get
{
return beginningOfTime.AddSeconds(IntFrom(dataBuf, bufOffset + FieldOffsets.TIMEWRITTEN)).ToLocalTime();
}
}
[MonitoringDescription("The username of the account associated with this entry by the writing application.")]
public string UserName
{
get
{
int sidLen = IntFrom(dataBuf, bufOffset + FieldOffsets.USERSIDLENGTH);
if (sidLen == 0)
return null;
byte[] sid = new byte[sidLen];
Array.Copy(dataBuf, bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.USERSIDOFFSET),
sid, 0, sid.Length);
int userNameLen = 256;
int domainNameLen = 256;
int sidNameUse = 0;
StringBuilder bufUserName = new StringBuilder(userNameLen);
StringBuilder bufDomainName = new StringBuilder(domainNameLen);
StringBuilder retUserName = new StringBuilder();
if (Interop.Kernel32.LookupAccountSid(MachineName, sid, bufUserName, ref userNameLen, bufDomainName, ref domainNameLen, ref sidNameUse) != 0)
{
retUserName.Append(bufDomainName.ToString());
retUserName.Append("\\");
retUserName.Append(bufUserName.ToString());
}
return retUserName.ToString();
}
}
private char CharFrom(byte[] buf, int offset)
{
return (char)ShortFrom(buf, offset);
}
public bool Equals(EventLogEntry otherEntry)
{
if (otherEntry == null)
return false;
int ourLen = IntFrom(dataBuf, bufOffset + FieldOffsets.LENGTH);
int theirLen = IntFrom(otherEntry.dataBuf, otherEntry.bufOffset + FieldOffsets.LENGTH);
if (ourLen != theirLen)
{
return false;
}
int min = bufOffset;
int max = bufOffset + ourLen;
int j = otherEntry.bufOffset;
for (int i = min; i < max; i++, j++)
if (dataBuf[i] != otherEntry.dataBuf[j])
{
return false;
}
return true;
}
private int IntFrom(byte[] buf, int offset)
{
// assumes Little Endian byte order.
return (unchecked((int)0xFF000000) & (buf[offset + 3] << 24)) | (0xFF0000 & (buf[offset + 2] << 16)) |
(0xFF00 & (buf[offset + 1] << 8)) | (0xFF & (buf[offset]));
}
internal string ReplaceMessageParameters(String msg, string[] insertionStrings)
{
int percentIdx = msg.IndexOf('%');
if (percentIdx < 0)
return msg;
int startCopyIdx = 0;
int msgLength = msg.Length;
StringBuilder buf = new StringBuilder();
string paramDLLNames = GetMessageLibraryNames("ParameterMessageFile");
while (percentIdx >= 0)
{
string param = null;
int lasNumIdx = percentIdx + 1;
while (lasNumIdx < msgLength && Char.IsDigit(msg, lasNumIdx))
lasNumIdx++;
uint paramMsgID = 0;
if (lasNumIdx != percentIdx + 1)
UInt32.TryParse(msg.Substring(percentIdx + 1, lasNumIdx - percentIdx - 1), out paramMsgID);
if (paramMsgID != 0)
param = owner.FormatMessageWrapper(paramDLLNames, paramMsgID, insertionStrings);
if (param != null)
{
if (percentIdx > startCopyIdx)
buf.Append(msg, startCopyIdx, percentIdx - startCopyIdx); // original chars from msg
buf.Append(param);
startCopyIdx = lasNumIdx;
}
percentIdx = msg.IndexOf('%', percentIdx + 1);
}
if (msgLength - startCopyIdx > 0)
buf.Append(msg, startCopyIdx, msgLength - startCopyIdx); // last span of original msg
return buf.ToString();
}
private static RegistryKey GetSourceRegKey(string logName, string source, string machineName)
{
RegistryKey eventKey = null;
RegistryKey logKey = null;
try
{
eventKey = EventLog.GetEventLogRegKey(machineName, false);
return eventKey?.OpenSubKey(logName ?? "Application", /*writable*/false)?.OpenSubKey(source, /*writeable*/false);
}
finally
{
eventKey?.Close();
logKey?.Close();
}
}
private string GetMessageLibraryNames(string libRegKey)
{
// get the value stored in the registry
string fileName = null;
RegistryKey regKey = null;
try
{
regKey = GetSourceRegKey(owner.Log, Source, owner.MachineName);
if (regKey != null)
{
fileName = (string)regKey.GetValue(libRegKey);
}
}
finally
{
regKey?.Close();
}
if (fileName == null)
return null;
// convert any absolute paths on a remote machine to use the \\MACHINENAME\DRIVELETTER$ shares
if (owner.MachineName != ".")
{
string[] fileNames = fileName.Split(';');
StringBuilder result = new StringBuilder();
for (int i = 0; i < fileNames.Length; i++)
{
if (fileNames[i].Length >= 2 && fileNames[i][1] == ':')
{
result.Append(@"\\");
result.Append(owner.MachineName);
result.Append(@"\");
result.Append(fileNames[i][0]);
result.Append("$");
result.Append(fileNames[i], 2, fileNames[i].Length - 2);
result.Append(';');
}
}
if (result.Length == 0)
{
return null;
}
else
{
return result.ToString(0, result.Length - 1);
}
}
else
{
return fileName;
}
}
private short ShortFrom(byte[] buf, int offset)
{
// assumes little Endian byte order.
return (short)((0xFF00 & (buf[offset + 1] << 8)) | (0xFF & buf[offset]));
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
throw new PlatformNotSupportedException();
}
private static class FieldOffsets
{
internal const int LENGTH = 0;
internal const int RESERVED = 4;
internal const int RECORDNUMBER = 8;
internal const int TIMEGENERATED = 12;
internal const int TIMEWRITTEN = 16;
internal const int EVENTID = 20;
internal const int EVENTTYPE = 24;
internal const int NUMSTRINGS = 26;
internal const int EVENTCATEGORY = 28;
internal const int RESERVEDFLAGS = 30;
internal const int CLOSINGRECORDNUMBER = 32;
internal const int STRINGOFFSET = 36;
internal const int USERSIDLENGTH = 40;
internal const int USERSIDOFFSET = 44;
internal const int DATALENGTH = 48;
internal const int DATAOFFSET = 52;
internal const int RAWDATA = 56;
}
private static readonly DateTime beginningOfTime = new DateTime(1970, 1, 1, 0, 0, 0);
private const int OFFSETFIXUP = 4 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4;
}
}

View File

@@ -0,0 +1,106 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections;
namespace System.Diagnostics
{
public class EventLogEntryCollection : ICollection
{
private readonly EventLogInternal _log;
internal EventLogEntryCollection(EventLogInternal log)
{
_log = log;
}
public int Count
{
get
{
return _log.EntryCount;
}
}
public virtual EventLogEntry this[int index]
{
get
{
return _log.GetEntryAt(index);
}
}
public void CopyTo(EventLogEntry[] entries, int index)
{
((ICollection)this).CopyTo((Array)entries, index);
}
public IEnumerator GetEnumerator()
{
return new EntriesEnumerator(this);
}
internal EventLogEntry GetEntryAtNoThrow(int index)
{
return _log.GetEntryAtNoThrow(index);
}
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
object ICollection.SyncRoot
{
get
{
return this;
}
}
void ICollection.CopyTo(Array array, int index)
{
EventLogEntry[] entries = _log.GetAllEntries();
Array.Copy(entries, 0, array, index, entries.Length);
}
private class EntriesEnumerator : IEnumerator
{
private EventLogEntryCollection entries;
private int num = -1;
private EventLogEntry cachedEntry = null;
internal EntriesEnumerator(EventLogEntryCollection entries)
{
this.entries = entries;
}
public object Current
{
get
{
if (cachedEntry == null)
throw new InvalidOperationException(SR.NoCurrentEntry);
return cachedEntry;
}
}
public bool MoveNext()
{
num++;
cachedEntry = entries.GetEntryAtNoThrow(num);
return cachedEntry != null;
}
public void Reset()
{
num = -1;
}
}
}
}

View File

@@ -0,0 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
public enum EventLogEntryType
{
Error = 1,
Warning = 2,
Information = 4,
SuccessAudit = 8,
FailureAudit = 16,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
public class EventSourceCreationData
{
private int _categoryCount;
private EventSourceCreationData() { }
public EventSourceCreationData(string source, string logName)
{
Source = source;
LogName = logName;
}
internal EventSourceCreationData(string source, string logName, string machineName) : this(source, logName)
{
MachineName = machineName;
}
private EventSourceCreationData(string source, string logName, string machineName,
string messageResourceFile, string parameterResourceFile,
string categoryResourceFile, short categoryCount)
: this(source, logName, machineName)
{
MessageResourceFile = messageResourceFile;
ParameterResourceFile = parameterResourceFile;
CategoryResourceFile = categoryResourceFile;
CategoryCount = categoryCount;
}
public string LogName { get; set; } = "Application";
public string MachineName { get; set; } = ".";
public string Source { get; set; }
public string MessageResourceFile { get; set; }
public string ParameterResourceFile { get; set; }
public string CategoryResourceFile { get; set; }
public int CategoryCount
{
get { return _categoryCount; }
set
{
if (value > UInt16.MaxValue || value < 0)
throw new ArgumentOutOfRangeException(nameof(CategoryCount));
_categoryCount = value;
}
}
}
}

View File

@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Win32
{
internal static class NativeMethods
{
public readonly static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
public const int WAIT_OBJECT_0 = 0x00000000;
public const int WAIT_TIMEOUT = 0x00000102;
public const int WAIT_ABANDONED = 0x00000080;
public const int SEEK_READ = 0x2;
public const int FORWARDS_READ = 0x4;
public const int BACKWARDS_READ = 0x8;
public const int ERROR_EVENTLOG_FILE_CHANGED = 1503;
public const int ERROR_FILE_NOT_FOUND = 2;
}
}

Some files were not shown because too many files have changed in this diff Show More